mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[windows copy link fix]
This commit is contained in:
1 parent
484eca5548
commit
935bde4bba
1 file changed
+21
-1
@@ -1,7 +1,13 @@
|
||||
import { useToast } from 'vue-toast-notification';
|
||||
const toast = useToast();
|
||||
|
||||
window.toast = toast
|
||||
declare global {
|
||||
interface Window {
|
||||
toast: typeof toast;
|
||||
}
|
||||
}
|
||||
|
||||
window.toast = toast;
|
||||
|
||||
export function detectOS() {
|
||||
const platform = window.navigator.platform
|
||||
@@ -57,10 +63,24 @@ export function prepareHTMLDescription(description) {
|
||||
|
||||
function getCopyFunction(text) {
|
||||
return `
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText('${text}').then(() => {
|
||||
window.toast.success('Link copied to clipboard!')
|
||||
}).catch(err => {
|
||||
window.toast.error('Failed to copy link to clipboard!')
|
||||
});
|
||||
} else {
|
||||
const input = document.createElement('input');
|
||||
input.style.position = 'fixed';
|
||||
input.style.opacity = 0;
|
||||
input.style.pointerEvents = 'none';
|
||||
input.value = '\\\\${text}';
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
input.focus();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(input);
|
||||
window.toast.success('Link copied to clipboard!')
|
||||
}
|
||||
`
|
||||
}
|
||||
Reference in new issue
Block a user