@ones-editor/editor 2.9.2-beta.2 → 2.9.3

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
@@ -38204,6 +38204,7 @@ ${codeText}
38204
38204
  }
38205
38205
  try {
38206
38206
  origHandleMessage(msg);
38207
+ this.emit("opReceived");
38207
38208
  } catch (err) {
38208
38209
  if ((err == null ? void 0 : err.type) === "writeConflict") {
38209
38210
  this.emitWriteConflictError(err, msg);
@@ -39308,9 +39309,9 @@ ${codeText}
39308
39309
  }
39309
39310
  setStatus(status) {
39310
39311
  var _a, _b, _c;
39311
- if (status === "clean") {
39312
+ if (status === "clean" || status === "busy") {
39312
39313
  if (this.dirtyTimeout) {
39313
- logger$2U.info("on clean");
39314
+ logger$2U.info(`on ${status}`);
39314
39315
  clearTimeout(this.dirtyTimeout);
39315
39316
  this.dirtyTimeout = null;
39316
39317
  }
@@ -39382,6 +39383,9 @@ ${codeText}
39382
39383
  __publicField(this, "handleWriteConflictError", (error2) => {
39383
39384
  this.handleReset(`write conflict: ${error2.message}, ${JSON.stringify(error2.orgMsg)}`);
39384
39385
  });
39386
+ __publicField(this, "handleOpReceived", () => {
39387
+ this.editStatus.setStatus("busy");
39388
+ });
39385
39389
  __publicField(this, "insertObject", async (rootObjectName, index2, obj) => {
39386
39390
  const ops = [rootObjectName, index2, { i: obj }];
39387
39391
  return this.submitOp(ops);
@@ -39475,7 +39479,10 @@ ${codeText}
39475
39479
  if (containers.length === 0) {
39476
39480
  return Promise.resolve();
39477
39481
  }
39478
- const ops = containers.map(({ containerId, blocks }) => [docObjectContainerId2EditorDocContainerId(containerId), { i: blocks }]);
39482
+ const ops = containers.map(({ containerId, blocks }) => [
39483
+ docObjectContainerId2EditorDocContainerId(containerId),
39484
+ { i: blocks }
39485
+ ]);
39479
39486
  return this.submitOp([ops]);
39480
39487
  });
39481
39488
  __publicField(this, "submitDeleteChildContainer", async (containerId) => {
@@ -39494,7 +39501,10 @@ ${codeText}
39494
39501
  if (delta.delete.length === 0 && Object.keys(delta.insert).length === 0) {
39495
39502
  return Promise.resolve();
39496
39503
  }
39497
- const ops = [docObjectContainerId2EditorDocContainerId(containerId), index2];
39504
+ const ops = [
39505
+ docObjectContainerId2EditorDocContainerId(containerId),
39506
+ index2
39507
+ ];
39498
39508
  const deletedKeysSet = new Set(delta.delete);
39499
39509
  Object.entries(delta.insert).forEach(([key, value]) => {
39500
39510
  if (deletedKeysSet.has(key)) {
@@ -39545,6 +39555,7 @@ ${codeText}
39545
39555
  this.disableLogout = disableLogout;
39546
39556
  this.registerCallback(this.remoteCaretHandler);
39547
39557
  this.editStatus = new EditStatus(options);
39558
+ this.client.connection.addListener("opReceived", this.handleOpReceived);
39548
39559
  }
39549
39560
  beginBatchUpdate() {
39550
39561
  this.doc.preventCompose = false;
@@ -39729,7 +39740,9 @@ ${codeText}
39729
39740
  this.endBatchUpdate();
39730
39741
  }
39731
39742
  getComments() {
39732
- const comments = Object.values(this.data().comments).map((comment) => shareDBDocCommentToComment(comment));
39743
+ const comments = Object.values(this.data().comments).map(
39744
+ (comment) => shareDBDocCommentToComment(comment)
39745
+ );
39733
39746
  return comments;
39734
39747
  }
39735
39748
  getComment(commentId) {
@@ -39784,47 +39797,59 @@ ${codeText}
39784
39797
  }
39785
39798
  onDeleteBlock(containerId, blockIndex, local) {
39786
39799
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39787
- this.callbacks.forEach((cb) => {
39788
- var _a;
39789
- return (_a = cb.onDeleteBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, local);
39790
- });
39800
+ this.callbacks.forEach(
39801
+ (cb) => {
39802
+ var _a;
39803
+ return (_a = cb.onDeleteBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, local);
39804
+ }
39805
+ );
39791
39806
  }
39792
39807
  onInsertBlock(containerId, blockIndex, data2, local) {
39793
39808
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39794
- this.callbacks.forEach((cb) => {
39795
- var _a;
39796
- return (_a = cb.onInsertBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, data2, local);
39797
- });
39809
+ this.callbacks.forEach(
39810
+ (cb) => {
39811
+ var _a;
39812
+ return (_a = cb.onInsertBlock) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, data2, local);
39813
+ }
39814
+ );
39798
39815
  }
39799
39816
  onUpdateBlockData(containerId, blockIndex, delta, local) {
39800
39817
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39801
- this.callbacks.forEach((cb) => {
39802
- var _a;
39803
- return (_a = cb.onUpdateBlockData) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, delta, local);
39804
- });
39818
+ this.callbacks.forEach(
39819
+ (cb) => {
39820
+ var _a;
39821
+ return (_a = cb.onUpdateBlockData) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, delta, local);
39822
+ }
39823
+ );
39805
39824
  }
39806
39825
  onUpdateBlockText(containerId, blockIndex, actions2, local) {
39807
39826
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39808
- this.callbacks.forEach((cb) => {
39809
- var _a;
39810
- return (_a = cb.onUpdateBlockText) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, actions2, local);
39811
- });
39827
+ this.callbacks.forEach(
39828
+ (cb) => {
39829
+ var _a;
39830
+ return (_a = cb.onUpdateBlockText) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blockIndex, actions2, local);
39831
+ }
39832
+ );
39812
39833
  }
39813
39834
  onDeleteContainer(containerId, local) {
39814
39835
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39815
39836
  assert(logger$2T, containerId !== "root", "should not delete root container in doc");
39816
- this.callbacks.forEach((cb) => {
39817
- var _a;
39818
- return (_a = cb.onDeleteChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), local);
39819
- });
39837
+ this.callbacks.forEach(
39838
+ (cb) => {
39839
+ var _a;
39840
+ return (_a = cb.onDeleteChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), local);
39841
+ }
39842
+ );
39820
39843
  }
39821
39844
  onCreateContainer(containerId, blocks, local) {
39822
39845
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39823
39846
  assert(logger$2T, containerId !== "root", "should not create root container in doc");
39824
- this.callbacks.forEach((cb) => {
39825
- var _a;
39826
- return (_a = cb.onInsertChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blocks, local);
39827
- });
39847
+ this.callbacks.forEach(
39848
+ (cb) => {
39849
+ var _a;
39850
+ return (_a = cb.onInsertChildContainer) == null ? void 0 : _a.call(cb, editorDpcContainerId2DocObjectContainerId(containerId), blocks, local);
39851
+ }
39852
+ );
39828
39853
  }
39829
39854
  onDeleteComment(commentId, local) {
39830
39855
  assert(logger$2T, this.callbacks.length > 0, "no callbacks");
@@ -94697,7 +94722,7 @@ ${JSON.stringify(error2, null, 2)}`);
94697
94722
  }
94698
94723
  }
94699
94724
  });
94700
- editor.version = "2.9.2-beta.2";
94725
+ editor.version = "2.9.3";
94701
94726
  return editor;
94702
94727
  }
94703
94728
  function isDoc(doc2) {
@@ -94811,7 +94836,7 @@ ${JSON.stringify(error2, null, 2)}`);
94811
94836
  }
94812
94837
  });
94813
94838
  OnesEditorToolbar.register(editor);
94814
- editor.version = "2.9.2-beta.2";
94839
+ editor.version = "2.9.3";
94815
94840
  return editor;
94816
94841
  }
94817
94842
  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.9.2-beta.2",
3
+ "version": "2.9.3",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {