@ones-editor/editor 2.8.38 → 2.8.39

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
@@ -26314,6 +26314,9 @@ var __publicField = (obj, key, value) => {
26314
26314
  }
26315
26315
  }
26316
26316
  function editorScrollIntoView(editor) {
26317
+ if (!editor.scrollable()) {
26318
+ return;
26319
+ }
26317
26320
  if (!isElementVisible(editor.rootContainer)) {
26318
26321
  logger$3R.warn("editorScrollIntoView: editor is not visible");
26319
26322
  return;
@@ -31657,6 +31660,7 @@ ${codeText}
31657
31660
  __publicField(this, "inputHandlers", new EditorInputHandlers(this));
31658
31661
  __publicField(this, "settingsProvider");
31659
31662
  __publicField(this, "_readonly", false);
31663
+ __publicField(this, "_scrollable", true);
31660
31664
  __publicField(this, "getColor", (index2) => {
31661
31665
  const colors = this.options.colors;
31662
31666
  if (colors.length === 0) {
@@ -31884,6 +31888,12 @@ ${codeText}
31884
31888
  return false;
31885
31889
  return elem.closest("div.editor-root") === this.rootElement;
31886
31890
  }
31891
+ scrollable() {
31892
+ return this._scrollable;
31893
+ }
31894
+ setScrollable(scrollable2) {
31895
+ this._scrollable = scrollable2;
31896
+ }
31887
31897
  insertBlock(containerId, blockIndex, blockData, newRange, options) {
31888
31898
  const defaultPos = { blockId: blockData.id, offset: 0 };
31889
31899
  const defaultRange = { anchor: defaultPos, focus: defaultPos };
@@ -70003,6 +70013,9 @@ ${codeText}
70003
70013
  }
70004
70014
  });
70005
70015
  __publicField(this, "handleSelectionChanged", () => {
70016
+ if (!this.editor.scrollable()) {
70017
+ return;
70018
+ }
70006
70019
  setTimeout(() => {
70007
70020
  var _a;
70008
70021
  const commentIds = getCommentsFromSelection(this.editor);
@@ -70312,7 +70325,14 @@ ${codeText}
70312
70325
  }
70313
70326
  onCreateComment(commentId, local) {
70314
70327
  const comment = this.commentsProvider.getComment(commentId);
70315
- this.list.handleCreateComment(comment, local);
70328
+ try {
70329
+ this.editor.setScrollable(false);
70330
+ this.list.handleCreateComment(comment, local);
70331
+ } finally {
70332
+ setTimeout(() => {
70333
+ this.editor.setScrollable(true);
70334
+ }, 1e3);
70335
+ }
70316
70336
  this.updateCommentCount();
70317
70337
  }
70318
70338
  onDeleteComment(commentId, local) {
@@ -70879,7 +70899,14 @@ ${codeText}
70879
70899
  const range = createBlockSimpleRange(editor, block, selectedBlock.start.offset, selectedBlock.end.offset);
70880
70900
  const command = `comment-${comment.id.toLocaleLowerCase()}`;
70881
70901
  const value = comment.id;
70882
- editorAddTextAttribute(editor, block, range, command, value);
70902
+ try {
70903
+ editor.setScrollable(false);
70904
+ editorAddTextAttribute(editor, block, range, command, value);
70905
+ } finally {
70906
+ setTimeout(() => {
70907
+ editor.setScrollable(true);
70908
+ }, 1e3);
70909
+ }
70883
70910
  }
70884
70911
  function addCommentToTextBlocks(editor, range, provider) {
70885
70912
  const selectedBlocks = getAllSelectedBlocks(editor, { range });
@@ -93270,9 +93297,19 @@ ${JSON.stringify(error2, null, 2)}`);
93270
93297
  __publicField(this, "id", "comment");
93271
93298
  __publicField(this, "name", i18n$1.t("comment.command"));
93272
93299
  __publicField(this, "icon", CommentIcon$1);
93300
+ __publicField(this, "adding", false);
93273
93301
  }
93274
93302
  onClick(editor, item) {
93275
- editorAddComment(editor);
93303
+ if (this.adding) {
93304
+ return;
93305
+ }
93306
+ this.adding = true;
93307
+ setTimeout(() => {
93308
+ editorAddComment(editor);
93309
+ setTimeout(() => {
93310
+ this.adding = false;
93311
+ }, 300);
93312
+ }, 300);
93276
93313
  }
93277
93314
  }
93278
93315
  class ColorItem extends TextColorItem {
@@ -93882,7 +93919,7 @@ ${JSON.stringify(error2, null, 2)}`);
93882
93919
  }
93883
93920
  }
93884
93921
  });
93885
- editor.version = "2.8.38";
93922
+ editor.version = "2.8.39";
93886
93923
  return editor;
93887
93924
  }
93888
93925
  function isDoc(doc2) {
@@ -93995,7 +94032,7 @@ ${JSON.stringify(error2, null, 2)}`);
93995
94032
  }
93996
94033
  });
93997
94034
  OnesEditorToolbar.register(editor);
93998
- editor.version = "2.8.38";
94035
+ editor.version = "2.8.39";
93999
94036
  return editor;
94000
94037
  }
94001
94038
  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.38",
3
+ "version": "2.8.39",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {