@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.cjs
CHANGED
|
@@ -3783,6 +3783,18 @@ const ActiveEditorPlugin = ({
|
|
|
3783
3783
|
setActiveEditor,
|
|
3784
3784
|
setActivePageId
|
|
3785
3785
|
]);
|
|
3786
|
+
React.useEffect(() => {
|
|
3787
|
+
const caretPosition = { pageId, region };
|
|
3788
|
+
const handleFocusIn = () => {
|
|
3789
|
+
setActivePageId(pageId);
|
|
3790
|
+
setActiveEditor(editor, caretPosition);
|
|
3791
|
+
onFocus == null ? void 0 : onFocus(editor);
|
|
3792
|
+
};
|
|
3793
|
+
return editor.registerRootListener((rootElement, prevRootElement) => {
|
|
3794
|
+
prevRootElement == null ? void 0 : prevRootElement.removeEventListener("focusin", handleFocusIn);
|
|
3795
|
+
rootElement == null ? void 0 : rootElement.addEventListener("focusin", handleFocusIn);
|
|
3796
|
+
});
|
|
3797
|
+
}, [editor, onFocus, pageId, region, setActiveEditor, setActivePageId]);
|
|
3786
3798
|
React.useEffect(() => {
|
|
3787
3799
|
return editor.registerCommand(
|
|
3788
3800
|
lexical.FOCUS_COMMAND,
|