@ones-editor/editor 0.0.7-beta.50 → 0.0.7-beta.51

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
@@ -22454,6 +22454,18 @@ var __publicField = (obj, key, value) => {
22454
22454
  }
22455
22455
  return false;
22456
22456
  }
22457
+ function getBlockPartialVisiblePercent(editor, block) {
22458
+ const visibleRect = editorGetVisibleRect(editor);
22459
+ const rect = block.getBoundingClientRect();
22460
+ if (rect.top >= visibleRect.top && rect.top <= visibleRect.bottom && rect.bottom <= visibleRect.bottom && rect.bottom >= visibleRect.top) {
22461
+ return 100;
22462
+ }
22463
+ const intersectionX = Math.max(0, Math.min(rect.right, visibleRect.right) - Math.max(rect.left, visibleRect.left));
22464
+ const intersectionY = Math.max(0, Math.min(rect.bottom, visibleRect.bottom) - Math.max(rect.top, visibleRect.top));
22465
+ const intersectionArea = intersectionX * intersectionY;
22466
+ const elementAArea = rect.width * rect.height;
22467
+ return intersectionArea / elementAArea * 100;
22468
+ }
22457
22469
  function isChildContainerVisible(editor, container) {
22458
22470
  const visibleRect = editorGetVisibleRect(editor);
22459
22471
  const rect = container.getBoundingClientRect();
@@ -22480,7 +22492,7 @@ var __publicField = (obj, key, value) => {
22480
22492
  }
22481
22493
  if (selection.range.start.blockId === selection.range.end.blockId) {
22482
22494
  const block2 = editor.getBlockById(selection.range.start.blockId);
22483
- if (isEmbedBlock(block2) && isBlockPartialVisible(editor, block2)) {
22495
+ if (isEmbedBlock(block2) && isBlockPartialVisible(editor, block2) && getBlockPartialVisiblePercent(editor, block2) >= 50) {
22484
22496
  return;
22485
22497
  }
22486
22498
  if (isComplexKindBlock(editor, block2) && isBlockPartialVisible(editor, block2)) {
@@ -22492,6 +22504,15 @@ var __publicField = (obj, key, value) => {
22492
22504
  if (isBlockPositionVisible(editor, simplePos)) {
22493
22505
  return;
22494
22506
  }
22507
+ if (isEmbedBlock(block)) {
22508
+ const next = getNextBlock(block);
22509
+ if (next) {
22510
+ animateScrollTo(next, {
22511
+ elementToScroll: getScrollContainer$1(editor.rootContainer)
22512
+ });
22513
+ return;
22514
+ }
22515
+ }
22495
22516
  const rect = getBlockCaretRect(editor, block, simplePos);
22496
22517
  const blockRect = block.getBoundingClientRect();
22497
22518
  const tools = getBlockTools(block);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "0.0.7-beta.50",
3
+ "version": "0.0.7-beta.51",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",