lexical 0.29.0 → 0.29.1-nightly.20250327.0

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/Lexical.dev.js CHANGED
@@ -8057,13 +8057,6 @@ function triggerListeners(type, editor, isCurrentlyEnqueuingUpdates, ...payload)
8057
8057
  }
8058
8058
  }
8059
8059
  function triggerCommandListeners(editor, type, payload) {
8060
- if (editor._updating === false || activeEditor !== editor) {
8061
- let returnVal = false;
8062
- editor.update(() => {
8063
- returnVal = triggerCommandListeners(editor, type, payload);
8064
- });
8065
- return returnVal;
8066
- }
8067
8060
  const editors = getEditorsToPropagate(editor);
8068
8061
  for (let i = 4; i >= 0; i--) {
8069
8062
  for (let e = 0; e < editors.length; e++) {
@@ -8075,10 +8068,17 @@ function triggerCommandListeners(editor, type, payload) {
8075
8068
  if (listenersSet !== undefined) {
8076
8069
  const listeners = Array.from(listenersSet);
8077
8070
  const listenersLength = listeners.length;
8078
- for (let j = 0; j < listenersLength; j++) {
8079
- if (listeners[j](payload, editor) === true) {
8080
- return true;
8071
+ let returnVal = false;
8072
+ updateEditorSync(currentEditor, () => {
8073
+ for (let j = 0; j < listenersLength; j++) {
8074
+ if (listeners[j](payload, editor)) {
8075
+ returnVal = true;
8076
+ return;
8077
+ }
8081
8078
  }
8079
+ });
8080
+ if (returnVal) {
8081
+ return returnVal;
8082
8082
  }
8083
8083
  }
8084
8084
  }
@@ -8265,12 +8265,10 @@ function $beginUpdate(editor, updateFn, options) {
8265
8265
  * within an update
8266
8266
  */
8267
8267
  function updateEditorSync(editor, updateFn, options) {
8268
- if (!editor._updating) {
8269
- $beginUpdate(editor, updateFn, options);
8270
- } else if (activeEditor === editor) {
8268
+ if (activeEditor === editor && options === undefined) {
8271
8269
  updateFn();
8272
8270
  } else {
8273
- editor._updates.push([updateFn, options]);
8271
+ $beginUpdate(editor, updateFn, options);
8274
8272
  }
8275
8273
  }
8276
8274
  function updateEditor(editor, updateFn, options) {
@@ -10291,7 +10289,7 @@ class LexicalEditor {
10291
10289
  };
10292
10290
  }
10293
10291
  }
10294
- LexicalEditor.version = "0.29.0+dev.cjs";
10292
+ LexicalEditor.version = "0.29.1-nightly.20250327.0+dev.cjs";
10295
10293
 
10296
10294
  let keyCounter = 1;
10297
10295
  function resetRandomKey() {
package/Lexical.dev.mjs CHANGED
@@ -8055,13 +8055,6 @@ function triggerListeners(type, editor, isCurrentlyEnqueuingUpdates, ...payload)
8055
8055
  }
8056
8056
  }
8057
8057
  function triggerCommandListeners(editor, type, payload) {
8058
- if (editor._updating === false || activeEditor !== editor) {
8059
- let returnVal = false;
8060
- editor.update(() => {
8061
- returnVal = triggerCommandListeners(editor, type, payload);
8062
- });
8063
- return returnVal;
8064
- }
8065
8058
  const editors = getEditorsToPropagate(editor);
8066
8059
  for (let i = 4; i >= 0; i--) {
8067
8060
  for (let e = 0; e < editors.length; e++) {
@@ -8073,10 +8066,17 @@ function triggerCommandListeners(editor, type, payload) {
8073
8066
  if (listenersSet !== undefined) {
8074
8067
  const listeners = Array.from(listenersSet);
8075
8068
  const listenersLength = listeners.length;
8076
- for (let j = 0; j < listenersLength; j++) {
8077
- if (listeners[j](payload, editor) === true) {
8078
- return true;
8069
+ let returnVal = false;
8070
+ updateEditorSync(currentEditor, () => {
8071
+ for (let j = 0; j < listenersLength; j++) {
8072
+ if (listeners[j](payload, editor)) {
8073
+ returnVal = true;
8074
+ return;
8075
+ }
8079
8076
  }
8077
+ });
8078
+ if (returnVal) {
8079
+ return returnVal;
8080
8080
  }
8081
8081
  }
8082
8082
  }
@@ -8263,12 +8263,10 @@ function $beginUpdate(editor, updateFn, options) {
8263
8263
  * within an update
8264
8264
  */
8265
8265
  function updateEditorSync(editor, updateFn, options) {
8266
- if (!editor._updating) {
8267
- $beginUpdate(editor, updateFn, options);
8268
- } else if (activeEditor === editor) {
8266
+ if (activeEditor === editor && options === undefined) {
8269
8267
  updateFn();
8270
8268
  } else {
8271
- editor._updates.push([updateFn, options]);
8269
+ $beginUpdate(editor, updateFn, options);
8272
8270
  }
8273
8271
  }
8274
8272
  function updateEditor(editor, updateFn, options) {
@@ -10289,7 +10287,7 @@ class LexicalEditor {
10289
10287
  };
10290
10288
  }
10291
10289
  }
10292
- LexicalEditor.version = "0.29.0+dev.esm";
10290
+ LexicalEditor.version = "0.29.1-nightly.20250327.0+dev.esm";
10293
10291
 
10294
10292
  let keyCounter = 1;
10295
10293
  function resetRandomKey() {