vito/resources/js/app.js
Saeed Vaziry d1f2add699 - 2.x - sites (wip)
- improved ssh error handling
- database soft deletes
2024-10-04 21:34:07 +02:00

29 lines
712 B
JavaScript

import CodeEditorAlpinePlugin from "./components/editor";
document.addEventListener("alpine:init", () => {
window.Alpine.plugin(CodeEditorAlpinePlugin);
});
window.copyToClipboard = async function (text) {
try {
await navigator.clipboard.writeText(text);
} catch (err) {
const textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.position = "absolute";
textArea.style.left = "-999999px";
document.body.prepend(textArea);
textArea.select();
try {
document.execCommand("copy");
} catch (error) {
//
} finally {
textArea.remove();
}
}
};