diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2024-07-04 13:14:49 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2024-07-04 13:14:49 +0900 |
| commit | 6dd2e9fc0b1eeea6b5f04ccac93ccfab658f976d (patch) | |
| tree | 53a677d4fdaa802774a133272ed2f5f1180dd4fa /packages/frontend/src/directives | |
| parent | fix(storybook): build skipping even after updating impl story files (#14124) (diff) | |
| download | sharkey-6dd2e9fc0b1eeea6b5f04ccac93ccfab658f976d.tar.gz sharkey-6dd2e9fc0b1eeea6b5f04ccac93ccfab658f976d.tar.bz2 sharkey-6dd2e9fc0b1eeea6b5f04ccac93ccfab658f976d.zip | |
refactor(frontend): refactor popup api and make sure call dispose callback
Close #14122
Diffstat (limited to 'packages/frontend/src/directives')
| -rw-r--r-- | packages/frontend/src/directives/ripple.ts | 4 | ||||
| -rw-r--r-- | packages/frontend/src/directives/tooltip.ts | 6 | ||||
| -rw-r--r-- | packages/frontend/src/directives/user-preview.ts | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/packages/frontend/src/directives/ripple.ts b/packages/frontend/src/directives/ripple.ts index 2d724f771e..a043ff212d 100644 --- a/packages/frontend/src/directives/ripple.ts +++ b/packages/frontend/src/directives/ripple.ts @@ -17,7 +17,9 @@ export default { const x = rect.left + (el.offsetWidth / 2); const y = rect.top + (el.offsetHeight / 2); - popup(MkRippleEffect, { x, y }, {}, 'end'); + const { dispose } = popup(MkRippleEffect, { x, y }, { + end: () => dispose(), + }); }); }, }; diff --git a/packages/frontend/src/directives/tooltip.ts b/packages/frontend/src/directives/tooltip.ts index b1c1b19907..251ce5675f 100644 --- a/packages/frontend/src/directives/tooltip.ts +++ b/packages/frontend/src/directives/tooltip.ts @@ -51,13 +51,15 @@ export default { if (self.text == null) return; const showing = ref(true); - popup(defineAsyncComponent(() => import('@/components/MkTooltip.vue')), { + const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkTooltip.vue')), { showing, text: self.text, asMfm: binding.modifiers.mfm, direction: binding.modifiers.left ? 'left' : binding.modifiers.right ? 'right' : binding.modifiers.top ? 'top' : binding.modifiers.bottom ? 'bottom' : 'top', targetElement: el, - }, {}, 'closed'); + }, { + closed: () => dispose(), + }); self._close = () => { showing.value = false; diff --git a/packages/frontend/src/directives/user-preview.ts b/packages/frontend/src/directives/user-preview.ts index 7a008a4486..278d842d09 100644 --- a/packages/frontend/src/directives/user-preview.ts +++ b/packages/frontend/src/directives/user-preview.ts @@ -35,7 +35,7 @@ export class UserPreview { const showing = ref(true); - popup(defineAsyncComponent(() => import('@/components/MkUserPopup.vue')), { + const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkUserPopup.vue')), { showing, q: this.user, source: this.el, @@ -47,7 +47,8 @@ export class UserPreview { window.clearTimeout(this.showTimer); this.hideTimer = window.setTimeout(this.close, 500); }, - }, 'closed'); + closed: () => dispose(), + }); this.promise = { cancel: () => { |