mirror of https://github.com/lissy93/dashy
✨ Adds option to copy item URL to clipboard
This commit is contained in:
parent
967daac95d
commit
45700d7875
|
@ -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>
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
<WorkspaceOpenIcon />
|
||||
<span>{{ $t('context-menus.item.workspace') }}</span>
|
||||
</li>
|
||||
<li @click="launch('clipboard')">
|
||||
<ClipboardOpenIcon />
|
||||
<span>{{ $t('context-menus.item.clipboard') }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Edit Options -->
|
||||
<ul class="menu-section">
|
||||
|
@ -55,6 +59,7 @@ import SameTabOpenIcon from '@/assets/interface-icons/open-current-tab.svg';
|
|||
import NewTabOpenIcon from '@/assets/interface-icons/open-new-tab.svg';
|
||||
import IframeOpenIcon from '@/assets/interface-icons/open-iframe.svg';
|
||||
import WorkspaceOpenIcon from '@/assets/interface-icons/open-workspace.svg';
|
||||
import ClipboardOpenIcon from '@/assets/interface-icons/open-clipboard.svg';
|
||||
|
||||
export default {
|
||||
name: 'ContextMenu',
|
||||
|
@ -66,6 +71,7 @@ export default {
|
|||
NewTabOpenIcon,
|
||||
IframeOpenIcon,
|
||||
WorkspaceOpenIcon,
|
||||
ClipboardOpenIcon,
|
||||
},
|
||||
props: {
|
||||
posX: Number, // The X coordinate for positioning
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<WorkspaceOpenIcon v-else-if="openingMethod === 'workspace'" />
|
||||
<ParentOpenIcon v-else-if="openingMethod === 'parent'" />
|
||||
<TopOpenIcon v-else-if="openingMethod === 'top'" />
|
||||
<ClipboardOpenIcon v-else-if="openingMethod === 'clipboard'" />
|
||||
<UnknownIcon v-else />
|
||||
</div>
|
||||
<div v-if="hotkey" :class="`hotkey-denominator ${makeClass(position, isSmall, isTransparent)}`">
|
||||
|
@ -25,6 +26,7 @@ import IframeOpenIcon from '@/assets/interface-icons/open-iframe.svg';
|
|||
import WorkspaceOpenIcon from '@/assets/interface-icons/open-workspace.svg';
|
||||
import ParentOpenIcon from '@/assets/interface-icons/open-parent.svg';
|
||||
import TopOpenIcon from '@/assets/interface-icons/open-top.svg';
|
||||
import ClipboardOpenIcon from '@/assets/interface-icons/open-clipboard.svg';
|
||||
import UnknownIcon from '@/assets/interface-icons/unknown-icon.svg';
|
||||
|
||||
export default {
|
||||
|
@ -52,6 +54,7 @@ export default {
|
|||
WorkspaceOpenIcon,
|
||||
ParentOpenIcon,
|
||||
TopOpenIcon,
|
||||
ClipboardOpenIcon,
|
||||
UnknownIcon,
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue