@ones-editor/editor 2.2.8-beta.10 → 2.2.8-beta.12

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.
@@ -70,6 +70,6 @@ export interface CommandBarOptions {
70
70
  }
71
71
  export type CreateManualCommandBarFunction = (parentItem: CommandItem, closeable: Closeable, options?: CommandBarOptions) => AbstractManualCommandBar;
72
72
  export type PopoverOptions = {
73
- overflowBoundary?: Element | (() => Element);
73
+ overflowBoundary?: Element;
74
74
  };
75
75
  export type SelectItemFrom = 'event' | 'manual';
package/dist/index.js CHANGED
@@ -10079,9 +10079,6 @@ var __publicField = (obj, key, value) => {
10079
10079
  c = "\\\\";
10080
10080
  return s.replace(new RegExp(`^[${c}]+|[${c}]+$`, "g"), "");
10081
10081
  }
10082
- function isFunction$1(functionToCheck) {
10083
- return !!functionToCheck && {}.toString.call(functionToCheck) === "[object Function]";
10084
- }
10085
10082
  function isPrintableKey(key) {
10086
10083
  if (!key)
10087
10084
  return false;
@@ -52112,7 +52109,7 @@ ${codeText}
52112
52109
  this.toolbar = new ManualToolbar([], void 0, {
52113
52110
  tooltipId: editor.clientId,
52114
52111
  id: "editor-readonly-toolbar",
52115
- overflowBoundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
52112
+ overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
52116
52113
  refuseOverflow: true,
52117
52114
  padding: 20
52118
52115
  });
@@ -52346,7 +52343,7 @@ ${codeText}
52346
52343
  this.toolbar = new ManualToolbar([], void 0, {
52347
52344
  tooltipId: editor.clientId,
52348
52345
  id: "editor-toolbar",
52349
- overflowBoundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
52346
+ overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
52350
52347
  refuseOverflow: true,
52351
52348
  padding: 20,
52352
52349
  showName: clientType.isMobile,
@@ -52526,8 +52523,15 @@ ${codeText}
52526
52523
  }
52527
52524
  }
52528
52525
  const getReferenceClientRectByCaret = () => {
52526
+ if (!this.hoveringBlock) {
52527
+ return new DOMRect();
52528
+ }
52529
+ const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
52530
+ if (!element2) {
52531
+ return new DOMRect();
52532
+ }
52529
52533
  let rect;
52530
- const clientRects = element.getClientRects();
52534
+ const clientRects = element2.getClientRects();
52531
52535
  const lineRects = [];
52532
52536
  Array.from(clientRects).forEach((clientRect) => {
52533
52537
  const { y } = clientRect;
@@ -52537,7 +52541,7 @@ ${codeText}
52537
52541
  lineRects.push(y);
52538
52542
  });
52539
52543
  if (lineRects.length > 1) {
52540
- rect = child ? clientRects[clientRects.length - 1] : clientRects[0];
52544
+ rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
52541
52545
  if (event) {
52542
52546
  for (let i = 0; i < clientRects.length; i++) {
52543
52547
  const clientRect = clientRects[i];
@@ -52549,21 +52553,15 @@ ${codeText}
52549
52553
  }
52550
52554
  }
52551
52555
  } else {
52552
- rect = element.getBoundingClientRect();
52553
- if (child) {
52554
- const childRect = child.getBoundingClientRect();
52556
+ rect = element2.getBoundingClientRect();
52557
+ if (!isBlock$1(element2)) {
52558
+ const childRect = element2.getBoundingClientRect();
52555
52559
  return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
52556
52560
  }
52557
52561
  if (clientRects.length === 1) {
52558
52562
  return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
52559
52563
  }
52560
52564
  }
52561
- if (this.hoveringBlock) {
52562
- const blockContent = getBlockContent(this.hoveringBlock);
52563
- if (blockContent !== element) {
52564
- return blockContent.getBoundingClientRect();
52565
- }
52566
- }
52567
52565
  if (event) {
52568
52566
  const y = rect.y;
52569
52567
  const x = event.clientX;
@@ -52573,8 +52571,9 @@ ${codeText}
52573
52571
  };
52574
52572
  this.toolbar.updateItems(commands);
52575
52573
  if (!this.toolbar.isVisible) {
52574
+ const isText = element === child && !isTextBlockContentBoxChild(element);
52576
52575
  this.toolbar.manualShow(element, {
52577
- placement: child && !isTextBlockContentBoxChild(child) && !clientType.isMobile ? "bottom" : "top",
52576
+ placement: isText && !clientType.isMobile ? "bottom" : "top",
52578
52577
  getReferenceClientRect: getReferenceClientRectByCaret
52579
52578
  });
52580
52579
  if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
@@ -67710,7 +67709,7 @@ ${codeText}
67710
67709
  });
67711
67710
  });
