@ewc-lib/ewc-dialog-clipboard
v1.0.4-alpha
Published
This is a dialog with added functionality for leting a user copy some given text into the OS's clipboard.
Downloads
180
Keywords
Readme
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": "latest"
},
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-clipboard")[0]
el.title = "ewc-dialog-clipboard demonstration"
el.bodyHtml = "Click to copy to clipboard."
el.clipboardContent = "This is the text being copied into the clipboard."
el.visible = true
})
</script>
</body>