mirror of
https://github.com/BrenBroZAYT/dashy.git
synced 2026-06-16 08:15:46 +00:00
✨ Adds option to copy item URL to clipboard
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user