@mdxeditor/editor 3.44.1 → 3.44.2

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/index.d.ts CHANGED
@@ -1137,6 +1137,7 @@ export declare const editorInFocus$: NodeRef<EditorInFocus | null>;
1137
1137
  export declare interface EditorInFocus {
1138
1138
  editorType: string;
1139
1139
  rootNode: LexicalNode | null;
1140
+ editorRef: unknown;
1140
1141
  }
1141
1142
 
1142
1143
  /**
@@ -133,7 +133,7 @@ const NestedLexicalEditor = function(props) {
133
133
  editor.registerCommand(
134
134
  FOCUS_COMMAND,
135
135
  () => {
136
- setEditorInFocus({ editorType: "lexical", rootNode: lexicalNode });
136
+ setEditorInFocus({ editorType: "lexical", rootNode: lexicalNode, editorRef: editor });
137
137
  return false;
138
138
  },
139
139
  COMMAND_PRIORITY_LOW
@@ -163,7 +163,7 @@ const NestedLexicalEditor = function(props) {
163
163
  editor.registerCommand(
164
164
  SELECTION_CHANGE_COMMAND,
165
165
  () => {
166
- setEditorInFocus({ editorType: "lexical", rootNode: lexicalNode });
166
+ setEditorInFocus({ editorType: "lexical", rootNode: lexicalNode, editorRef: editor });
167
167
  return false;
168
168
  },
169
169
  COMMAND_PRIORITY_HIGH
@@ -196,7 +196,9 @@ const activeEditorSubscriptions$ = Cell([], (r) => {
196
196
  const rootEditorSubscriptions$ = Cell([], (r) => {
197
197
  r.pipe(r.combine(rootEditorSubscriptions$, rootEditor$), rebind());
198
198
  });
199
- const editorInFocus$ = Cell(null);
199
+ const editorInFocus$ = Cell(null, noop, (prev, next) => {
200
+ return Boolean(prev && next && prev.editorRef === next.editorRef);
201
+ });
200
202
  const onBlur$ = Signal();
201
203
  const iconComponentFor$ = Cell((name) => {
202
204
  throw new Error(`No icon component for ${name}`);
@@ -241,7 +243,8 @@ const createRootEditorSubscription$ = Appender(rootEditorSubscriptions$, (r, sig
241
243
  theActiveEditor.getEditorState().read(() => {
242
244
  r.pub(editorInFocus$, {
243
245
  rootNode: $getRoot(),
244
- editorType: "lexical"
246
+ editorType: "lexical",
247
+ editorRef: theActiveEditor
245
248
  });
246
249
  });
247
250
  }
@@ -13,7 +13,8 @@ function useCodeMirrorRef(nodeKey, editorType, language, focusEmitter) {
13
13
  const onFocusHandler = React__default.useCallback(() => {
14
14
  setEditorInFocus({
15
15
  editorType,
16
- rootNode: lexicalNode
16
+ rootNode: lexicalNode,
17
+ editorRef: codeMirrorRef.current
17
18
  });
18
19
  }, [editorType, lexicalNode, setEditorInFocus]);
19
20
  const onKeyDownHandler = React__default.useCallback(
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.44.1",
14
+ "version": "3.44.2",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",
@@ -53,7 +53,7 @@
53
53
  "@lexical/rich-text": "^0.35.0",
54
54
  "@lexical/selection": "^0.35.0",
55
55
  "@lexical/utils": "^0.35.0",
56
- "@mdxeditor/gurx": "^1.1.4",
56
+ "@mdxeditor/gurx": "^1.2.4",
57
57
  "@radix-ui/colors": "^3.0.0",
58
58
  "@radix-ui/react-dialog": "^1.1.11",
59
59
  "@radix-ui/react-icons": "^1.3.2",