mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[macos links via href]
This commit is contained in:
1 parent
d547ded59f
commit
86d97c0130
1 file changed
+6
-3
@@ -50,7 +50,9 @@ export function prepareHTMLDescription(description) {
|
||||
|
||||
if (!link) return word
|
||||
|
||||
return `<span style="cursor: pointer" onclick="${getCopyFunction(link)}">${link}</span>`
|
||||
if (os === 'mac') return `<a href="${link}">${link}</a>`
|
||||
|
||||
return `<span style="cursor: pointer; text-decoration: underline" onclick="${getCopyFunction(link)}">${link}</span>`
|
||||
})
|
||||
|
||||
return `<p>${modifiedWords.join(' ')}</p>`
|
||||
@@ -63,8 +65,9 @@ export function prepareHTMLDescription(description) {
|
||||
|
||||
function getCopyFunction(text) {
|
||||
return `
|
||||
console.log('${text.replace(/\\/g, '\\\\')}')
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText('${text}').then(() => {
|
||||
navigator.clipboard.writeText('${text.replace(/\\/g, '\\\\')}').then(() => {
|
||||
window.toast.success('Link copied to clipboard!')
|
||||
}).catch(err => {
|
||||
window.toast.error('Failed to copy link to clipboard!')
|
||||
@@ -74,7 +77,7 @@ function getCopyFunction(text) {
|
||||
input.style.position = 'fixed';
|
||||
input.style.opacity = 0;
|
||||
input.style.pointerEvents = 'none';
|
||||
input.value = '\\\\${text}';
|
||||
input.value = '${text.replace(/\\/g, '\\\\')}';
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
input.focus();
|
||||
|
||||
Reference in new issue
Block a user