From 45700d7875fbfe619ec2757b70af38aded3ac874 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 15 Jan 2022 19:29:15 +0000 Subject: [PATCH] :sparkles: Adds option to copy item URL to clipboard --- src/components/LinkItems/Item.vue | 13 ++++++++++++- src/components/LinkItems/ItemContextMenu.vue | 6 ++++++ src/components/LinkItems/ItemOpenMethodIcon.vue | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vue index 414706ef..024de6f2 100644 --- a/src/components/LinkItems/Item.vue +++ b/src/components/LinkItems/Item.vue @@ -141,7 +141,7 @@ export default { hyperLinkHref() { const nothing = '#'; if (this.isEditMode) return nothing; - const noAnchorNeeded = ['modal', 'workspace']; + const noAnchorNeeded = ['modal', 'workspace', 'clipboard']; return noAnchorNeeded.includes(this.accumulatedTarget) ? nothing : this.url; }, }, @@ -174,6 +174,9 @@ export default { this.$emit('triggerModal', this.url); } else if (this.accumulatedTarget === 'workspace') { router.push({ name: 'workspace', query: { url: this.url } }); + } else if (this.accumulatedTarget === 'clipboard') { + navigator.clipboard.writeText(this.url); + this.$toasted.show(this.$t('context-menus.item.copied-toast')); } else { this.$emit('itemClicked'); } @@ -226,6 +229,7 @@ export default { case 'top': return '"\\f102"'; case 'modal': return '"\\f2d0"'; case 'workspace': return '"\\f0b1"'; + case 'clipboard': return '"\\f0ea"'; default: return '"\\f054"'; } }, @@ -279,6 +283,10 @@ export default { case 'workspace': router.push({ name: 'workspace', query: { url } }); break; + case 'clipboard': + navigator.clipboard.writeText(url); + this.$toasted.show(this.$t('context-menus.item.copied-toast')); + break; default: window.open(url, '_blank'); } }, @@ -546,4 +554,7 @@ a.item.is-edit-mode { .disabled-link { pointer-events: none; } +.tooltip.item-description-tooltip { + z-index: 7; +} diff --git a/src/components/LinkItems/ItemContextMenu.vue b/src/components/LinkItems/ItemContextMenu.vue index 1d29a756..6fc9131f 100644 --- a/src/components/LinkItems/ItemContextMenu.vue +++ b/src/components/LinkItems/ItemContextMenu.vue @@ -23,6 +23,10 @@ {{ $t('context-menus.item.workspace') }} +
  • + + {{ $t('context-menus.item.clipboard') }} +