mirror of https://github.com/Lissy93/dashy.git
👔 Improved opening method logic (#492)
This commit is contained in:
parent
16aa14fcbb
commit
879b3b8f32
|
@ -3,7 +3,7 @@
|
||||||
<a @click="itemOpened"
|
<a @click="itemOpened"
|
||||||
@mouseup.right="openContextMenu"
|
@mouseup.right="openContextMenu"
|
||||||
@contextmenu.prevent
|
@contextmenu.prevent
|
||||||
:href="hyperLinkHref"
|
:href="url"
|
||||||
:target="anchorTarget"
|
:target="anchorTarget"
|
||||||
:class="`item ${makeClassList}`"
|
:class="`item ${makeClassList}`"
|
||||||
v-tooltip="getTooltipOptions()"
|
v-tooltip="getTooltipOptions()"
|
||||||
|
@ -141,6 +141,7 @@ export default {
|
||||||
},
|
},
|
||||||
/* Get href for anchor, if not in edit mode, or opening in modal/ workspace */
|
/* Get href for anchor, if not in edit mode, or opening in modal/ workspace */
|
||||||
hyperLinkHref() {
|
hyperLinkHref() {
|
||||||
|
// TODO Remove this method, and implement elsewhere
|
||||||
const nothing = '#';
|
const nothing = '#';
|
||||||
if (this.isEditMode) return nothing;
|
if (this.isEditMode) return nothing;
|
||||||
const noAnchorNeeded = ['modal', 'workspace', 'clipboard'];
|
const noAnchorNeeded = ['modal', 'workspace', 'clipboard'];
|
||||||
|
@ -168,20 +169,28 @@ export default {
|
||||||
itemOpened(e) {
|
itemOpened(e) {
|
||||||
if (this.isEditMode) {
|
if (this.isEditMode) {
|
||||||
// If in edit mode, open settings, and don't launch app
|
// If in edit mode, open settings, and don't launch app
|
||||||
|
e.preventDefault();
|
||||||
this.openItemSettings();
|
this.openItemSettings();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.altKey || this.accumulatedTarget === 'modal') {
|
// For certain opening methods, prevent default and manually navigate
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
window.open(this.url, '_blank');
|
||||||
|
} else if (e.altKey || this.accumulatedTarget === 'modal') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.$emit('triggerModal', this.url);
|
this.$emit('triggerModal', this.url);
|
||||||
} else if (this.accumulatedTarget === 'workspace') {
|
} else if (this.accumulatedTarget === 'workspace') {
|
||||||
|
e.preventDefault();
|
||||||
router.push({ name: 'workspace', query: { url: this.url } });
|
router.push({ name: 'workspace', query: { url: this.url } });
|
||||||
} else if (this.accumulatedTarget === 'clipboard') {
|
} else if (this.accumulatedTarget === 'clipboard') {
|
||||||
|
e.preventDefault();
|
||||||
navigator.clipboard.writeText(this.url);
|
navigator.clipboard.writeText(this.url);
|
||||||
this.$toasted.show(this.$t('context-menus.item.copied-toast'));
|
this.$toasted.show(this.$t('context-menus.item.copied-toast'));
|
||||||
} else {
|
|
||||||
this.$emit('itemClicked');
|
|
||||||
}
|
}
|
||||||
|
// Emit event to clear search field, etc
|
||||||
|
this.$emit('itemClicked');
|
||||||
|
|
||||||
// Update the most/ last used ledger, for smart-sorting
|
// Update the most/ last used ledger, for smart-sorting
|
||||||
if (!this.appConfig.disableSmartSort) {
|
if (!this.appConfig.disableSmartSort) {
|
||||||
this.incrementMostUsedCount(this.id);
|
this.incrementMostUsedCount(this.id);
|
||||||
|
|
Loading…
Reference in New Issue