This commit is contained in:
syuilo 2022-01-18 21:35:57 +09:00
parent 9869f01e7c
commit a8fad1b61c
8 changed files with 24 additions and 24 deletions

View File

@ -153,8 +153,8 @@ export default defineComponent({
this.$refs.window.close(); this.$refs.window.close();
}, },
onContextmenu(e) { onContextmenu(ev: MouseEvent) {
os.contextMenu(this.contextmenu, e); os.contextMenu(this.contextmenu, ev);
} }
}, },
}); });

View File

@ -223,21 +223,21 @@ function undoReact(note): void {
}); });
} }
function onContextmenu(e): void { function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => { const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true; if (el.tagName === 'A') return true;
if (el.parentElement) { if (el.parentElement) {
return isLink(el.parentElement); return isLink(el.parentElement);
} }
}; };
if (isLink(e.target)) return; if (isLink(ev.target)) return;
if (window.getSelection().toString() !== '') return; if (window.getSelection().toString() !== '') return;
if (defaultStore.state.useReactionPickerForContextMenu) { if (defaultStore.state.useReactionPickerForContextMenu) {
e.preventDefault(); ev.preventDefault();
react(); react();
} else { } else {
os.contextMenu(getNoteMenu({ note: props.note, translating, translation, menuButton }), e).then(focus); os.contextMenu(getNoteMenu({ note: props.note, translating, translation, menuButton }), ev).then(focus);
} }
} }

View File

@ -211,21 +211,21 @@ function undoReact(note): void {
}); });
} }
function onContextmenu(e): void { function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => { const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true; if (el.tagName === 'A') return true;
if (el.parentElement) { if (el.parentElement) {
return isLink(el.parentElement); return isLink(el.parentElement);
} }
}; };
if (isLink(e.target)) return; if (isLink(ev.target)) return;
if (window.getSelection().toString() !== '') return; if (window.getSelection().toString() !== '') return;
if (defaultStore.state.useReactionPickerForContextMenu) { if (defaultStore.state.useReactionPickerForContextMenu) {
e.preventDefault(); ev.preventDefault();
react(); react();
} else { } else {
os.contextMenu(getNoteMenu({ note: props.note, translating, translation, menuButton }), e).then(focus); os.contextMenu(getNoteMenu({ note: props.note, translating, translation, menuButton }), ev).then(focus);
} }
} }

View File

@ -147,9 +147,9 @@ export default defineComponent({
} }
}, },
onContextmenu(e) { onContextmenu(ev: MouseEvent) {
if (this.contextmenu) { if (this.contextmenu) {
os.contextMenu(this.contextmenu, e); os.contextMenu(this.contextmenu, ev);
} }
}, },

View File

@ -72,7 +72,7 @@ export default defineComponent({
this.props = {}; this.props = {};
}, },
onContextmenu(e) { onContextmenu(ev: MouseEvent) {
os.contextMenu([{ os.contextMenu([{
type: 'label', type: 'label',
text: this.path, text: this.path,
@ -103,7 +103,7 @@ export default defineComponent({
action: () => { action: () => {
copyToClipboard(this.url); copyToClipboard(this.url);
} }
}], e); }], ev);
} }
} }
}); });

View File

@ -167,15 +167,15 @@ export default defineComponent({
if (window._scroll) window._scroll(); if (window._scroll) window._scroll();
}, },
onContextmenu(e) { onContextmenu(ev: MouseEvent) {
const isLink = (el: HTMLElement) => { const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true; if (el.tagName === 'A') return true;
if (el.parentElement) { if (el.parentElement) {
return isLink(el.parentElement); return isLink(el.parentElement);
} }
}; };
if (isLink(e.target)) return; if (isLink(ev.target)) return;
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return; if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(ev.target.tagName) || ev.target.attributes['contenteditable']) return;
if (window.getSelection().toString() !== '') return; if (window.getSelection().toString() !== '') return;
const path = this.$route.path; const path = this.$route.path;
os.contextMenu([{ os.contextMenu([{
@ -193,7 +193,7 @@ export default defineComponent({
action: () => { action: () => {
os.pageWindow(path); os.pageWindow(path);
} }
}], e); }], ev);
}, },
onAiClick(ev) { onAiClick(ev) {

View File

@ -207,8 +207,8 @@ export default defineComponent({
return items; return items;
}, },
onContextmenu(e) { onContextmenu(ev: MouseEvent) {
os.contextMenu(this.getMenu(), e); os.contextMenu(this.getMenu(), ev);
}, },
goTop() { goTop() {

View File

@ -64,15 +64,15 @@ export default defineComponent({
history.back(); history.back();
}, },
onContextmenu(e) { onContextmenu(ev: MouseEvent) {
const isLink = (el: HTMLElement) => { const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true; if (el.tagName === 'A') return true;
if (el.parentElement) { if (el.parentElement) {
return isLink(el.parentElement); return isLink(el.parentElement);
} }
}; };
if (isLink(e.target)) return; if (isLink(ev.target)) return;
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return; if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(ev.target.tagName) || ev.target.attributes['contenteditable']) return;
if (window.getSelection().toString() !== '') return; if (window.getSelection().toString() !== '') return;
const path = this.$route.path; const path = this.$route.path;
os.contextMenu([{ os.contextMenu([{
@ -84,7 +84,7 @@ export default defineComponent({
action: () => { action: () => {
os.pageWindow(path); os.pageWindow(path);
} }
}], e); }], ev);
}, },
} }
}); });