forked from Mirrors/elk
fix: update suggestion renderer only when the editor is focused (#1115)
Closes https://github.com/elk-zone/elk/issues/898
This commit is contained in:
parent
b0164deb27
commit
7e321e906a
1 changed files with 4 additions and 1 deletions
|
@ -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
|
// Use arrow function here because Nuxt will transform it incorrectly as Vue hook causing the build to fail
|
||||||
onBeforeUpdate: (props) => {
|
onBeforeUpdate: (props) => {
|
||||||
renderer.updateProps({ ...props, isPending: true })
|
props.editor.isFocused && renderer.updateProps({ ...props, isPending: true })
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdate(props) {
|
onUpdate(props) {
|
||||||
|
if (!props.editor.isFocused)
|
||||||
|
return
|
||||||
|
|
||||||
renderer.updateProps({ ...props, isPending: false })
|
renderer.updateProps({ ...props, isPending: false })
|
||||||
|
|
||||||
if (!props.clientRect)
|
if (!props.clientRect)
|
||||||
|
|
Loading…
Reference in a new issue