1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-28 06:48:42 +09:00
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();
},
onContextmenu(e) {
os.contextMenu(this.contextmenu, e);
onContextmenu(ev: MouseEvent) {
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) => {
if (el.tagName === 'A') return true;
if (el.parentElement) {
return isLink(el.parentElement);
}
};
if (isLink(e.target)) return;
if (isLink(ev.target)) return;
if (window.getSelection().toString() !== '') return;
if (defaultStore.state.useReactionPickerForContextMenu) {
e.preventDefault();
ev.preventDefault();
react();
} 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) => {
if (el.tagName === 'A') return true;
if (el.parentElement) {
return isLink(el.parentElement);
}
};
if (isLink(e.target)) return;
if (isLink(ev.target)) return;
if (window.getSelection().toString() !== '') return;
if (defaultStore.state.useReactionPickerForContextMenu) {
e.preventDefault();
ev.preventDefault();
react();
} 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) {
os.contextMenu(this.contextmenu, e);
os.contextMenu(this.contextmenu, ev);
}
},

View File

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

View File

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

View File

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

View File

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