mirror of
https://github.com/paricafe/misskey.git
synced 2024-12-01 01:46:43 -06:00
refactor
This commit is contained in:
parent
9869f01e7c
commit
a8fad1b61c
8 changed files with 24 additions and 24 deletions
|
@ -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);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue