mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-20 21:04:17 +08:00
warn if clipboard support is missing (#922)
* warn if clipboard support is missing * make the message a bit more helpful * Update assets/js/app.js Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
This commit is contained in:
parent
e94950e70c
commit
cd958f1492
1 changed files with 8 additions and 4 deletions
|
@ -91,12 +91,16 @@ window.addEventListener("lb:set_value", (event) => {
|
|||
event.target.value = event.detail.value;
|
||||
});
|
||||
|
||||
if ("clipboard" in navigator) {
|
||||
window.addEventListener("lb:clipcopy", (event) => {
|
||||
window.addEventListener("lb:clipcopy", (event) => {
|
||||
if ("clipboard" in navigator) {
|
||||
const text = event.target.textContent;
|
||||
navigator.clipboard.writeText(text);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
alert(
|
||||
"Sorry, your browser does not support clipboard copy.\nThis generally requires a secure origin — either HTTPS or localhost."
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Other global handlers
|
||||
|
||||
|
|
Loading…
Reference in a new issue