This commit is contained in:
romankko2 committed 2024-07-02 15:45:10 +02:00
1 parent ef7ab9dd17
commit 1b7315617f
4 files changed
+105 -29

No files matched your search

@@ -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)
})
}
}
}