| | |
| | | ), |
| | | editor.registerCommand( |
| | | BLUR_COMMAND, |
| | | (event) => { |
| | | // Check if the clicked target element is var-search-input |
| | | const target = event?.relatedTarget as HTMLElement |
| | | if (!target?.classList?.contains('var-search-input')) { |
| | | ref.current = setTimeout(() => { |
| | | editor.dispatchCommand(KEY_ESCAPE_COMMAND, new KeyboardEvent('keydown', { key: 'Escape' })) |
| | | }, 200) |
| | | if (onBlur) |
| | | onBlur() |
| | | } |
| | | () => { |
| | | ref.current = setTimeout(() => { |
| | | editor.dispatchCommand(KEY_ESCAPE_COMMAND, new KeyboardEvent('keydown', { key: 'Escape' })) |
| | | }, 200) |
| | | |
| | | if (onBlur) |
| | | onBlur() |
| | | |
| | | return true |
| | | }, |
| | | COMMAND_PRIORITY_EDITOR, |