Selecting / Copying Text in Habmin

Hello,

I’m wondering if I’m missing something: In both Firefox and Chrome Habmin seems to have somehow disabled the ability to “select” text. For example: If I want to change the text in a text field, I can use backspace to erase the name, but I cannot select the text to erase it all at once.

I’ve further discovered that this applies to all text. If I want to copy-paste the name of an item or thing, you can’t do that.

Am I missing something here? I find it rather inexplicable that the ability to copy text would be purposely disabled in Habmin.

As far as I remember it has always been this way. Does not bother me too much, though.

Maybe not that part in particular… But it’s really frustrating not being able to copy-paste the very long names that are auto assigned to Items when you auto-discover them in the UI given the fact that you pretty much have to textually enter them many times to create rules and such.

For example:
Screenshot_2018-09-10%20Screenshot

I found an option to “Copy” the Item name here, but it doesn’t work:

If you use this “copy” button it pops up a message saying the item name was copied to clipboard, but nothing is actually copied.

I dove into the CSS and sure enough copy paste is disabled in several places throughout the CSS code:

-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none

It makes no sense to me why the ability to select text would be explicitly disabled like this. Why would you go out of your way to make the UI less user friendly?

I would use Paper UI since it has no problem with copy paste, but it doesn’t show the correct names:

Screenshot_2018-09-10%20Paper%20UI

Notice the use of colons “:” rather than underscores “_”. So if you copy paste these names into your .rules files it will not work.

There is an open issue for this already:

You are mixing up things here:

The part you are trying to copy from HABmin is the item name https://www.openhab.org/docs/configuration/items.html#item-definition-and-syntax, the part you are referring to in PaperUI is the channel name https://www.openhab.org/docs/concepts/things.html#channels which needs to be linked to an itemtype.
So everything is correct here :grinning:

You’re being a little obtuse here.

My point was that the names in Paper UI aren’t useful as they aren’t the names I need to use when writing rules. That’s all I meant and that’s all that matters to me. That’s why this post is primarily about Habmin rather than Paper UI. I was just trying to preempt someone from saying “Have you tried Paper UI?” I realized they were the “channel names”… Why does that distinction matter so much to you? The fact that Paper UI doesn’t offer the item names anywhere is the frustrating part in and of itself. Habmin offers the “item names” needed for writing rules but doesn’t allow them to be copied/pasted. Paper UI offers a “channel name” that can be copied/pasted but that is not useful for writing rules (And isn’t writing rules pretty much the primary thing one does with a Home Automation solution?) And since the “Items” that are auto discovered/generated by the UI when you add a Zwave device are stored in an internal database instead of the .items files… The only way to access these names is via the Habmin UI.

If in your mind that means “everything is correct here” when the end result is that there is no useful or easy way to get to the item names (Which are crucial to building the rules needed to actually automate anything) then I’m not really sure what else to say.

That bug you linked has been unresolved for 2.5 years. And the thing is the “feature” it’s referring to being broken would be entirely unnecessary if someone would just remove the CSS rules from Habmin that disable the selection of text. I ended up using a bookmarklet to remove the problematic CSS from Habmin myself:

javascript:(function(){function%20allowTextSelection(){window.console&&console.log('allowTextSelection');var%20style=document.createElement('style');style.type='text/css';style.innerHTML='*,p,div{user-select:text%20!important;-moz-user-select:text%20!important;-webkit-user-select:text%20!important;}';document.head.appendChild(style);var%20elArray=document.body.getElementsByTagName('*');for(var%20i=0;i<elArray.length;i++){var%20el=elArray[i];el.onselectstart=el.ondragstart=el.ondrag=el.oncontextmenu=el.onmousedown=el.onmouseup=function(){return%20true};if(el%20instanceof%20HTMLInputElement&&['text','password','email','number','tel','url'].indexOf(el.type.toLowerCase())>-1){el.removeAttribute('disabled');el.onkeydown=el.onkeyup=function(){return%20true};}}}allowTextSelection();})();

And now I can copy paste item names from Habmin UI by clicking this Bookmarklet every time I load the Habmin UI. The point though is: It shouldn’t be this hard to access the item names.

Thx. Always nice to meet people like you.

Have you considered using VS Code with the openHAB extension? That gives you access to the item names, and also validates the rule code.

Someone? Does that mean you could do it? If so, then maybe you can propose a PR?

1 Like