mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 01:13:48 +01:00
Improve contextmenu handling
This commit is contained in:
parent
8350577968
commit
a130ce2abc
@ -2,6 +2,7 @@
|
|||||||
<component :is="self ? 'MkA' : 'a'" class="ieqqeuvs _link" :[attr]="self ? url.substr(local.length) : url" :rel="rel" :target="target"
|
<component :is="self ? 'MkA' : 'a'" class="ieqqeuvs _link" :[attr]="self ? url.substr(local.length) : url" :rel="rel" :target="target"
|
||||||
@mouseover="onMouseover"
|
@mouseover="onMouseover"
|
||||||
@mouseleave="onMouseleave"
|
@mouseleave="onMouseleave"
|
||||||
|
@contextmenu.stop="() => {}"
|
||||||
>
|
>
|
||||||
<template v-if="!self">
|
<template v-if="!self">
|
||||||
<span class="schema">{{ schema }}//</span>
|
<span class="schema">{{ schema }}//</span>
|
||||||
|
@ -57,6 +57,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onContextmenu(e) {
|
onContextmenu(e) {
|
||||||
|
const isLink = (el: HTMLElement) => {
|
||||||
|
if (el.tagName === 'A') return true;
|
||||||
|
if (el.parentElement) {
|
||||||
|
return isLink(el.parentElement);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (isLink(e.target)) return;
|
||||||
if (['INPUT', 'TEXTAREA'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
|
if (['INPUT', 'TEXTAREA'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
|
||||||
if (window.getSelection().toString() !== '') return;
|
if (window.getSelection().toString() !== '') return;
|
||||||
const path = this.$route.path;
|
const path = this.$route.path;
|
||||||
|
@ -187,6 +187,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onContextmenu(e) {
|
onContextmenu(e) {
|
||||||
|
const isLink = (el: HTMLElement) => {
|
||||||
|
if (el.tagName === 'A') return true;
|
||||||
|
if (el.parentElement) {
|
||||||
|
return isLink(el.parentElement);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (isLink(e.target)) return;
|
||||||
if (['INPUT', 'TEXTAREA'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
|
if (['INPUT', 'TEXTAREA'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
|
||||||
if (window.getSelection().toString() !== '') return;
|
if (window.getSelection().toString() !== '') return;
|
||||||
const path = this.$route.path;
|
const path = this.$route.path;
|
||||||
|
Loading…
Reference in New Issue
Block a user