-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tycho: Adds input addon with copy button #1289
Conversation
This is more flexible than just being able to show a simple text.
This is adapted from the OXOMI JS code base, so it should work in all modern browsers + IE 11.
This allows to render an addon button next to a (most probably read-only) which copies the current value of the field into the clipboard on click. It also updates the tooltip when this action worked.
@@ -691,3 +691,64 @@ sirius.extractFileExtension = function (filename) { | |||
} | |||
return '.' + nameAndExtension.pop(); | |||
} | |||
|
|||
/**@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this solve that https://github.com/scireum/sirius-web/blob/develop/src/main/resources/default/assets/tycho/scripts/clipboard.js.pasta can't already do (except the scoping)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just my opinion:
- Better scoping (along the other helper methods)
- More robust fake element / fallback handling
- Tried and tested code that ran a long time in OX (I can't find a call to the function from clipboard js)
- Marking the element with a class (which is a required use case for OX
Actually I really didn't know the other function existed as it is nowhere used in sirius-web :D
This allows to render an addon button next to a (most probably read-only) which copies the current value of the field into the clipboard on click.
It also updates the tooltip when this action worked.
Sample: