]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/lexical/core/LexicalEditor.ts
Lexical: Added testing for some added shortcuts
[bookstack] / resources / js / wysiwyg / lexical / core / LexicalEditor.ts
index 092429156bec118195cdd841cba9c194aa10c5f3..364f6c6b7c3e70d23304b4316d10cf20dfe26768 100644 (file)
@@ -1188,6 +1188,14 @@ export class LexicalEditor {
     updateEditor(this, updateFn, options);
   }
 
+  /**
+   * Helper to run the update and commitUpdates methods in a single call.
+   */
+  updateAndCommit(updateFn: () => void, options?: EditorUpdateOptions): void {
+    this.update(updateFn, options);
+    this.commitUpdates();
+  }
+
   /**
    * Focuses the editor
    * @param callbackFn - A function to run after the editor is focused.