@ones-editor/editor 2.8.37 → 2.8.38

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.js CHANGED
@@ -37991,6 +37991,7 @@ ${codeText}
37991
37991
  }
37992
37992
  try {
37993
37993
  origHandleMessage(msg);
37994
+ this.emit("opReceived");
37994
37995
  } catch (err) {
37995
37996
  if ((err == null ? void 0 : err.type) === "writeConflict") {
37996
37997
  this.emitWriteConflictError(err, msg);
@@ -39077,9 +39078,9 @@ ${codeText}
39077
39078
  }
39078
39079
  setStatus(status) {
39079
39080
  var _a, _b, _c;
39080
- if (status === "clean") {
39081
+ if (status === "clean" || status === "busy") {
39081
39082
  if (this.dirtyTimeout) {
39082
- logger$2U.info("on clean");
39083
+ logger$2U.info(`on ${status}`);
39083
39084
  clearTimeout(this.dirtyTimeout);
39084
39085
  this.dirtyTimeout = null;
39085
39086
  }
@@ -39151,6 +39152,9 @@ ${codeText}
39151
39152
  __publicField(this, "handleWriteConflictError", (error2) => {
39152
39153
  this.handleReset(`write conflict: ${error2.message}, ${JSON.stringify(error2.orgMsg)}`);
39153
39154
  });
39155
+ __publicField(this, "handleOpReceived", () => {
39156
+ this.editStatus.setStatus("busy");
39157
+ });
39154
39158
  __publicField(this, "insertObject", async (rootObjectName, index2, obj) => {
39155
39159
  const ops = [rootObjectName, index2, { i: obj }];
39156
39160
  return this.submitOp(ops);
@@ -39244,7 +39248,10 @@ ${codeText}
39244
39248
  if (containers.length === 0) {
39245
39249
  return Promise.resolve();
39246
39250
  }
39247
- const ops = containers.map(({ containerId, blocks }) => [docObjectContainerId2EditorDocContainerId(containerId), { i: blocks }]);
39251
+ const ops = containers.map(({ containerId, blocks }) => [
39252
+ docObjectContainerId2EditorDocContainerId(containerId),
39253
+ { i: blocks }
39254
+ ]);
39248
39255
  return this.submitOp([ops]);
39249
39256
  });
39250
39257
  __publicField(this, "submitDeleteChildContainer", async (containerId) => {
@@ -39263,7 +39270,10 @@ ${codeText}
39263
39270
  if (delta.delete.length === 0 && Object.keys(delta.insert).length === 0) {
39264
39271
  return Promise.resolve();
39265
39272
  }
39266
- const ops = [docObjectContainerId2EditorDocContainerId(containerId), index2];
39273
+ const ops = [
39274
+ docObjectContainerId2EditorDocContainerId(containerId),
39275
+ index2
39276
+ ];
39267
39277
  const deletedKeysSet = new Set(delta.delete);
39268
39278
  Object.entries(delta.insert).forEach(([key, value]) => {
39269
39279
  if (deletedKeysSet.has(key)) {
@@ -39314,6 +39324,7 @@ ${codeText}
39314
39324
  this.disableLogout = disableLogout;
39315
39325
  this.registerCallback(this.remoteCaretHandler);
39316
39326
  this.editStatus = new EditStatus(options);
39327
+ this.client.connection.addListener("opReceived", this.handleOpReceived);
39317
39328
  }
39318
39329
  beginBatchUpdate() {
39319
39330
  this.doc.preventCompose = false;
@@ -39498,7 +39509,9 @@ ${codeText}
39498
39509
  this.endBatchUpdate();
39499
39510
  }
39500
39511
  getComments() {
39501
- const comments = Object.values(this.data().comments).map((comment) => shareDBDocCommentToComment(comment));
39512
+ const comments = Object.values(this.data().comments).map(
39513
+ (comment) => shareDBDocCommentToComment(comment)
39514
+ );
39502
39515
  return comments;
39503
39516
  }
39504
39517
  getComment(commentId) {
@@ -39538,47 +39551,59 @@ ${codeText}
39538
39551
  }
39539
39552
  onDeleteBlock(containerId, blockIndex, local) {
39540
39553
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39541
- this.callbacks.forEach((cb) => {
39542
- var _a;
39543
- return (_a = cb.onDeleteBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, local);
39544
- });
39554
+ this.callbacks.forEach(
39555
+ (cb) => {
39556
+ var _a;
39557
+ return (_a = cb.onDeleteBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, local);
39558
+ }
39559
+ );
39545
39560
  }
39546
39561
  onInsertBlock(containerId, blockIndex, data2, local) {
39547
39562
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39548
- this.callbacks.forEach((cb) => {
39549
- var _a;
39550
- return (_a = cb.onInsertBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, data2, local);
39551
- });
39563
+ this.callbacks.forEach(
39564
+ (cb) => {
39565
+ var _a;
39566
+ return (_a = cb.onInsertBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, data2, local);
39567
+ }
39568
+ );
39552
39569
  }
39553
39570
  onUpdateBlockData(containerId, blockIndex, delta, local) {
39554
39571
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39555
- this.callbacks.forEach((cb) => {
39556
- var _a;
39557
- return (_a = cb.onUpdateBlockData) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, delta, local);
39558
- });
39572
+ this.callbacks.forEach(
39573
+ (cb) => {
39574
+ var _a;
39575
+ return (_a = cb.onUpdateBlockData) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, delta, local);
39576
+ }
39577
+ );
39559
39578
  }
39560
39579
  onUpdateBlockText(containerId, blockIndex, actions2, local) {
39561
39580
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39562
- this.callbacks.forEach((cb) => {
39563
- var _a;
39564
- return (_a = cb.onUpdateBlockText) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, actions2, local);
39565
- });
39581
+ this.callbacks.forEach(
39582
+ (cb) => {
39583
+ var _a;
39584
+ return (_a = cb.onUpdateBlockText) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, actions2, local);
39585
+ }
39586
+ );
39566
39587
  }
39567
39588
  onDeleteContainer(containerId, local) {
39568
39589
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39569
39590
  assert(logger$2T, containerId !== "root", "should not delete root container in doc");
39570
- this.callbacks.forEach((cb) => {
39571
- var _a;
39572
- return (_a = cb.onDeleteChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), local);
39573
- });
39591
+ this.callbacks.forEach(
39592
+ (cb) => {
39593
+ var _a;
39594
+ return (_a = cb.onDeleteChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), local);
39595
+ }
39596
+ );
39574
39597
  }
39575
39598
  onCreateContainer(containerId, blocks, local) {
39576
39599
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39577
39600
  assert(logger$2T, containerId !== "root", "should not create root container in doc");
39578
- this.callbacks.forEach((cb) => {
39579
- var _a;
39580
- return (_a = cb.onInsertChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blocks, local);
39581
- });
39601
+ this.callbacks.forEach(
39602
+ (cb) => {
39603
+ var _a;
39604
+ return (_a = cb.onInsertChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blocks, local);
39605
+ }
39606
+ );
39582
39607
  }
39583
39608
  onDeleteComment(commentId, local) {
39584
39609
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
@@ -93857,7 +93882,7 @@ ${JSON.stringify(error2, null, 2)}`);
93857
93882
  }
93858
93883
  }
93859
93884
  });
93860
- editor.version = "2.8.37";
93885
+ editor.version = "2.8.38";
93861
93886
  return editor;
93862
93887
  }
93863
93888
  function isDoc(doc2) {
@@ -93970,7 +93995,7 @@ ${JSON.stringify(error2, null, 2)}`);
93970
93995
  }
93971
93996
  });
93972
93997
  OnesEditorToolbar.register(editor);
93973
- editor.version = "2.8.37";
93998
+ editor.version = "2.8.38";
93974
93999
  return editor;
93975
94000
  }
93976
94001
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.8.37",
3
+ "version": "2.8.38",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {