From 1b7315617feb671774009203787d69654952ad0c Mon Sep 17 00:00:00 2001 From: romankko2 Date: Tue, 2 Jul 2024 15:45:10 +0200 Subject: [PATCH 1/5] . --- app/src/plugins/app/_theme/global.sass | 36 ++++++++++++++- .../plugins/tm@_utils/server-links.utils.ts | 18 ++++---- .../_components/read-only/z-description.vue | 35 ++++++++++++--- .../_components/a-task-description.vue | 45 ++++++++++++++----- 4 files changed, 105 insertions(+), 29 deletions(-) diff --git a/app/src/plugins/app/_theme/global.sass b/app/src/plugins/app/_theme/global.sass index 11f4eb7..417d458 100644 --- a/app/src/plugins/app/_theme/global.sass +++ b/app/src/plugins/app/_theme/global.sass @@ -106,8 +106,42 @@ input[type="time"]::-webkit-calendar-picker-indicator height: 40px !important .server-links + background: rgba(127, 57, 251, 1) + padding: 4px 5px + a - text-decoration: underline + color: #fff + +.copy-btn + position: absolute + right: 0 + width: 10% + height: 100% + text-align: center + bottom: 0 + border-top-right-radius: 9999px + border-bottom-right-radius: 9999px + padding-top: 4px + background: #808080 + color: #fff + + &:hover + cursor: pointer + background: #666666 + +.copying-btn + position: absolute + right: 0 + width: 10% + height: 100% + text-align: center + bottom: 0 + border-top-right-radius: 9999px + border-bottom-right-radius: 9999px + padding-top: 4px + background: rgb(76, 175, 80) + color: #fff + transition: background 0.3s ease, color 0.3s ease @media (max-width: 534px) .mobile-view diff --git a/app/src/plugins/tm@_utils/server-links.utils.ts b/app/src/plugins/tm@_utils/server-links.utils.ts index 2726aee..a6a8be6 100644 --- a/app/src/plugins/tm@_utils/server-links.utils.ts +++ b/app/src/plugins/tm@_utils/server-links.utils.ts @@ -12,35 +12,35 @@ export function getServerLinks(description) { const text = p.textContent.trim() if (os === 'mac' && text.startsWith('smb://')) { - links.add(`${text}`) + links.add(text) } else if (os === 'win' && text.startsWith('\\\\')) { - links.add(`${text}`) + links.add(`${text.replace(/\//g, '\\')}`) } else if (os === 'mac' && text.startsWith('\\\\')) { const smbLink = 'smb:' + text.replace(/\\/g, '/') - links.add(`${smbLink}`) + links.add(smbLink) } else if (os === 'win' && text.startsWith('smb://')) { const windowsLink = text.replace(/^smb:/, '').replace(/\//g, '\\') - links.add(`${windowsLink}`) + links.add(`${windowsLink}`) } const anchor = p.querySelector('a') if (anchor) { const href = anchor.getAttribute('href') if (os === 'mac' && href.startsWith('smb://')) { - links.add(`${href}`) + links.add(href) } else if (os === 'win' && href.startsWith('\\\\')) { - links.add(`${href}`) + links.add(`${href.replace(/\//g, '\\')}`) } else if (os === 'mac' && href.startsWith('\\\\')) { const smbLink = 'smb:' + href.replace(/\\/g, '/') - links.add(`${smbLink}`) + links.add(smbLink) } else if (os === 'win' && href.startsWith('smb://')) { const windowsLink = href.replace(/^smb:/, '').replace(/\//g, '\\') - links.add(`${windowsLink}`) + links.add(`${windowsLink}`) } } }) - return Array.from(links).join('
') + return Array.from(links) } export function detectOS() { diff --git a/app/src/plugins/tm@modal/_components/read-only/z-description.vue b/app/src/plugins/tm@modal/_components/read-only/z-description.vue index eae2fc0..57738af 100644 --- a/app/src/plugins/tm@modal/_components/read-only/z-description.vue +++ b/app/src/plugins/tm@modal/_components/read-only/z-description.vue @@ -4,11 +4,15 @@
-
+

Odkazy na server

-
- +

Popis mastertasku

@@ -16,7 +20,7 @@ diff --git a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue index a23f31d..28d16f1 100644 --- a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue +++ b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue @@ -298,7 +298,7 @@ export default { async save() { if (this.mastertask.id) { this.mastertask.employees = this.mastertask.employees.map(employee => { - const { duration } = this.mastertask.subtasks.find(({ employee_id }) => employee_id == employee.id) + const { duration } = this.mastertask.subtasks.find(({ employee_id }) => employee_id == employee.id) || {} employee.duration = duration return employee }) diff --git a/app/src/plugins/tm@modal/task/_components/_components/a-task-description.vue b/app/src/plugins/tm@modal/task/_components/_components/a-task-description.vue index 2329b9b..2b0beb6 100644 --- a/app/src/plugins/tm@modal/task/_components/_components/a-task-description.vue +++ b/app/src/plugins/tm@modal/task/_components/_components/a-task-description.vue @@ -1,35 +1,17 @@ \ No newline at end of file From c58ca9405a7386a6c73a220c487634f9c1e24b6c Mon Sep 17 00:00:00 2001 From: romankko2 Date: Wed, 3 Jul 2024 10:39:17 +0200 Subject: [PATCH 3/5] . --- app/src/plugins/app/_theme/global.sass | 31 -------------------------- 1 file changed, 31 deletions(-) diff --git a/app/src/plugins/app/_theme/global.sass b/app/src/plugins/app/_theme/global.sass index 417d458..2382e8e 100644 --- a/app/src/plugins/app/_theme/global.sass +++ b/app/src/plugins/app/_theme/global.sass @@ -112,37 +112,6 @@ input[type="time"]::-webkit-calendar-picker-indicator a color: #fff -.copy-btn - position: absolute - right: 0 - width: 10% - height: 100% - text-align: center - bottom: 0 - border-top-right-radius: 9999px - border-bottom-right-radius: 9999px - padding-top: 4px - background: #808080 - color: #fff - - &:hover - cursor: pointer - background: #666666 - -.copying-btn - position: absolute - right: 0 - width: 10% - height: 100% - text-align: center - bottom: 0 - border-top-right-radius: 9999px - border-bottom-right-radius: 9999px - padding-top: 4px - background: rgb(76, 175, 80) - color: #fff - transition: background 0.3s ease, color 0.3s ease - @media (max-width: 534px) .mobile-view flex-direction: column From 935bde4bba69efde59b0ba67854e983443eca1da Mon Sep 17 00:00:00 2001 From: JakubPapso <“jakubpapso@gmail.com”> Date: Wed, 3 Jul 2024 13:34:18 +0200 Subject: [PATCH 4/5] [windows copy link fix] --- .../plugins/tm@_utils/server-links.utils.ts | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/app/src/plugins/tm@_utils/server-links.utils.ts b/app/src/plugins/tm@_utils/server-links.utils.ts index c45b814..614c0a0 100644 --- a/app/src/plugins/tm@_utils/server-links.utils.ts +++ b/app/src/plugins/tm@_utils/server-links.utils.ts @@ -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 @@ -18,7 +24,7 @@ export function detectOS() { export function prepareHTMLDescription(description) { if (!description) return description - + const os = detectOS() // make an array from the description of strings from between

and

tags @@ -57,10 +63,24 @@ export function prepareHTMLDescription(description) { function getCopyFunction(text) { return ` - navigator.clipboard.writeText('${text}').then(() => { + 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!') - }).catch(err => { - window.toast.error('Failed to copy link to clipboard!') - }); + } ` } \ No newline at end of file From 86d97c01307dfc2b4458ebc22b1397628028b142 Mon Sep 17 00:00:00 2001 From: JakubPapso <“jakubpapso@gmail.com”> Date: Wed, 3 Jul 2024 15:43:32 +0200 Subject: [PATCH 5/5] [macos links via href] --- app/src/plugins/tm@_utils/server-links.utils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/plugins/tm@_utils/server-links.utils.ts b/app/src/plugins/tm@_utils/server-links.utils.ts index 614c0a0..22f972a 100644 --- a/app/src/plugins/tm@_utils/server-links.utils.ts +++ b/app/src/plugins/tm@_utils/server-links.utils.ts @@ -50,7 +50,9 @@ export function prepareHTMLDescription(description) { if (!link) return word - return `${link}` + if (os === 'mac') return `${link}` + + return `${link}` }) return `

${modifiedWords.join(' ')}

` @@ -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();