mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
.
This commit is contained in:
1 parent
ef7ab9dd17
commit
1b7315617f
4 files changed
+105
-29
No files matched your search
@@ -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
|
||||
|
||||
@@ -12,35 +12,35 @@ export function getServerLinks(description) {
|
||||
const text = p.textContent.trim()
|
||||
|
||||
if (os === 'mac' && text.startsWith('smb://')) {
|
||||
links.add(`<a href="${text}" target="_blank" rel="noopener noreferrer">${text}</a>`)
|
||||
links.add(text)
|
||||
} else if (os === 'win' && text.startsWith('\\\\')) {
|
||||
links.add(`<a href="file://${text.replace(/\\/g, '/')}" target="_blank" rel="noopener noreferrer">${text}</a>`)
|
||||
links.add(`${text.replace(/\//g, '\\')}`)
|
||||
} else if (os === 'mac' && text.startsWith('\\\\')) {
|
||||
const smbLink = 'smb:' + text.replace(/\\/g, '/')
|
||||
links.add(`<a href="${smbLink}" target="_blank" rel="noopener noreferrer">${smbLink}</a>`)
|
||||
links.add(smbLink)
|
||||
} else if (os === 'win' && text.startsWith('smb://')) {
|
||||
const windowsLink = text.replace(/^smb:/, '').replace(/\//g, '\\')
|
||||
links.add(`<a href="file://${windowsLink}" target="_blank" rel="noopener noreferrer">${windowsLink}</a>`)
|
||||
links.add(`${windowsLink}`)
|
||||
}
|
||||
|
||||
const anchor = p.querySelector('a')
|
||||
if (anchor) {
|
||||
const href = anchor.getAttribute('href')
|
||||
if (os === 'mac' && href.startsWith('smb://')) {
|
||||
links.add(`<a href="${href}" target="_blank" rel="noopener noreferrer">${href}</a>`)
|
||||
links.add(href)
|
||||
} else if (os === 'win' && href.startsWith('\\\\')) {
|
||||
links.add(`<a href="file://${href.replace(/\\/g, '/')}" target="_blank" rel="noopener noreferrer">${href}</a>`)
|
||||
links.add(`${href.replace(/\//g, '\\')}`)
|
||||
} else if (os === 'mac' && href.startsWith('\\\\')) {
|
||||
const smbLink = 'smb:' + href.replace(/\\/g, '/')
|
||||
links.add(`<a href="${smbLink}" target="_blank" rel="noopener noreferrer">${smbLink}</a>`)
|
||||
links.add(smbLink)
|
||||
} else if (os === 'win' && href.startsWith('smb://')) {
|
||||
const windowsLink = href.replace(/^smb:/, '').replace(/\//g, '\\')
|
||||
links.add(`<a href="file://${windowsLink}" target="_blank" rel="noopener noreferrer">${windowsLink}</a>`)
|
||||
links.add(`${windowsLink}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return Array.from(links).join('<br>')
|
||||
return Array.from(links)
|
||||
}
|
||||
|
||||
export function detectOS() {
|
||||
|
||||
@@ -4,11 +4,15 @@
|
||||
<section v-html="description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||
</div>
|
||||
|
||||
<div v-if="hasMasterTaskDescLinks" class="px-5">
|
||||
<div v-if="masterTaskDescLinks?.length > 0" class="px-5 d-flex flex-column">
|
||||
<p class="py-3">Odkazy na server</p>
|
||||
<p class="server-links" v-html="masterTaskDescLinks" />
|
||||
<div v-for="index in masterTaskDescLinks" :key="index" class="server-links my-1 rounded-pill text-truncate position-relative">
|
||||
<a :href="index">{{ index }}</a>
|
||||
<p v-if="!copiedIndices.includes('subtask-' + index)" class="copy-btn" @click.stop="copyToClipboard('subtask-', index)">Copy</p>
|
||||
<p v-else class="copying-btn">Copied!</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="px-5 py-5 border-bottom" v-if="inheritedDescription">
|
||||
<p>Popis mastertasku</p>
|
||||
<section v-html="inheritedDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||
@@ -16,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getServerLinks } from '@/plugins/tm@_utils/server-links.utils'
|
||||
import { getServerLinks, detectOS } from '@/plugins/tm@_utils/server-links.utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -31,13 +35,30 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
copiedIndices: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
masterTaskDescLinks() {
|
||||
return getServerLinks(this.description)
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
hasMasterTaskDescLinks() {
|
||||
return this.masterTaskDescLinks.trim().length > 0
|
||||
methods: {
|
||||
copyToClipboard(prefix, index) {
|
||||
const fullIndex = prefix + index
|
||||
const os = detectOS()
|
||||
navigator.clipboard.writeText(os + ': ' + index).then(() => {
|
||||
this.copiedIndices.push(fullIndex)
|
||||
setTimeout(() => {
|
||||
const idx = this.copiedIndices.indexOf(fullIndex)
|
||||
if (idx > -1)
|
||||
this.copiedIndices.splice(idx, 1)
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,13 @@
|
||||
<section v-html="description" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||
</div>
|
||||
|
||||
<div v-if="hasSubtaskDescLinks" class="px-5">
|
||||
<div v-if="subtaskDescLinks?.length > 0" class="px-5 d-flex flex-column">
|
||||
<p class="py-3">Odkazy na server</p>
|
||||
<p class="server-links" v-html="subtaskDescLinks" />
|
||||
<div v-for="index in subtaskDescLinks" :key="'subtask-' + index" class="server-links my-1 rounded-pill text-truncate position-relative">
|
||||
<a :href="index">{{ index }}</a>
|
||||
<p v-if="!copiedIndices.includes('subtask-' + index)" class="copy-btn" @click.stop="copyToClipboard('subtask-', index)">Copy</p>
|
||||
<p v-else class="copying-btn">Copied!</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="px-5 py-5 border-bottom" v-if="mastertaskDescription">
|
||||
@@ -14,14 +18,18 @@
|
||||
<section v-html="mastertaskDescription" class="description-detail px-2 py-2 w-100 rounded mt-2" />
|
||||
</div>
|
||||
|
||||
<div v-if="hasSubtaskMTDescLinks" class="px-5">
|
||||
<div v-if="subtaskMTDecsLinks?.length > 0" class="px-5 d-flex flex-column">
|
||||
<p class="py-3">Odkazy na server</p>
|
||||
<p class="server-links" v-html="subtaskMTDecsLinks" />
|
||||
<div v-for="index in subtaskMTDecsLinks" :key="'mastertask-' + index" class="server-links my-1 rounded-pill text-truncate position-relative">
|
||||
<a :href="index">{{ index }}</a>
|
||||
<p v-if="!copiedIndices.includes('mastertask-' + index)" class="copy-btn" @click.stop="copyToClipboard('mastertask-', index)">Copy</p>
|
||||
<p v-else class="copying-btn">Copied!</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getServerLinks } from '@/plugins/tm@_utils/server-links.utils'
|
||||
import { getServerLinks, detectOS } from '@/plugins/tm@_utils/server-links.utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -36,6 +44,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
copiedIndices: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
subtaskDescLinks() {
|
||||
return getServerLinks(this.description)
|
||||
@@ -43,14 +57,21 @@ export default {
|
||||
|
||||
subtaskMTDecsLinks() {
|
||||
return getServerLinks(this.mastertaskDescription)
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
hasSubtaskDescLinks() {
|
||||
return this.subtaskDescLinks.trim().length > 0
|
||||
},
|
||||
|
||||
hasSubtaskMTDescLinks() {
|
||||
return this.subtaskMTDecsLinks.trim().length > 0
|
||||
methods: {
|
||||
copyToClipboard(prefix, index) {
|
||||
const fullIndex = prefix + index
|
||||
const os = detectOS()
|
||||
navigator.clipboard.writeText(os + ': ' + index).then(() => {
|
||||
this.copiedIndices.push(fullIndex)
|
||||
setTimeout(() => {
|
||||
const idx = this.copiedIndices.indexOf(fullIndex)
|
||||
if (idx > -1)
|
||||
this.copiedIndices.splice(idx, 1)
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user