From 7e321e906af8ce14a5c6596d75b30f4431d2cf05 Mon Sep 17 00:00:00 2001 From: webfansplz <308241863@qq.com> Date: Sat, 14 Jan 2023 18:38:31 +0800 Subject: [PATCH] fix: update suggestion renderer only when the editor is focused (#1115) Closes https://github.com/elk-zone/elk/issues/898 --- composables/tiptap/suggestion.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composables/tiptap/suggestion.ts b/composables/tiptap/suggestion.ts index 209428f6..4a27328e 100644 --- a/composables/tiptap/suggestion.ts +++ b/composables/tiptap/suggestion.ts @@ -67,10 +67,13 @@ function createSuggestionRenderer(component: Component): SuggestionOptions['rend // Use arrow function here because Nuxt will transform it incorrectly as Vue hook causing the build to fail onBeforeUpdate: (props) => { - renderer.updateProps({ ...props, isPending: true }) + props.editor.isFocused && renderer.updateProps({ ...props, isPending: true }) }, onUpdate(props) { + if (!props.editor.isFocused) + return + renderer.updateProps({ ...props, isPending: false }) if (!props.clientRect)