From ed5c918d707a2f37b58128d11e98a15dcd3abb98 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 16 Jan 2022 08:24:53 +0900 Subject: [PATCH] wip: refactor(client): migrate components to composition api --- packages/client/src/components/global/a.vue | 7 +- .../client/src/components/media-banner.vue | 46 +++--- .../client/src/components/url-preview.vue | 156 +++++++----------- 3 files changed, 86 insertions(+), 123 deletions(-) diff --git a/packages/client/src/components/global/a.vue b/packages/client/src/components/global/a.vue index d3bc2235b8..cf7385ca22 100644 --- a/packages/client/src/components/global/a.vue +++ b/packages/client/src/components/global/a.vue @@ -36,7 +36,8 @@ const active = $computed(() => { }); function onContextmenu(ev) { - if (window.getSelection().toString() !== '') return; + const selection = window.getSelection(); + if (selection && selection.toString() !== '') return; os.contextMenu([{ type: 'label', text: props.to, @@ -73,7 +74,7 @@ function onContextmenu(ev) { }], ev); } -function window() { +function openWindow() { os.pageWindow(props.to); } @@ -93,7 +94,7 @@ function nav() { if (props.behavior) { if (props.behavior === 'window') { - return window(); + return openWindow(); } else if (props.behavior === 'modalWindow') { return modalWindow(); } diff --git a/packages/client/src/components/media-banner.vue b/packages/client/src/components/media-banner.vue index 9dbfe3d0c6..5093f11e97 100644 --- a/packages/client/src/components/media-banner.vue +++ b/packages/client/src/components/media-banner.vue @@ -6,7 +6,7 @@ {{ $ts.clickToShow }}
-