@ones-editor/editor 0.0.7-beta.56 → 0.0.7-beta.58

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
@@ -22499,11 +22499,21 @@ var __publicField = (obj, key, value) => {
22499
22499
  }
22500
22500
  if (selection.range.start.blockId === selection.range.end.blockId) {
22501
22501
  const block2 = editor.getBlockById(selection.range.start.blockId);
22502
- if (isEmbedBlock(block2) && isBlockPartialVisible(editor, block2) && getBlockPartialVisiblePercent(editor, block2) >= 50) {
22502
+ if (isEmbedBlock(block2) && isBlockPartialVisible(editor, block2) && getBlockPartialVisiblePercent(editor, block2) >= 95) {
22503
22503
  return;
22504
22504
  }
22505
- if (isComplexKindBlock(editor, block2) && isBlockPartialVisible(editor, block2)) {
22506
- return;
22505
+ const rootBlock = getRootBlock(block2);
22506
+ if (isComplexKindBlock(editor, rootBlock) && isBlockPartialVisible(editor, block2)) {
22507
+ if (getBlockPartialVisiblePercent(editor, block2) >= 95) {
22508
+ return;
22509
+ }
22510
+ const next = getNextBlock(rootBlock);
22511
+ if (next) {
22512
+ animateScrollTo(next, {
22513
+ elementToScroll: getScrollContainer$1(editor.rootContainer)
22514
+ });
22515
+ return;
22516
+ }
22507
22517
  }
22508
22518
  }
22509
22519
  const simplePos = pos;
@@ -22514,9 +22524,18 @@ var __publicField = (obj, key, value) => {
22514
22524
  if (isEmbedBlock(block)) {
22515
22525
  const next = getNextBlock(block);
22516
22526
  if (next) {
22517
- animateScrollTo(next, {
22518
- elementToScroll: getScrollContainer$1(editor.rootContainer)
22519
- });
22527
+ const delayEmbedBlockTypes = ["image"];
22528
+ if (delayEmbedBlockTypes.includes(getEmbedType(block))) {
22529
+ setTimeout(() => {
22530
+ animateScrollTo(next, {
22531
+ elementToScroll: getScrollContainer$1(editor.rootContainer)
22532
+ });
22533
+ }, 500);
22534
+ } else {
22535
+ animateScrollTo(next, {
22536
+ elementToScroll: getScrollContainer$1(editor.rootContainer)
22537
+ });
22538
+ }
22520
22539
  return;
22521
22540
  }
22522
22541
  }
@@ -25962,7 +25981,14 @@ var __publicField = (obj, key, value) => {
25962
25981
  }
25963
25982
  localUpdateBlockData(containerId, blockIndex, delta, newRange) {
25964
25983
  assert(logger$2B, !this.editor.readonly, "editor is readonly");
25965
- this.editor.getBlockByIndex(containerId, blockIndex);
25984
+ const block = this.editor.getBlockByIndex(containerId, blockIndex);
25985
+ if (!this.editor.isBlockWritable(block)) {
25986
+ const deletedKeys = Array.from(delta.delete).filter((key) => key !== "comments");
25987
+ const insertedKeys = Object.keys(delta.insert).filter((key) => key !== "comments");
25988
+ if (deletedKeys.length > 0 || insertedKeys.length > 0) {
25989
+ assert(logger$2B, false, `block is not writable, comment supported only, ${JSON.stringify(delta)}}`);
25990
+ }
25991
+ }
25966
25992
  const oldData = cloneDeep__default.default(this.getBlockData(containerId, blockIndex));
25967
25993
  const newData = cloneDeep__default.default(applyBlockDataDelta(oldData, delta));
25968
25994
  this.localEvents.forEach((event) => event.onBeforeUpdateBlockData(containerId, oldData.id, oldData, newData, newRange));
@@ -53120,7 +53146,9 @@ ${codeText}
53120
53146
  enable(block) {
53121
53147
  if (isImageBlock(block)) {
53122
53148
  const object = ImageObject.getImageObject(this.editor, block);
53123
- object.tryEnableResizer();
53149
+ if (this.editor.isBlockWritable(block)) {
53150
+ object.tryEnableResizer();
53151
+ }
53124
53152
  }
53125
53153
  }
53126
53154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "0.0.7-beta.56",
3
+ "version": "0.0.7-beta.58",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",