67712
67711
  __publicField(this, "handleEditorResize", () => {
67713
- this.updateItemsLayout();
67712
+ this.updateItemsLayout(false);
67714
67713
  });
67715
67714
  __publicField(this, "handleDocChanged", () => {
67716
67715
  this.updateComments();
@@ -67787,9 +67786,11 @@ ${codeText}
67787
67786
  this.removeAllListeners();
67788
67787
  document.removeEventListener("click", this.handleDocumentClick);
67789
67788
  }
67790
- updateItemsLayout() {
67789
+ updateItemsLayout(dispatchScroll = true) {
67791
67790
  arrangeItems(this.editor, this.items, this.activeItem);
67792
- this.dispatchScroll();
67791
+ if (dispatchScroll) {
67792
+ this.dispatchScroll();
67793
+ }
67793
67794
  }
67794
67795
  bindEvents() {
67795
67796
  this.container.addEventListener("click", this.handleContainerClick);
@@ -69596,7 +69597,7 @@ ${codeText}
69596
69597
  const popover = editor.options.componentsOptions.popover;
69597
69598
  this.toolbar = new ManualToolbar([], void 0, {
69598
69599
  id: "table-row-column-toolbar",
69599
- overflowBoundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
69600
+ overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
69600
69601
  refuseOverflow: true,
69601
69602
  tooltipId: this.editor.clientId
69602
69603
  });
@@ -69660,7 +69661,7 @@ ${codeText}
69660
69661
  modifiers: [{
69661
69662
  name: "flip",
69662
69663
  options: {
69663
- boundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
69664
+ boundary: popover == null ? void 0 : popover.overflowBoundary,
69664
69665
  fallbackPlacements: ["left", "right"]
69665
69666
  }
69666
69667
  }]
@@ -88377,7 +88378,7 @@ ${data2.flowchartText}
88377
88378
  }
88378
88379
  }
88379
88380
  });
88380
- editor.version = "2.2.8-beta.10";
88381
+ editor.version = "2.2.8-beta.12";
88381
88382
  return editor;
88382
88383
  }
88383
88384
  function isDoc(doc2) {
@@ -88472,7 +88473,7 @@ ${data2.flowchartText}
88472
88473
  });
88473
88474
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88474
88475
  OnesEditorToolbar.register(editor);
88475
- editor.version = "2.2.8-beta.10";
88476
+ editor.version = "2.2.8-beta.12";
88476
88477
  return editor;
88477
88478
  }
88478
88479
  async function showDocVersions(editor, options, serverUrl) {
@@ -134703,7 +134704,6 @@ ${data2.flowchartText}
134703
134704
  exports2.isFirefox = isFirefox;
134704
134705
  exports2.isFirstChildBlockInComplexBlock = isFirstChildBlockInComplexBlock;
134705
134706
  exports2.isFullSelectedOneComplexBlock = isFullSelectedOneComplexBlock;
134706
- exports2.isFunction = isFunction$1;
134707
134707
  exports2.isHeadingBlock = isHeadingBlock$1;
134708
134708
  exports2.isHighSurrogate = t$7;
134709
134709
  exports2.isInBlock = isInBlock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.2.8-beta.10",
3
+ "version": "2.2.8-beta.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",