Screenshot
This is a dialog with added functionality for leting a user copy some given text into the OS's clipboard.
Before click on button
After click on button
API
The API of ewc-dialog applies to this element as well, because this element derives from ewc-dialog.
Additionally, there is the following property:
- clipboardContent - the given string is copied into the clipboard. Can be modified at runtime.
Usage with WebPack
package.json
"dependencies": {
"@ewc-lib/ewc-dialog-clipboard": "^0.1.0"
},
main.js
import "@ewc-lib/ewc-css/ewc.css"
import "@ewc-lib/ewc-dialog-clipboard"
index.html
<body>
<script src="bundle.js"></script>
<ewc-dialog-clipboard></ewc-dialog-clipboard>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
const el = document.getElementsByTagName("ewc-dialog")[0]
el.title = "ewc-dialog-feedback demonstration"
el.bodyHtml = "Click to copy to clipboard."
el.visible = true
el.clipboardContent = "This is the text being copied into the clipboard."
})
</script>
</body>