Adds option to copy item URL to clipboard

This commit is contained in:
Alicia Sykes
2022-01-15 19:29:15 +00:00
parent 967daac95d
commit 45700d7875
3 changed files with 21 additions and 1 deletions
+12 -1
View File
@@ -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;
}
</style>