diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-12-29 13:42:15 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-12-29 13:42:15 +0900 |
| commit | 621fc5a715e372064bb178a24f07c8aa960f7f50 (patch) | |
| tree | 4efab3afa32c533fc36bdb72c622619614125f5a /packages/client/src/scripts | |
| parent | Merge branch 'develop' (diff) | |
| parent | 12.101.0 (diff) | |
| download | misskey-621fc5a715e372064bb178a24f07c8aa960f7f50.tar.gz misskey-621fc5a715e372064bb178a24f07c8aa960f7f50.tar.bz2 misskey-621fc5a715e372064bb178a24f07c8aa960f7f50.zip | |
Merge branch 'develop'
Diffstat (limited to 'packages/client/src/scripts')
| -rw-r--r-- | packages/client/src/scripts/loading.ts | 11 | ||||
| -rw-r--r-- | packages/client/src/scripts/use-tooltip.ts | 10 |
2 files changed, 9 insertions, 12 deletions
diff --git a/packages/client/src/scripts/loading.ts b/packages/client/src/scripts/loading.ts deleted file mode 100644 index 4b0a560e34..0000000000 --- a/packages/client/src/scripts/loading.ts +++ /dev/null @@ -1,11 +0,0 @@ -export default { - start: () => { - // TODO - }, - done: () => { - // TODO - }, - set: val => { - // TODO - } -}; diff --git a/packages/client/src/scripts/use-tooltip.ts b/packages/client/src/scripts/use-tooltip.ts index 0df4baca7b..bc8f27a038 100644 --- a/packages/client/src/scripts/use-tooltip.ts +++ b/packages/client/src/scripts/use-tooltip.ts @@ -1,4 +1,4 @@ -import { Ref, ref, watch } from 'vue'; +import { Ref, ref, watch, onUnmounted } from 'vue'; export function useTooltip( elRef: Ref<HTMLElement | { $el: HTMLElement } | null | undefined>, @@ -18,6 +18,9 @@ export function useTooltip( const open = () => { close(); if (!isHovering) return; + if (elRef.value == null) return; + const el = elRef.value instanceof Element ? elRef.value : elRef.value.$el; + if (!document.body.contains(el)) return; // openしようとしたときに既に元要素がDOMから消えている場合があるため const showing = ref(true); onShow(showing); @@ -69,9 +72,14 @@ export function useTooltip( el.addEventListener('mouseleave', onMouseleave, { passive: true }); el.addEventListener('touchstart', onTouchstart, { passive: true }); el.addEventListener('touchend', onTouchend, { passive: true }); + el.addEventListener('click', close, { passive: true }); } }, { immediate: true, flush: 'post', }); + + onUnmounted(() => { + close(); + }); } |