@yurikilian/lex4 1.5.7 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lex4-editor.js
CHANGED
|
@@ -3781,6 +3781,18 @@ const ActiveEditorPlugin = ({
|
|
|
3781
3781
|
setActiveEditor,
|
|
3782
3782
|
setActivePageId
|
|
3783
3783
|
]);
|
|
3784
|
+
useEffect(() => {
|
|
3785
|
+
const caretPosition = { pageId, region };
|
|
3786
|
+
const handleFocusIn = () => {
|
|
3787
|
+
setActivePageId(pageId);
|
|
3788
|
+
setActiveEditor(editor, caretPosition);
|
|
3789
|
+
onFocus == null ? void 0 : onFocus(editor);
|
|
3790
|
+
};
|
|
3791
|
+
return editor.registerRootListener((rootElement, prevRootElement) => {
|
|
3792
|
+
prevRootElement == null ? void 0 : prevRootElement.removeEventListener("focusin", handleFocusIn);
|
|
3793
|
+
rootElement == null ? void 0 : rootElement.addEventListener("focusin", handleFocusIn);
|
|
3794
|
+
});
|
|
3795
|
+
}, [editor, onFocus, pageId, region, setActiveEditor, setActivePageId]);
|
|
3784
3796
|
useEffect(() => {
|
|
3785
3797
|
return editor.registerCommand(
|
|
3786
3798
|
FOCUS_COMMAND,
|