From a8fad1b61c554b9e42d310a522f3c2c4e8879892 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 18 Jan 2022 21:35:57 +0900 Subject: [PATCH] refactor --- packages/client/src/components/modal-page-window.vue | 4 ++-- packages/client/src/components/note-detailed.vue | 8 ++++---- packages/client/src/components/note.vue | 8 ++++---- packages/client/src/components/ui/window.vue | 4 ++-- packages/client/src/ui/classic.side.vue | 4 ++-- packages/client/src/ui/classic.vue | 8 ++++---- packages/client/src/ui/deck/column.vue | 4 ++-- packages/client/src/ui/deck/main-column.vue | 8 ++++---- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/client/src/components/modal-page-window.vue b/packages/client/src/components/modal-page-window.vue index 3de198082..2e17d5d03 100644 --- a/packages/client/src/components/modal-page-window.vue +++ b/packages/client/src/components/modal-page-window.vue @@ -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); } }, }); diff --git a/packages/client/src/components/note-detailed.vue b/packages/client/src/components/note-detailed.vue index b33257915..a3b30f726 100644 --- a/packages/client/src/components/note-detailed.vue +++ b/packages/client/src/components/note-detailed.vue @@ -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); } } diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue index b309afe05..fc89c2777 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -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); } } diff --git a/packages/client/src/components/ui/window.vue b/packages/client/src/components/ui/window.vue index bd33289cc..fa32ecfde 100644 --- a/packages/client/src/components/ui/window.vue +++ b/packages/client/src/components/ui/window.vue @@ -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); } }, diff --git a/packages/client/src/ui/classic.side.vue b/packages/client/src/ui/classic.side.vue index ede658626..f81683414 100644 --- a/packages/client/src/ui/classic.side.vue +++ b/packages/client/src/ui/classic.side.vue @@ -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); } } }); diff --git a/packages/client/src/ui/classic.vue b/packages/client/src/ui/classic.vue index 41da97315..1603ea639 100644 --- a/packages/client/src/ui/classic.vue +++ b/packages/client/src/ui/classic.vue @@ -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) { diff --git a/packages/client/src/ui/deck/column.vue b/packages/client/src/ui/deck/column.vue index 1982d92ad..f1ce3ca83 100644 --- a/packages/client/src/ui/deck/column.vue +++ b/packages/client/src/ui/deck/column.vue @@ -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() { diff --git a/packages/client/src/ui/deck/main-column.vue b/packages/client/src/ui/deck/main-column.vue index 744056881..b77d6f35c 100644 --- a/packages/client/src/ui/deck/main-column.vue +++ b/packages/client/src/ui/deck/main-column.vue @@ -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); }, } });