@ones-editor/editor 2.6.1-beta.4 → 2.7.1-beta.2

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
@@ -334,12 +334,12 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-type
334
334
  div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.hover .embed-hover-content {
335
335
  outline: 1px solid #0064ff;
336
336
  }
337
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected > div[data-type=block-content],
338
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content {
337
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) > div[data-type=block-content],
338
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) .embed-selected-content {
339
339
  position: relative;
340
340
  }
341
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected > div[data-type=block-content]::before,
342
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content::before {
341
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) > div[data-type=block-content]::before,
342
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) .embed-selected-content::before {
343
343
  content: " ";
344
344
  position: absolute;
345
345
  left: 0;
@@ -8900,7 +8900,7 @@ var __publicField = (obj, key, value) => {
8900
8900
  imageExportFailed: "\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"
8901
8901
  }
8902
8902
  };
8903
- const logger$4S = getLogger("i18n");
8903
+ const logger$4R = getLogger("i18n");
8904
8904
  const langs$3 = {
8905
8905
  "en-US": enUS$x,
8906
8906
  "zh-CN": zhCN$x,
@@ -8920,7 +8920,7 @@ var __publicField = (obj, key, value) => {
8920
8920
  function t$8(key, args) {
8921
8921
  const ret = i18n.get(key, args);
8922
8922
  if (ret === key) {
8923
- logger$4S.warn(`no locale value for key ${key}`);
8923
+ logger$4R.warn(`no locale value for key ${key}`);
8924
8924
  }
8925
8925
  return ret;
8926
8926
  }
@@ -9533,7 +9533,7 @@ var __publicField = (obj, key, value) => {
9533
9533
  this._callbacks.clear();
9534
9534
  }
9535
9535
  }
9536
- const logger$4R = getLogger("await-locker");
9536
+ const logger$4Q = getLogger("await-locker");
9537
9537
  class AwaitLock {
9538
9538
  constructor() {
9539
9539
  __publicField(this, "_acquired", false);
@@ -9575,7 +9575,7 @@ var __publicField = (obj, key, value) => {
9575
9575
  }
9576
9576
  if (this._waitingResolvers.length > 0) {
9577
9577
  const resolve = this._waitingResolvers.shift();
9578
- assert(logger$4R, resolve, "Resolver missing");
9578
+ assert(logger$4Q, resolve, "Resolver missing");
9579
9579
  resolve(void 0);
9580
9580
  } else {
9581
9581
  this._acquired = false;
@@ -9658,7 +9658,7 @@ var __publicField = (obj, key, value) => {
9658
9658
  isMobileSafari: false
9659
9659
  };
9660
9660
  clientType.isMobileSafari = clientType.isMobile && clientType.isSafari;
9661
- const logger$4Q = getLogger("dom-utils");
9661
+ const logger$4P = getLogger("dom-utils");
9662
9662
  function addClass(dom, ...className) {
9663
9663
  if (dom && dom.nodeType === Node.ELEMENT_NODE) {
9664
9664
  dom.classList.add(...className);
@@ -9712,7 +9712,7 @@ var __publicField = (obj, key, value) => {
9712
9712
  range.setStart(node, offset);
9713
9713
  return range;
9714
9714
  } catch (err) {
9715
- assert(logger$4Q, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
9715
+ assert(logger$4P, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
9716
9716
  }
9717
9717
  }
9718
9718
  function createExpandedRange(startNode, startOffset, endNode, endOffset) {
@@ -9722,17 +9722,17 @@ var __publicField = (obj, key, value) => {
9722
9722
  range.setEnd(endNode, endOffset);
9723
9723
  return range;
9724
9724
  } catch (err) {
9725
- assert(logger$4Q, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
9725
+ assert(logger$4P, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
9726
9726
  }
9727
9727
  }
9728
9728
  function getFirstClientRect(elem) {
9729
9729
  const rects = elem.getClientRects();
9730
- assert(logger$4Q, rects.length >= 1, "getFirstClientRect: no rects");
9730
+ assert(logger$4P, rects.length >= 1, "getFirstClientRect: no rects");
9731
9731
  return rects[0];
9732
9732
  }
9733
9733
  function getLastClientRect(elem) {
9734
9734
  const rects = elem.getClientRects();
9735
- assert(logger$4Q, rects.length >= 1, "getLastClientRect: no rects");
9735
+ assert(logger$4P, rects.length >= 1, "getLastClientRect: no rects");
9736
9736
  return rects[rects.length - 1];
9737
9737
  }
9738
9738
  function getDistanceSquare(rect, x, y) {
@@ -9779,7 +9779,7 @@ var __publicField = (obj, key, value) => {
9779
9779
  return 0;
9780
9780
  }
9781
9781
  if (!elem1.parentElement || !elem2.parentElement) {
9782
- assert(logger$4Q, false, "invalid dom node to compare");
9782
+ assert(logger$4P, false, "invalid dom node to compare");
9783
9783
  }
9784
9784
  if (elem1.parentElement === elem2.parentElement) {
9785
9785
  const children = Array.from(elem1.parentElement.children);
@@ -9796,7 +9796,7 @@ var __publicField = (obj, key, value) => {
9796
9796
  const parents1 = getParents(elem1);
9797
9797
  const parents2 = getParents(elem2);
9798
9798
  if (parents1[0] !== parents2[0]) {
9799
- assert(logger$4Q, false, "invalid dom node to compare, different tree");
9799
+ assert(logger$4P, false, "invalid dom node to compare, different tree");
9800
9800
  }
9801
9801
  for (let i = 1; ; i++) {
9802
9802
  const parent1 = parents1[i];
@@ -10396,7 +10396,7 @@ var __publicField = (obj, key, value) => {
10396
10396
  }
10397
10397
  }
10398
10398
  const MIN_DISTANCE_THRESHOLD$3 = 3;
10399
- const logger$4P = getLogger("drag-drop");
10399
+ const logger$4O = getLogger("drag-drop");
10400
10400
  class DragDrop {
10401
10401
  constructor(options) {
10402
10402
  __publicField(this, "dragStarted", false);
@@ -10417,7 +10417,7 @@ var __publicField = (obj, key, value) => {
10417
10417
  var _a;
10418
10418
  event.preventDefault();
10419
10419
  event.stopPropagation();
10420
- assert(logger$4P, this.mouseDownEvent, "no mouse down event");
10420
+ assert(logger$4O, this.mouseDownEvent, "no mouse down event");
10421
10421
  const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
10422
10422
  const newPos = DragDrop.getEventPosition(event);
10423
10423
  const deltaX = newPos.x - oldPos.x;
@@ -10433,7 +10433,7 @@ var __publicField = (obj, key, value) => {
10433
10433
  });
10434
10434
  __publicField(this, "handleMouseUp", (event) => {
10435
10435
  if (event instanceof MouseEvent && event.button === 0 || event instanceof TouchEvent) {
10436
- assert(logger$4P, this.mouseDownEvent, "no mouse down event");
10436
+ assert(logger$4O, this.mouseDownEvent, "no mouse down event");
10437
10437
  const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
10438
10438
  const newPos = DragDrop.getEventPosition(event);
10439
10439
  const deltaX = newPos.x - oldPos.x;
@@ -10542,7 +10542,7 @@ var __publicField = (obj, key, value) => {
10542
10542
  const dragDrop = new DragDrop(options);
10543
10543
  return dragDrop;
10544
10544
  }
10545
- const logger$4O = getLogger("character");
10545
+ const logger$4N = getLogger("character");
10546
10546
  function checkChar(charCode, rangeList) {
10547
10547
  for (let i = 0; i < rangeList.length; i++) {
10548
10548
  const start = rangeList[i][0];
@@ -10587,13 +10587,9 @@ var __publicField = (obj, key, value) => {
10587
10587
  ];
10588
10588
  return checkChar(str.charCodeAt(0), CJKRange);
10589
10589
  }
10590
- function isCJKPunctuation(char) {
10591
- const reg = /[\u3000-\u303F\uFF00-\uFFEF\u2000-\u206F\u2E00-\u2E7F]/;
10592
- return reg.test(char);
10593
- }
10594
10590
  function trimChar(s, char) {
10595
10591
  let c = char;
10596
- assert(logger$4O, c.length === 1, "invalid char length");
10592
+ assert(logger$4N, c.length === 1, "invalid char length");
10597
10593
  if (c === "]")
10598
10594
  c = "\\]";
10599
10595
  if (c === "\\")
@@ -10927,7 +10923,7 @@ var __publicField = (obj, key, value) => {
10927
10923
  const metrics = context.measureText(text2);
10928
10924
  return metrics.width + 4;
10929
10925
  }
10930
- const logger$4N = getLogger("editor-clipboard");
10926
+ const logger$4M = getLogger("editor-clipboard");
10931
10927
  async function setClipboardDataByEvent(items, event) {
10932
10928
  if (event.clipboardData) {
10933
10929
  const data2 = event.clipboardData;
@@ -10985,7 +10981,7 @@ var __publicField = (obj, key, value) => {
10985
10981
  document.body.removeChild(textarea2);
10986
10982
  return true;
10987
10983
  } catch (ex) {
10988
- logger$4N.error(ex);
10984
+ logger$4M.error(ex);
10989
10985
  document.body.removeChild(textarea2);
10990
10986
  return false;
10991
10987
  }
@@ -11006,7 +11002,7 @@ var __publicField = (obj, key, value) => {
11006
11002
  document.body.removeChild(div);
11007
11003
  return true;
11008
11004
  } catch (ex) {
11009
- logger$4N.error(ex);
11005
+ logger$4M.error(ex);
11010
11006
  document.body.removeChild(div);
11011
11007
  return false;
11012
11008
  }
@@ -11033,7 +11029,7 @@ var __publicField = (obj, key, value) => {
11033
11029
  await navigator.clipboard.write([clipboardItems]);
11034
11030
  return true;
11035
11031
  } catch (err) {
11036
- logger$4N.error(err);
11032
+ logger$4M.error(err);
11037
11033
  return await execCommandCopy(items);
11038
11034
  }
11039
11035
  }
@@ -11089,7 +11085,7 @@ var __publicField = (obj, key, value) => {
11089
11085
  a.click();
11090
11086
  a.remove();
11091
11087
  }
11092
- const logger$4M = getLogger("auto-scroll");
11088
+ const logger$4L = getLogger("auto-scroll");
11093
11089
  function scrollable(scrollElement, direction) {
11094
11090
  if (scrollElement.scrollHeight === scrollElement.clientHeight) {
11095
11091
  return false;
@@ -11113,7 +11109,7 @@ var __publicField = (obj, key, value) => {
11113
11109
  const isHorizontal = direction === "left" || direction === "right";
11114
11110
  const scroll = () => {
11115
11111
  if (!scrollable(scrollElement, direction)) {
11116
- logger$4M.debug("No need for scroll");
11112
+ logger$4L.debug("No need for scroll");
11117
11113
  return null;
11118
11114
  }
11119
11115
  if (isHorizontal) {
@@ -11170,7 +11166,7 @@ var __publicField = (obj, key, value) => {
11170
11166
  if (this.scrolling) {
11171
11167
  return;
11172
11168
  }
11173
- logger$4M.debug(`scroll direction: ${direction}`);
11169
+ logger$4L.debug(`scroll direction: ${direction}`);
11174
11170
  this.cancelScroll = continuousScroll(scrollElement, {
11175
11171
  direction,
11176
11172
  step
@@ -11420,7 +11416,7 @@ var __publicField = (obj, key, value) => {
11420
11416
  const colorIndex = Math.abs(typeof content === "string" && content.trim() ? hashCode(content.trim()) : 0) % ColorNames.length;
11421
11417
  return ColorNames[colorIndex];
11422
11418
  }
11423
- const logger$4L = getLogger("container");
11419
+ const logger$4K = getLogger("container");
11424
11420
  function isContainer(elem) {
11425
11421
  return elem.getAttribute("data-type") === "editor-container";
11426
11422
  }
@@ -11432,9 +11428,9 @@ var __publicField = (obj, key, value) => {
11432
11428
  }
11433
11429
  function getContainerId(container) {
11434
11430
  const id = container.getAttribute("data-container-id");
11435
- assert(logger$4L, id, "no id for container");
11431
+ assert(logger$4K, id, "no id for container");
11436
11432
  if (isRootContainer(container)) {
11437
- assert(logger$4L, id === "root", `invalid root container id, : ${id}`);
11433
+ assert(logger$4K, id === "root", `invalid root container id, : ${id}`);
11438
11434
  }
11439
11435
  return id;
11440
11436
  }
@@ -11445,7 +11441,7 @@ var __publicField = (obj, key, value) => {
11445
11441
  function generateEditorContainerId(containerId) {
11446
11442
  return `ones-editor-container-${containerId}`;
11447
11443
  }
11448
- const logger$4K = getLogger("element");
11444
+ const logger$4J = getLogger("element");
11449
11445
  function createContainerElement(parent, type, containerId) {
11450
11446
  const container = createElement("div", [type], parent);
11451
11447
  container.setAttribute("data-type", "editor-container");
@@ -11456,7 +11452,7 @@ var __publicField = (obj, key, value) => {
11456
11452
  }
11457
11453
  function getContainerById(editor, containerId) {
11458
11454
  const container = editor.rootElement.querySelector(`[data-container-id=${containerId}]`);
11459
- assert(logger$4K, container, `no container: ${containerId}`);
11455
+ assert(logger$4J, container, `no container: ${containerId}`);
11460
11456
  return container;
11461
11457
  }
11462
11458
  function getExistsContainerById(editor, containerId) {
@@ -11465,7 +11461,7 @@ var __publicField = (obj, key, value) => {
11465
11461
  }
11466
11462
  function getContainerBlocksElement(container) {
11467
11463
  const blocks = container.querySelector(":scope > .container-blocks");
11468
- assert(logger$4K, blocks, "no container blocks element");
11464
+ assert(logger$4J, blocks, "no container blocks element");
11469
11465
  return blocks;
11470
11466
  }
11471
11467
  function getContainerToolsElement(container) {
@@ -11478,11 +11474,11 @@ var __publicField = (obj, key, value) => {
11478
11474
  function isContainerBlocksElement(element) {
11479
11475
  return element.classList.contains("container-blocks");
11480
11476
  }
11481
- const logger$4J = getLogger("container-children");
11477
+ const logger$4I = getLogger("container-children");
11482
11478
  function getChildBlocks(container, traverseChild) {
11483
11479
  const content = getContainerBlocksElement(container);
11484
11480
  const blocks = Array.from(content.children);
11485
- assert(logger$4J, blocks.length > 0, "container have not any child block");
11481
+ assert(logger$4I, blocks.length > 0, "container have not any child block");
11486
11482
  if (traverseChild) {
11487
11483
  const { condition, editor } = traverseChild;
11488
11484
  return blocks.reduce((result, block) => {
@@ -11505,7 +11501,7 @@ var __publicField = (obj, key, value) => {
11505
11501
  }
11506
11502
  function getFirstChildBlock(container) {
11507
11503
  const block = container.querySelector(":scope > .container-blocks > div[data-type=editor-block]");
11508
- assert(logger$4J, block, "container have not any child block");
11504
+ assert(logger$4I, block, "container have not any child block");
11509
11505
  return block;
11510
11506
  }
11511
11507
  function getLastChildBlock(container) {
@@ -11517,14 +11513,14 @@ var __publicField = (obj, key, value) => {
11517
11513
  }
11518
11514
  function getBlockByIndex(container, blockIndex) {
11519
11515
  const block = getChildBlocks(container)[blockIndex];
11520
- assert(logger$4J, block, `container have not block at index ${blockIndex}`);
11516
+ assert(logger$4I, block, `container have not block at index ${blockIndex}`);
11521
11517
  return block;
11522
11518
  }
11523
11519
  function findBlockByIndex(container, blockIndex) {
11524
11520
  var _a;
11525
11521
  return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
11526
11522
  }
11527
- const logger$4I = getLogger("block-dom");
11523
+ const logger$4H = getLogger("block-dom");
11528
11524
  function isBlock$1(node) {
11529
11525
  if (!(node instanceof HTMLDivElement)) {
11530
11526
  return false;
@@ -11545,12 +11541,12 @@ var __publicField = (obj, key, value) => {
11545
11541
  }
11546
11542
  function getBlockId(block) {
11547
11543
  const { id } = block;
11548
- assert(logger$4I, id, "no block id");
11544
+ assert(logger$4H, id, "no block id");
11549
11545
  return id;
11550
11546
  }
11551
11547
  function getBlockType(block) {
11552
11548
  const type = block.getAttribute("data-block-type");
11553
- assert(logger$4I, type, "invalid block dom, no data-type");
11549
+ assert(logger$4H, type, "invalid block dom, no data-type");
11554
11550
  return type;
11555
11551
  }
11556
11552
  function getParentBlock(node) {
@@ -11573,12 +11569,12 @@ var __publicField = (obj, key, value) => {
11573
11569
  }
11574
11570
  function getParentContainer(block) {
11575
11571
  const container = block.closest("div[data-type=editor-container]");
11576
- assert(logger$4I, container, "failed to get block container");
11572
+ assert(logger$4H, container, "failed to get block container");
11577
11573
  return container;
11578
11574
  }
11579
11575
  function getBlockContent(block) {
11580
11576
  const content = block.querySelector(":scope >div[data-type=block-content]");
11581
- assert(logger$4I, content, "no block content");
11577
+ assert(logger$4H, content, "no block content");
11582
11578
  return content;
11583
11579
  }
11584
11580
  function getBlockTools(block) {
@@ -11587,7 +11583,7 @@ var __publicField = (obj, key, value) => {
11587
11583
  tools = createElement("div", [], block);
11588
11584
  tools.setAttribute("data-type", "block-tools");
11589
11585
  }
11590
- assert(logger$4I, tools, "no block tools");
11586
+ assert(logger$4H, tools, "no block tools");
11591
11587
  return tools;
11592
11588
  }
11593
11589
  function getExistsBlockTools(block) {
@@ -11608,7 +11604,7 @@ var __publicField = (obj, key, value) => {
11608
11604
  function createBlockElement(editor, path, data2) {
11609
11605
  const blockData = editor.editorDecorators.decorateBlock(path, data2);
11610
11606
  const { id, type } = blockData;
11611
- assert(logger$4I, id, "no block id");
11607
+ assert(logger$4H, id, "no block id");
11612
11608
  const elem = createElement("div", [`${type}-block`], null);
11613
11609
  elem.id = id;
11614
11610
  elem.setAttribute("data-type", "editor-block");
@@ -11646,7 +11642,7 @@ var __publicField = (obj, key, value) => {
11646
11642
  }
11647
11643
  function getBoxTypeFromElement(box) {
11648
11644
  const type = box.getAttribute("data-box-type");
11649
- assert(logger$4I, type, "not a valid box element, no type");
11645
+ assert(logger$4H, type, "not a valid box element, no type");
11650
11646
  return type;
11651
11647
  }
11652
11648
  function isBox(node) {
@@ -11657,7 +11653,7 @@ var __publicField = (obj, key, value) => {
11657
11653
  }
11658
11654
  function getBoxId(box) {
11659
11655
  const { id } = box;
11660
- assert(logger$4I, id, "no box id");
11656
+ assert(logger$4H, id, "no box id");
11661
11657
  return id;
11662
11658
  }
11663
11659
  function getParentBox(node) {
@@ -11679,7 +11675,7 @@ var __publicField = (obj, key, value) => {
11679
11675
  }
11680
11676
  function getBoxContent(box) {
11681
11677
  const content = box.querySelector("span[data-type=box-content]");
11682
- assert(logger$4I, content, "invalid box dom, no content");
11678
+ assert(logger$4H, content, "invalid box dom, no content");
11683
11679
  return content;
11684
11680
  }
11685
11681
  function createInsertionElement(type, id, attributes) {
@@ -11701,7 +11697,7 @@ var __publicField = (obj, key, value) => {
11701
11697
  }
11702
11698
  function getInsertionContent(insertion) {
11703
11699
  const content = insertion.querySelector("span[data-type=insertion-content]");
11704
- assert(logger$4I, content, "invalid insertion-child dom, no content");
11700
+ assert(logger$4H, content, "invalid insertion-child dom, no content");
11705
11701
  return content;
11706
11702
  }
11707
11703
  function getPrevBlock(block) {
@@ -11724,44 +11720,31 @@ var __publicField = (obj, key, value) => {
11724
11720
  }
11725
11721
  return null;
11726
11722
  }
11727
- function getPrevVisibleBlock(block, matcher) {
11728
- const mergedMatcher = matcher || (() => true);
11723
+ function getPrevVisibleBlock(block) {
11729
11724
  let prev = block.previousElementSibling;
11730
11725
  while (prev) {
11731
- if (isBlock$1(prev) && isVisibleBlock(prev) && mergedMatcher(prev)) {
11726
+ if (isBlock$1(prev) && isVisibleBlock(prev)) {
11732
11727
  return prev;
11733
11728
  }
11734
11729
  prev = prev.previousElementSibling;
11735
11730
  }
11736
11731
  return null;
11737
11732
  }
11738
- function getNextVisibleBlock(block, matcher) {
11739
- const mergedMatcher = matcher || (() => true);
11733
+ function getNextVisibleBlock(block) {
11740
11734
  let next2 = block.nextElementSibling;
11741
11735
  while (next2) {
11742
- if (isBlock$1(next2) && isVisibleBlock(next2) && mergedMatcher(next2)) {
11736
+ if (isBlock$1(next2) && isVisibleBlock(next2)) {
11743
11737
  return next2;
11744
11738
  }
11745
11739
  next2 = next2.nextElementSibling;
11746
11740
  }
11747
11741
  return null;
11748
11742
  }
11749
- function getBlocksBetween(start, end, matcher) {
11750
- const blocks = [];
11751
- let cur = start;
11752
- while (cur !== end) {
11753
- if (isBlock$1(cur) && matcher(cur)) {
11754
- blocks.push(cur);
11755
- }
11756
- cur = cur.nextElementSibling;
11757
- }
11758
- return blocks;
11759
- }
11760
11743
  function getBlockIndex(block) {
11761
11744
  const container = getParentContainer(block);
11762
11745
  const children = getChildBlocks(container);
11763
11746
  const index2 = children.indexOf(block);
11764
- assert(logger$4I, index2 !== -1, "invalid block & container dom, failed to get block index");
11747
+ assert(logger$4H, index2 !== -1, "invalid block & container dom, failed to get block index");
11765
11748
  return index2;
11766
11749
  }
11767
11750
  function isInBlock(target) {
@@ -11786,18 +11769,18 @@ var __publicField = (obj, key, value) => {
11786
11769
  function isTitleBlock$2(block) {
11787
11770
  return block.hasAttribute("data-document-title");
11788
11771
  }
11789
- const logger$4H = getLogger("block-class");
11772
+ const logger$4G = getLogger("block-class");
11790
11773
  function getBlockClass(editor, block) {
11791
11774
  return editor.editorBlocks.getBlockClass(getBlockType(block));
11792
11775
  }
11793
11776
  function getTextBlockClass(editor, block) {
11794
11777
  const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
11795
- assert(logger$4H, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
11778
+ assert(logger$4G, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
11796
11779
  return text2;
11797
11780
  }
11798
11781
  function getComplexBlockClass(editor, block) {
11799
11782
  const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
11800
- assert(logger$4H, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
11783
+ assert(logger$4G, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
11801
11784
  return complex;
11802
11785
  }
11803
11786
  function getBlockClassByType(editor, type) {
@@ -11818,7 +11801,7 @@ var __publicField = (obj, key, value) => {
11818
11801
  function getBlockKind(editor, block) {
11819
11802
  return getBlockClass(editor, block).blockKind;
11820
11803
  }
11821
- const logger$4G = getLogger("text-block-child");
11804
+ const logger$4F = getLogger("text-block-child");
11822
11805
  function isTextBlockContentChild(elem) {
11823
11806
  if (elem.tagName !== "SPAN") {
11824
11807
  return false;
@@ -11826,14 +11809,14 @@ var __publicField = (obj, key, value) => {
11826
11809
  return true;
11827
11810
  }
11828
11811
  function isTextBlockContentBoxChild(elem) {
11829
- assert(logger$4G, isTextBlockContentChild(elem), "not a valid text child");
11812
+ assert(logger$4F, isTextBlockContentChild(elem), "not a valid text child");
11830
11813
  if (elem.getAttribute("data-type") === "editor-box") {
11831
11814
  return true;
11832
11815
  }
11833
11816
  return false;
11834
11817
  }
11835
11818
  function isTextBlockContentInsertionChild(elem) {
11836
- assert(logger$4G, isTextBlockContentChild(elem), "not a valid text child");
11819
+ assert(logger$4F, isTextBlockContentChild(elem), "not a valid text child");
11837
11820
  if (elem.getAttribute("data-type") === "editor-insertion") {
11838
11821
  return true;
11839
11822
  }
@@ -11843,7 +11826,7 @@ var __publicField = (obj, key, value) => {
11843
11826
  return !isTextBlockContentBoxChild(elem) && !isTextBlockContentInsertionChild(elem);
11844
11827
  }
11845
11828
  function getTextBlockContentChildType(child) {
11846
- assert(logger$4G, isTextBlockContentChild(child), "not a valid text child");
11829
+ assert(logger$4F, isTextBlockContentChild(child), "not a valid text child");
11847
11830
  if (isTextBlockContentBoxChild(child)) {
11848
11831
  return "box";
11849
11832
  }
@@ -11858,15 +11841,15 @@ var __publicField = (obj, key, value) => {
11858
11841
  return 0;
11859
11842
  if (type === "box")
11860
11843
  return 1;
11861
- assert(logger$4G, child.textContent !== null, "text block content is undefined");
11862
- assert(logger$4G, child.textContent.length >= 0, "text block content length is negative");
11844
+ assert(logger$4F, child.textContent !== null, "text block content is undefined");
11845
+ assert(logger$4F, child.textContent.length >= 0, "text block content length is negative");
11863
11846
  return child.textContent.length;
11864
11847
  }
11865
11848
  function getTextBlockContentChildren(block) {
11866
11849
  const content = getBlockContent(block);
11867
11850
  const children = Array.from(content.children);
11868
11851
  children.forEach((child) => {
11869
- assert(logger$4G, isTextBlockContentChild(child), "not a valid text child");
11852
+ assert(logger$4F, isTextBlockContentChild(child), "not a valid text child");
11870
11853
  });
11871
11854
  return children;
11872
11855
  }
@@ -11895,17 +11878,17 @@ var __publicField = (obj, key, value) => {
11895
11878
  };
11896
11879
  }
11897
11880
  const offset = blockOffset - start;
11898
- assert(logger$4G, offset > 0, "invalid offset value");
11899
- assert(logger$4G, !isTextBlockContentBoxChild(child), "invalid box child");
11881
+ assert(logger$4F, offset > 0, "invalid offset value");
11882
+ assert(logger$4F, !isTextBlockContentBoxChild(child), "invalid box child");
11900
11883
  return {
11901
11884
  prev: child,
11902
11885
  next: child,
11903
11886
  offset
11904
11887
  };
11905
11888
  }
11906
- assert(logger$4G, false, `invalid block child at position: ${blockOffset}`);
11889
+ assert(logger$4F, false, `invalid block child at position: ${blockOffset}`);
11907
11890
  }
11908
- const logger$4F = getLogger("block-path");
11891
+ const logger$4E = getLogger("block-path");
11909
11892
  function getBlockPath(block) {
11910
11893
  const ret = [];
11911
11894
  let current = block;
@@ -11919,26 +11902,26 @@ var __publicField = (obj, key, value) => {
11919
11902
  return ret;
11920
11903
  }
11921
11904
  const parentBlock = getParentBlock(container);
11922
- assert(logger$4F, parentBlock, "no parent block");
11905
+ assert(logger$4E, parentBlock, "no parent block");
11923
11906
  current = parentBlock;
11924
11907
  }
11925
- assert(logger$4F, false, "no parent block");
11908
+ assert(logger$4E, false, "no parent block");
11926
11909
  return [];
11927
11910
  }
11928
- const logger$4E = getLogger("child-container-path");
11911
+ const logger$4D = getLogger("child-container-path");
11929
11912
  function getContainerBlockPath(container) {
11930
11913
  if (isRootContainer(container)) {
11931
11914
  return [];
11932
11915
  }
11933
11916
  const parentBlock = getParentBlock(container);
11934
- assert(logger$4E, parentBlock, "no parent block");
11917
+ assert(logger$4D, parentBlock, "no parent block");
11935
11918
  return getBlockPath(parentBlock);
11936
11919
  }
11937
- const logger$4D = getLogger("load-blocks");
11920
+ const logger$4C = getLogger("load-blocks");
11938
11921
  function loadBlocks(editor, container, path) {
11939
11922
  const containerId = getContainerId(container);
11940
11923
  const blocks = getContainerBlocks$1(container, editor.doc);
11941
- assert(logger$4D, blocks.length > 0, "no blocks in container");
11924
+ assert(logger$4C, blocks.length > 0, "no blocks in container");
11942
11925
  const fragment = document.createDocumentFragment();
11943
11926
  blocks.forEach((b, index2) => {
11944
11927
  const block = editor.editorBlocks.createBlock([...path, { containerId, blockIndex: index2 }], container, b);
@@ -11954,7 +11937,7 @@ var __publicField = (obj, key, value) => {
11954
11937
  return block;
11955
11938
  }
11956
11939
  const blocks = getChildBlocks(container);
11957
- assert(logger$4D, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
11940
+ assert(logger$4C, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
11958
11941
  if (blockIndex === blocks.length) {
11959
11942
  containerBlocksElement.appendChild(block);
11960
11943
  } else {
@@ -11972,7 +11955,7 @@ var __publicField = (obj, key, value) => {
11972
11955
  insertBlockAt(container, blockIndex, block);
11973
11956
  return block;
11974
11957
  }
11975
- const logger$4C = getLogger("root-container");
11958
+ const logger$4B = getLogger("root-container");
11976
11959
  const MIN_DISTANCE_THRESHOLD$2 = 3;
11977
11960
  class RootContainer {
11978
11961
  constructor(editor, rootContainer) {
@@ -12000,7 +11983,7 @@ var __publicField = (obj, key, value) => {
12000
11983
  this.editor.selection.updateSelection(null);
12001
11984
  this.editor.emit("resize", this.editor);
12002
11985
  } catch (err) {
12003
- logger$4C.warn(`failed to update selection while container resizing: ${err.message}`);
11986
+ logger$4B.warn(`failed to update selection while container resizing: ${err.message}`);
12004
11987
  }
12005
11988
  });
12006
11989
  __publicField(this, "handleClick", (event) => {
@@ -12033,7 +12016,7 @@ var __publicField = (obj, key, value) => {
12033
12016
  const box = getParentBox(elem);
12034
12017
  if (box) {
12035
12018
  const block2 = getParentBlock(box);
12036
- assert(logger$4C, block2, "no parent block");
12019
+ assert(logger$4B, block2, "no parent block");
12037
12020
  (_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
12038
12021
  return;
12039
12022
  }
@@ -12088,7 +12071,7 @@ var __publicField = (obj, key, value) => {
12088
12071
  this.editor.input.focus({ preventScroll: true });
12089
12072
  });
12090
12073
  __publicField(this, "handleMouseMove", (event) => {
12091
- assert(logger$4C, this.mouseDownEvent, "no mouse down event");
12074
+ assert(logger$4B, this.mouseDownEvent, "no mouse down event");
12092
12075
  if (ensureIsMobileEvent(this.mouseDownEvent))
12093
12076
  return;
12094
12077
  const deltaX = event.x - this.mouseDownEvent.x;
@@ -12204,7 +12187,7 @@ var __publicField = (obj, key, value) => {
12204
12187
  loadBlocks(editor, container, path);
12205
12188
  return container;
12206
12189
  }
12207
- const logger$4B = getLogger("block");
12190
+ const logger$4A = getLogger("block");
12208
12191
  function getBlockTextLength$6(editor, block) {
12209
12192
  return getBlockClass(editor, block).getBlockTextLength(block);
12210
12193
  }
@@ -12223,7 +12206,7 @@ var __publicField = (obj, key, value) => {
12223
12206
  return block;
12224
12207
  }
12225
12208
  const parent = getParentBlock(container);
12226
- assert(logger$4B, parent, "no parent block exists for child container");
12209
+ assert(logger$4A, parent, "no parent block exists for child container");
12227
12210
  block = parent;
12228
12211
  }
12229
12212
  }
@@ -12259,7 +12242,7 @@ var __publicField = (obj, key, value) => {
12259
12242
  }
12260
12243
  return fun(editor, block, options);
12261
12244
  } catch (err) {
12262
- logger$4B.debug(`unsupported block type: ${type}`);
12245
+ logger$4A.debug(`unsupported block type: ${type}`);
12263
12246
  return null;
12264
12247
  }
12265
12248
  }
@@ -12279,7 +12262,7 @@ var __publicField = (obj, key, value) => {
12279
12262
  const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12280
12263
  Object.entries(styles).forEach(([, value]) => {
12281
12264
  const type = typeof value;
12282
- assert(logger$4B, type === "string" || type === "number" || type === "boolean", "invalid style value");
12265
+ assert(logger$4A, type === "string" || type === "number" || type === "boolean", "invalid style value");
12283
12266
  });
12284
12267
  return styles;
12285
12268
  }
@@ -12404,7 +12387,7 @@ var __publicField = (obj, key, value) => {
12404
12387
  }
12405
12388
  return { element: null, blockCommands: [], boxCommands: [] };
12406
12389
  }
12407
- const logger$4A = getLogger("embed-block-common");
12390
+ const logger$4z = getLogger("embed-block-common");
12408
12391
  function isColumnsBlock(block) {
12409
12392
  return getBlockType(block) === "layout";
12410
12393
  }
@@ -12412,9 +12395,9 @@ var __publicField = (obj, key, value) => {
12412
12395
  return getBlockType(block) === "embed";
12413
12396
  }
12414
12397
  function getEmbedType(block) {
12415
- assert(logger$4A, isEmbedBlock(block), "not an embed block");
12398
+ assert(logger$4z, isEmbedBlock(block), "not an embed block");
12416
12399
  const type = block.getAttribute("data-embed-type");
12417
- assert(logger$4A, type, "no embed data type");
12400
+ assert(logger$4z, type, "no embed data type");
12418
12401
  return type;
12419
12402
  }
12420
12403
  function getEmbedClassFromBlock(editor, block) {
@@ -12480,10 +12463,10 @@ var __publicField = (obj, key, value) => {
12480
12463
  data: (_c = overrideOptions == null ? void 0 : overrideOptions.data) != null ? _c : data2
12481
12464
  });
12482
12465
  }
12483
- const logger$4z = getLogger("execute-block-command");
12466
+ const logger$4y = getLogger("execute-block-command");
12484
12467
  function executeEmbedBlockCommand(editor, block, commandGroup, item) {
12485
12468
  var _a;
12486
- assert(logger$4z, isEmbedBlock(block), "not a embed block");
12469
+ assert(logger$4y, isEmbedBlock(block), "not a embed block");
12487
12470
  const embedType = getEmbedType(block);
12488
12471
  const embed = getEmbedClassByType(editor, embedType);
12489
12472
  if (!embed.getOptions) {
@@ -12516,14 +12499,14 @@ var __publicField = (obj, key, value) => {
12516
12499
  }
12517
12500
  return void 0;
12518
12501
  }
12519
- const logger$4y = getLogger("block-class");
12502
+ const logger$4x = getLogger("block-class");
12520
12503
  function isHeadingBlock$1(block) {
12521
12504
  return !!block.getAttribute("data-style-heading");
12522
12505
  }
12523
12506
  function getBlockHeading(block) {
12524
12507
  var _a;
12525
12508
  const heading = Number.parseInt((_a = block.getAttribute("data-style-heading")) != null ? _a : "", 10);
12526
- assert(logger$4y, heading, "not a heading block");
12509
+ assert(logger$4x, heading, "not a heading block");
12527
12510
  return heading;
12528
12511
  }
12529
12512
  function isExpandedHeadingBlock(block) {
@@ -12534,7 +12517,7 @@ var __publicField = (obj, key, value) => {
12534
12517
  }
12535
12518
  function getHeadingBlockChildren(block, oldHeading) {
12536
12519
  if (!oldHeading) {
12537
- assert(logger$4y, isHeadingBlock$1(block), "not a heading block");
12520
+ assert(logger$4x, isHeadingBlock$1(block), "not a heading block");
12538
12521
  }
12539
12522
  const children = [];
12540
12523
  const heading = oldHeading != null ? oldHeading : getBlockHeading(block);
@@ -12564,7 +12547,7 @@ var __publicField = (obj, key, value) => {
12564
12547
  }
12565
12548
  return children;
12566
12549
  }
12567
- const logger$4x = getLogger("complex-block-position");
12550
+ const logger$4w = getLogger("complex-block-position");
12568
12551
  class EditorComplexBlockPosition {
12569
12552
  constructor(block, childContainerId, custom) {
12570
12553
  __publicField(this, "blockId");
@@ -12573,7 +12556,7 @@ var __publicField = (obj, key, value) => {
12573
12556
  if (block instanceof HTMLElement) {
12574
12557
  this.blockId = getBlockId(block);
12575
12558
  } else {
12576
- assert(logger$4x, typeof block === "string", `not a valid block id: ${block}`);
12559
+ assert(logger$4w, typeof block === "string", `not a valid block id: ${block}`);
12577
12560
  this.blockId = block;
12578
12561
  }
12579
12562
  this.childContainerId = childContainerId;
@@ -12585,7 +12568,7 @@ var __publicField = (obj, key, value) => {
12585
12568
  return false;
12586
12569
  }
12587
12570
  }
12588
- const logger$4w = getLogger("simple-block-position");
12571
+ const logger$4v = getLogger("simple-block-position");
12589
12572
  class EditorSimpleBlockPosition {
12590
12573
  constructor(block, offset, type) {
12591
12574
  __publicField(this, "blockId");
@@ -12594,7 +12577,7 @@ var __publicField = (obj, key, value) => {
12594
12577
  if (block instanceof HTMLElement) {
12595
12578
  this.blockId = getBlockId(block);
12596
12579
  } else {
12597
- assert(logger$4w, typeof block === "string", `not a valid block id: ${block}`);
12580
+ assert(logger$4v, typeof block === "string", `not a valid block id: ${block}`);
12598
12581
  this.blockId = block;
12599
12582
  }
12600
12583
  this.offset = offset;
@@ -12604,7 +12587,7 @@ var __publicField = (obj, key, value) => {
12604
12587
  return true;
12605
12588
  }
12606
12589
  }
12607
- const logger$4v = getLogger("editor-position");
12590
+ const logger$4u = getLogger("editor-position");
12608
12591
  function createSimpleBlockPosition(block, offset, type) {
12609
12592
  return new EditorSimpleBlockPosition(block, offset, type);
12610
12593
  }
@@ -12626,7 +12609,7 @@ var __publicField = (obj, key, value) => {
12626
12609
  }
12627
12610
  const block1 = editor.getBlockById(pos1.blockId);
12628
12611
  const block2 = editor.getBlockById(pos2.blockId);
12629
- assert(logger$4v, block1 !== block2, "comparePosition: blocks are the same");
12612
+ assert(logger$4u, block1 !== block2, "comparePosition: blocks are the same");
12630
12613
  return compareElement(block1, block2);
12631
12614
  }
12632
12615
  if (isComplexBlockPosition(pos1) && isComplexBlockPosition(pos2)) {
@@ -12637,13 +12620,13 @@ var __publicField = (obj, key, value) => {
12637
12620
  }
12638
12621
  const container1 = editor.getContainerById(p1.childContainerId);
12639
12622
  const container2 = editor.getContainerById(p2.childContainerId);
12640
- assert(logger$4v, container1 !== container2, "comparePosition: containers are the same");
12623
+ assert(logger$4u, container1 !== container2, "comparePosition: containers are the same");
12641
12624
  return compareElement(container1, container2);
12642
12625
  }
12643
- assert(logger$4v, false, "invalid ");
12626
+ assert(logger$4u, false, "invalid ");
12644
12627
  return 0;
12645
12628
  }
12646
- const logger$4u = getLogger("simple-range");
12629
+ const logger$4t = getLogger("simple-range");
12647
12630
  class EditorSimpleSelectionRange {
12648
12631
  constructor(editor, options) {
12649
12632
  __publicField(this, "editor");
@@ -12692,11 +12675,11 @@ var __publicField = (obj, key, value) => {
12692
12675
  const { editor } = this;
12693
12676
  const startBlock = editor.getBlockById(this.start.blockId);
12694
12677
  const endBlock = editor.getBlockById(this.end.blockId);
12695
- assert(logger$4u, startBlock, "no start block");
12696
- assert(logger$4u, endBlock, "no end block");
12678
+ assert(logger$4t, startBlock, "no start block");
12679
+ assert(logger$4t, endBlock, "no end block");
12697
12680
  const startContainer = getParentContainer(startBlock);
12698
12681
  const endContainer = getParentContainer(endBlock);
12699
- assert(logger$4u, startContainer === endContainer, "invalid range");
12682
+ assert(logger$4t, startContainer === endContainer, "invalid range");
12700
12683
  const ret = [];
12701
12684
  if (startBlock === endBlock) {
12702
12685
  ret.push({
@@ -12707,7 +12690,7 @@ var __publicField = (obj, key, value) => {
12707
12690
  } else {
12708
12691
  const startIndex = getBlockIndex(startBlock);
12709
12692
  const endIndex = getBlockIndex(endBlock);
12710
- assert(logger$4u, startIndex < endIndex, "invalid range, start > index");
12693
+ assert(logger$4t, startIndex < endIndex, "invalid range, start > index");
12711
12694
  ret.push({
12712
12695
  block: startBlock,
12713
12696
  start: this.start,
@@ -12807,7 +12790,7 @@ var __publicField = (obj, key, value) => {
12807
12790
  clearSelection: clearSelection$6,
12808
12791
  convertTo: convertTo$m
12809
12792
  };
12810
- const logger$4t = getLogger("editor-blocks");
12793
+ const logger$4s = getLogger("editor-blocks");
12811
12794
  class EditorBlocks {
12812
12795
  constructor(editor) {
12813
12796
  __publicField(this, "blocks", /* @__PURE__ */ new Map());
@@ -12816,12 +12799,12 @@ var __publicField = (obj, key, value) => {
12816
12799
  registerBlockClass(blockClass) {
12817
12800
  const type = blockClass.blockType;
12818
12801
  const exists = this.blocks.get(type);
12819
- assert(logger$4t, !exists, `duplicated block type: ${type}`);
12802
+ assert(logger$4s, !exists, `duplicated block type: ${type}`);
12820
12803
  this.blocks.set(type, blockClass);
12821
12804
  }
12822
12805
  getBlockClass(type) {
12823
12806
  const exists = this.blocks.get(type);
12824
- assert(logger$4t, exists, `unknown block type: ${type}`);
12807
+ assert(logger$4s, exists, `unknown block type: ${type}`);
12825
12808
  return exists;
12826
12809
  }
12827
12810
  hasBlock(type) {
@@ -12837,7 +12820,7 @@ var __publicField = (obj, key, value) => {
12837
12820
  }
12838
12821
  const content = blockClass.createBlockContent(this.editor, path, container, blockElement, block);
12839
12822
  if (content.parentElement !== blockElement) {
12840
- logger$4t.warn("content parent is not block");
12823
+ logger$4s.warn("content parent is not block");
12841
12824
  blockElement.appendChild(content);
12842
12825
  }
12843
12826
  this.editor.blockHooks.forEach((hook) => {
@@ -12858,7 +12841,7 @@ var __publicField = (obj, key, value) => {
12858
12841
  return newBlock;
12859
12842
  }
12860
12843
  }
12861
- const logger$4s = getLogger("editor-embeds");
12844
+ const logger$4r = getLogger("editor-embeds");
12862
12845
  class EditorEmbeds {
12863
12846
  constructor(editor) {
12864
12847
  __publicField(this, "objects", /* @__PURE__ */ new Map());
@@ -12867,12 +12850,12 @@ var __publicField = (obj, key, value) => {
12867
12850
  registerEmbedClass(embedClass) {
12868
12851
  const type = embedClass.embedType;
12869
12852
  const exists = this.objects.get(type);
12870
- assert(logger$4s, !exists, `duplicated embed object type: ${type}`);
12853
+ assert(logger$4r, !exists, `duplicated embed object type: ${type}`);
12871
12854
  this.objects.set(type, embedClass);
12872
12855
  }
12873
12856
  getEmbedClass(type) {
12874
12857
  const exists = this.objects.get(type);
12875
- assert(logger$4s, exists, `unknown embed type: ${type}`);
12858
+ assert(logger$4r, exists, `unknown embed type: ${type}`);
12876
12859
  return exists;
12877
12860
  }
12878
12861
  getEmbedClassFromBlock(block) {
@@ -12882,12 +12865,12 @@ var __publicField = (obj, key, value) => {
12882
12865
  this.objects.forEach(callback);
12883
12866
  }
12884
12867
  }
12885
- const logger$4r = getLogger("embed-block");
12868
+ const logger$4q = getLogger("embed-block");
12886
12869
  function createBlockContent$6(editor, path, container, blockElement, blockData) {
12887
12870
  const content = createBlockContentElement(blockElement, "div");
12888
- assert(logger$4r, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
12871
+ assert(logger$4q, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
12889
12872
  const embedBlockData = blockData;
12890
- assert(logger$4r, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
12873
+ assert(logger$4q, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
12891
12874
  const embedClass = editor.editorEmbeds.getEmbedClass(embedBlockData.embedType);
12892
12875
  embedClass.createEmbedContent(editor, content, embedBlockData, path, container, blockElement);
12893
12876
  blockElement.setAttribute("data-embed-type", embedBlockData.embedType);
@@ -12915,7 +12898,7 @@ var __publicField = (obj, key, value) => {
12915
12898
  function getCaretRect$4(block, pos) {
12916
12899
  const content = getBlockContent(block);
12917
12900
  const rect = content.getBoundingClientRect();
12918
- assert(logger$4r, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
12901
+ assert(logger$4q, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
12919
12902
  if (pos.offset === 1) {
12920
12903
  return new DOMRect(rect.right, rect.top, 0, rect.height);
12921
12904
  }
@@ -13055,18 +13038,18 @@ var __publicField = (obj, key, value) => {
13055
13038
  toStandardDoc: toStandardDoc$2,
13056
13039
  getResources: getResources$2
13057
13040
  };
13058
- const logger$4q = getLogger("complex-block-helper");
13041
+ const logger$4p = getLogger("complex-block-helper");
13059
13042
  function complexBlockGetAllChildContainers(editor, block, options) {
13060
13043
  const blockClass = getComplexBlockClass(editor, block);
13061
13044
  return blockClass.getChildContainers(editor, block, options);
13062
13045
  }
13063
13046
  function complexBlockGetSelectedContainers(editor, block, start, end) {
13064
13047
  if (start.isSimple()) {
13065
- assert(logger$4q, end.isSimple(), "invalid start and end position");
13048
+ assert(logger$4p, end.isSimple(), "invalid start and end position");
13066
13049
  return complexBlockGetAllChildContainers(editor, block);
13067
13050
  }
13068
- assert(logger$4q, !start.isSimple(), "invalid start pos");
13069
- assert(logger$4q, !end.isSimple(), "invalid end pos");
13051
+ assert(logger$4p, !start.isSimple(), "invalid start pos");
13052
+ assert(logger$4p, !end.isSimple(), "invalid end pos");
13070
13053
  const blockClass = getComplexBlockClass(editor, block);
13071
13054
  return blockClass.getSelectedContainers(editor, block, start, end);
13072
13055
  }
@@ -13077,11 +13060,11 @@ var __publicField = (obj, key, value) => {
13077
13060
  const parentComplexBlock = getParentBlock(getParentContainer(childBlock));
13078
13061
  if (!parentComplexBlock)
13079
13062
  return false;
13080
- assert(logger$4q, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13063
+ assert(logger$4p, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13081
13064
  const childContainer = getParentContainer(childBlock);
13082
13065
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock);
13083
13066
  const index2 = childContainers.indexOf(childContainer);
13084
- assert(logger$4q, index2 >= 0, "not valid child container");
13067
+ assert(logger$4p, index2 >= 0, "not valid child container");
13085
13068
  return index2 === 0;
13086
13069
  }
13087
13070
  function complexBlockGetFirstSimpleChild(editor, complexBlock, options) {
@@ -13134,13 +13117,13 @@ var __publicField = (obj, key, value) => {
13134
13117
  return block;
13135
13118
  }
13136
13119
  function findPrevSimpleBlockBeforeChildContainer(editor, childContainer, options) {
13137
- assert(logger$4q, isChildContainer(childContainer), "not a child container");
13120
+ assert(logger$4p, isChildContainer(childContainer), "not a child container");
13138
13121
  const parentComplexBlock = getParentBlock(childContainer);
13139
- assert(logger$4q, parentComplexBlock, "no parent block");
13140
- assert(logger$4q, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13122
+ assert(logger$4p, parentComplexBlock, "no parent block");
13123
+ assert(logger$4p, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
13141
13124
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock, options);
13142
13125
  const containerIndex = childContainers.indexOf(childContainer);
13143
- assert(logger$4q, containerIndex !== -1, "child container not found");
13126
+ assert(logger$4p, containerIndex !== -1, "child container not found");
13144
13127
  if (containerIndex === 0) {
13145
13128
  const prevBlock = getPrevBlock(parentComplexBlock);
13146
13129
  if (!prevBlock)
@@ -13158,9 +13141,9 @@ var __publicField = (obj, key, value) => {
13158
13141
  return lastBlock2;
13159
13142
  }
13160
13143
  function complexBlockGetTopChildContainers(editor, complexBlock) {
13161
- assert(logger$4q, isComplexKindBlock(editor, complexBlock), "not a complex block");
13144
+ assert(logger$4p, isComplexKindBlock(editor, complexBlock), "not a complex block");
13162
13145
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
13163
- assert(logger$4q, childContainers.length > 0, "no child container");
13146
+ assert(logger$4p, childContainers.length > 0, "no child container");
13164
13147
  if (childContainers.length === 1) {
13165
13148
  return childContainers;
13166
13149
  }
@@ -13185,9 +13168,9 @@ var __publicField = (obj, key, value) => {
13185
13168
  return ret;
13186
13169
  }
13187
13170
  function complexBlockGetBottomChildContainers(editor, complexBlock) {
13188
- assert(logger$4q, isComplexKindBlock(editor, complexBlock), "not a complex block");
13171
+ assert(logger$4p, isComplexKindBlock(editor, complexBlock), "not a complex block");
13189
13172
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
13190
- assert(logger$4q, childContainers.length > 0, "no child container");
13173
+ assert(logger$4p, childContainers.length > 0, "no child container");
13191
13174
  if (childContainers.length === 1) {
13192
13175
  return childContainers;
13193
13176
  }
@@ -13292,11 +13275,11 @@ var __publicField = (obj, key, value) => {
13292
13275
  return result;
13293
13276
  }
13294
13277
  const anchor = "";
13295
- const logger$4p = getLogger("text-range");
13278
+ const logger$4o = getLogger("text-range");
13296
13279
  function getBlockRangeInfo(block, blockOffset) {
13297
13280
  const getChildRange = (child, offset) => {
13298
13281
  if (isTextBlockContentInsertionChild(child)) {
13299
- assert(logger$4p, offset === 0, `invalid offset for insertion child: ${offset}`);
13282
+ assert(logger$4o, offset === 0, `invalid offset for insertion child: ${offset}`);
13300
13283
  const childOffset = 2;
13301
13284
  return {
13302
13285
  child,
@@ -13305,7 +13288,7 @@ var __publicField = (obj, key, value) => {
13305
13288
  };
13306
13289
  }
13307
13290
  if (isTextBlockContentBoxChild(child)) {
13308
- assert(logger$4p, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
13291
+ assert(logger$4o, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
13309
13292
  const childOffset = offset === 0 ? 1 : 2;
13310
13293
  return {
13311
13294
  child,
@@ -13314,17 +13297,17 @@ var __publicField = (obj, key, value) => {
13314
13297
  };
13315
13298
  }
13316
13299
  const textNode = child.firstChild;
13317
- assert(logger$4p, textNode, "no child node for text child");
13318
- assert(logger$4p, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
13300
+ assert(logger$4o, textNode, "no child node for text child");
13301
+ assert(logger$4o, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
13319
13302
  if (textNode instanceof HTMLBRElement) {
13320
- assert(logger$4p, offset >= 0 && offset <= 0, "invalid offset for text child");
13303
+ assert(logger$4o, offset >= 0 && offset <= 0, "invalid offset for text child");
13321
13304
  return {
13322
13305
  child,
13323
13306
  container: textNode,
13324
13307
  offset
13325
13308
  };
13326
13309
  }
13327
- assert(logger$4p, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
13310
+ assert(logger$4o, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
13328
13311
  return {
13329
13312
  child,
13330
13313
  container: textNode,
@@ -13353,38 +13336,38 @@ var __publicField = (obj, key, value) => {
13353
13336
  }
13354
13337
  start += childLength;
13355
13338
  }
13356
- assert(logger$4p, false, "failed to get range info");
13339
+ assert(logger$4o, false, "failed to get range info");
13357
13340
  }
13358
13341
  function createChildRange(child, start, end) {
13359
13342
  if (start === end) {
13360
- assert(logger$4p, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
13343
+ assert(logger$4o, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
13361
13344
  } else {
13362
- assert(logger$4p, start < end, `invalid start & end: ${start}, ${end}`);
13345
+ assert(logger$4o, start < end, `invalid start & end: ${start}, ${end}`);
13363
13346
  }
13364
13347
  if (isTextBlockContentInsertionChild(child)) {
13365
- assert(logger$4p, start === end, `invalid insertion child range offset: ${start}, ${end}`);
13366
- assert(logger$4p, start === 0, `invalid insertion child range start: ${start}`);
13348
+ assert(logger$4o, start === end, `invalid insertion child range offset: ${start}, ${end}`);
13349
+ assert(logger$4o, start === 0, `invalid insertion child range start: ${start}`);
13367
13350
  const insertionElem = child;
13368
- assert(logger$4p, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
13351
+ assert(logger$4o, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
13369
13352
  const range = createExpandedRange(insertionElem, 1, insertionElem, 2);
13370
13353
  return range;
13371
13354
  }
13372
13355
  if (isTextBlockContentBoxChild(child)) {
13373
- assert(logger$4p, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
13374
- assert(logger$4p, start === 0, `invalid box child range start: ${start}`);
13356
+ assert(logger$4o, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
13357
+ assert(logger$4o, start === 0, `invalid box child range start: ${start}`);
13375
13358
  const box = child;
13376
- assert(logger$4p, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
13359
+ assert(logger$4o, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
13377
13360
  const range = createExpandedRange(box, 1, box, 2);
13378
13361
  return range;
13379
13362
  }
13380
13363
  const length = getTextBlockContentChildTextLength(child);
13381
- assert(logger$4p, end <= length, `invalid child end: ${end}, ${length}`);
13364
+ assert(logger$4o, end <= length, `invalid child end: ${end}, ${length}`);
13382
13365
  const textNode = child.firstChild;
13383
- assert(logger$4p, textNode instanceof Text, "invalid block text child");
13384
- assert(logger$4p, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
13366
+ assert(logger$4o, textNode instanceof Text, "invalid block text child");
13367
+ assert(logger$4o, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
13385
13368
  return createExpandedRange(textNode, start, textNode, end);
13386
13369
  }
13387
- const logger$4o = getLogger("caret-rect");
13370
+ const logger$4n = getLogger("caret-rect");
13388
13371
  function getChildClientRects(block, child) {
13389
13372
  if (isBox(child)) {
13390
13373
  const box = child;
@@ -13393,7 +13376,7 @@ var __publicField = (obj, key, value) => {
13393
13376
  const blockContent = getBlockContent(block);
13394
13377
  const lineHeight = Number.parseFloat(window.getComputedStyle(blockContent).lineHeight) || boxContent.getBoundingClientRect().height;
13395
13378
  const rects = Array.from(boxContent.getClientRects());
13396
- assert(logger$4o, rects.length > 0, "no box client rects");
13379
+ assert(logger$4n, rects.length > 0, "no box client rects");
13397
13380
  const blockRect = blockContent.getBoundingClientRect();
13398
13381
  const firstRect = rects[0];
13399
13382
  const lastRect = new DOMRect(blockRect.left, firstRect.bottom, 1, lineHeight);
@@ -13413,22 +13396,22 @@ var __publicField = (obj, key, value) => {
13413
13396
  const rect2 = getLastClientRect(ranges[0].child);
13414
13397
  return new DOMRect(rect2.right, rect2.top, 1, rect2.height);
13415
13398
  }
13416
- assert(logger$4o, ranges[1], "invalid ranges");
13399
+ assert(logger$4n, ranges[1], "invalid ranges");
13417
13400
  const rect = getFirstClientRect(ranges[1].child);
13418
13401
  return new DOMRect(rect.left, rect.top, 1, rect.height);
13419
13402
  }
13420
13403
  let rangeInfo = ranges[0];
13421
- assert(logger$4o, ranges.length >= 1, "failed to get block range");
13404
+ assert(logger$4n, ranges.length >= 1, "failed to get block range");
13422
13405
  if (ranges.length === 1) {
13423
13406
  rangeInfo = ranges[0];
13424
13407
  } else {
13425
- assert(logger$4o, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
13408
+ assert(logger$4n, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
13426
13409
  if (isTextBlockContentInsertionChild(ranges[ranges.length - 1].child)) {
13427
13410
  rangeInfo = ranges[ranges.length - 1];
13428
13411
  const child = rangeInfo.child;
13429
13412
  const content = getInsertionContent(child);
13430
13413
  const rects2 = content.getClientRects();
13431
- assert(logger$4o, rects2.length >= 1, "no client rects for box content");
13414
+ assert(logger$4n, rects2.length >= 1, "no client rects for box content");
13432
13415
  const rect = rects2[rects2.length - 1];
13433
13416
  return new DOMRect(rect.right, rect.y, 1, rect.height);
13434
13417
  }
@@ -13445,9 +13428,9 @@ var __publicField = (obj, key, value) => {
13445
13428
  }
13446
13429
  }
13447
13430
  if (rangeInfo.container instanceof HTMLBRElement) {
13448
- assert(logger$4o, pos.offset === 0, "invalid offset for empty block text");
13431
+ assert(logger$4n, pos.offset === 0, "invalid offset for empty block text");
13449
13432
  const parent = rangeInfo.container.parentElement;
13450
- assert(logger$4o, parent, "invalid br parent");
13433
+ assert(logger$4n, parent, "invalid br parent");
13451
13434
  const rect = parent.getBoundingClientRect();
13452
13435
  const ret = new DOMRect(rect.left, rect.top, 1, rect.height);
13453
13436
  return ret;
@@ -13455,11 +13438,11 @@ var __publicField = (obj, key, value) => {
13455
13438
  const range = createRange(rangeInfo.container, rangeInfo.offset);
13456
13439
  const rects = Array.from(range.getClientRects());
13457
13440
  if (rects.length === 0) {
13458
- assert(logger$4o, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
13459
- assert(logger$4o, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
13441
+ assert(logger$4n, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
13442
+ assert(logger$4n, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
13460
13443
  const child = rangeInfo.child;
13461
13444
  const rects2 = getChildClientRects(block, child);
13462
- assert(logger$4o, rects2.length >= 1, "no client rects for box content");
13445
+ assert(logger$4n, rects2.length >= 1, "no client rects for box content");
13463
13446
  if (rangeInfo.offset === 1) {
13464
13447
  const rect2 = rects2[0];
13465
13448
  return new DOMRect(rect2.x, rect2.y, 1, rect2.height);
@@ -13505,7 +13488,7 @@ var __publicField = (obj, key, value) => {
13505
13488
  });
13506
13489
  }
13507
13490
  }
13508
- assert(logger$4o, rects.length > 0, "no client rects for range");
13491
+ assert(logger$4n, rects.length > 0, "no client rects for range");
13509
13492
  if (pos.type === "home") {
13510
13493
  return rects[rects.length - 1];
13511
13494
  }
@@ -13585,13 +13568,13 @@ var __publicField = (obj, key, value) => {
13585
13568
  };
13586
13569
  }
13587
13570
  }
13588
- const logger$4n = getLogger("selection-range");
13571
+ const logger$4m = getLogger("selection-range");
13589
13572
  function createEditorSelectionRange(editor, options) {
13590
13573
  const { anchor: anchor2, focus } = options;
13591
13574
  if (anchor2 instanceof EditorSimpleBlockPosition && focus instanceof EditorSimpleBlockPosition) {
13592
13575
  return new EditorSimpleSelectionRange(editor, { anchor: anchor2, focus });
13593
13576
  }
13594
- assert(logger$4n, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
13577
+ assert(logger$4m, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
13595
13578
  return new EditorComplexSelectionRange(editor, { anchor: anchor2, focus });
13596
13579
  }
13597
13580
  function createBlockSimpleRange(editor, block, anchor2, focus) {
@@ -13613,7 +13596,7 @@ var __publicField = (obj, key, value) => {
13613
13596
  const focus = createSimpleBlockPosition(range.focus.blockId, range.focus.offset, "normal");
13614
13597
  return createEditorSelectionRange(editor, { anchor: anchor2, focus });
13615
13598
  }
13616
- const logger$4m = getLogger("range-from-point");
13599
+ const logger$4l = getLogger("range-from-point");
13617
13600
  function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
13618
13601
  const yOffsets = [0, -12, 12];
13619
13602
  let x = pointX;
@@ -13645,7 +13628,7 @@ var __publicField = (obj, key, value) => {
13645
13628
  const rect = elem.getBoundingClientRect();
13646
13629
  if (rect.width && rect.top && i === 0) {
13647
13630
  if (rect.left + rect.width < x || rect.top + rect.height < y) {
13648
- logger$4m.debug("click on scrollbar, out of element rect");
13631
+ logger$4l.debug("click on scrollbar, out of element rect");
13649
13632
  return null;
13650
13633
  }
13651
13634
  }
@@ -13683,7 +13666,7 @@ var __publicField = (obj, key, value) => {
13683
13666
  let block = getLastChildBlock(container);
13684
13667
  if (!isVisibleBlock(block)) {
13685
13668
  const preBlock = getPrevVisibleBlock(block);
13686
- assert(logger$4m, preBlock, "container must have visible block");
13669
+ assert(logger$4l, preBlock, "container must have visible block");
13687
13670
  block = preBlock;
13688
13671
  }
13689
13672
  const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, block.getBoundingClientRect().bottom - 4);
@@ -13702,7 +13685,7 @@ var __publicField = (obj, key, value) => {
13702
13685
  if (range instanceof EditorSimpleSelectionRange) {
13703
13686
  return range;
13704
13687
  }
13705
- assert(logger$4m, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
13688
+ assert(logger$4l, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
13706
13689
  const complexRange = range;
13707
13690
  const container2 = editor.getContainerById(complexRange.start.childContainerId);
13708
13691
  return getRangeInContainer(editor, container2, x, y);
@@ -13725,7 +13708,7 @@ var __publicField = (obj, key, value) => {
13725
13708
  });
13726
13709
  return getRangeInContainer(editor, container, x, y);
13727
13710
  }
13728
- const logger$4l = getLogger("adjust-selection-pos");
13711
+ const logger$4k = getLogger("adjust-selection-pos");
13729
13712
  function getParentContainers(block) {
13730
13713
  const containers = [];
13731
13714
  while (block) {
@@ -13735,10 +13718,10 @@ var __publicField = (obj, key, value) => {
13735
13718
  return containers;
13736
13719
  }
13737
13720
  const newBlock = getParentBlock(container);
13738
- assert(logger$4l, newBlock, "child container has not parent container");
13721
+ assert(logger$4k, newBlock, "child container has not parent container");
13739
13722
  block = newBlock;
13740
13723
  }
13741
- assert(logger$4l, false, "should not come here: getParentContainers");
13724
+ assert(logger$4k, false, "should not come here: getParentContainers");
13742
13725
  }
13743
13726
  function getParentBlockInContainer(container, block) {
13744
13727
  while (block) {
@@ -13747,16 +13730,16 @@ var __publicField = (obj, key, value) => {
13747
13730
  return block;
13748
13731
  }
13749
13732
  const newBlock = getParentBlock(parent);
13750
- assert(logger$4l, newBlock, "could not find parent block for a child container");
13733
+ assert(logger$4k, newBlock, "could not find parent block for a child container");
13751
13734
  block = newBlock;
13752
13735
  }
13753
- assert(logger$4l, false, "no parent block in specified container");
13736
+ assert(logger$4k, false, "no parent block in specified container");
13754
13737
  }
13755
13738
  function getClosestParentBlock(block1, block2) {
13756
13739
  const containers1 = getParentContainers(block1);
13757
13740
  const containers2 = getParentContainers(block2);
13758
- assert(logger$4l, containers1.length > 0 && containers2.length > 0, "block has not parent container");
13759
- assert(logger$4l, containers1[0] === containers2[0], "root container does not equal");
13741
+ assert(logger$4k, containers1.length > 0 && containers2.length > 0, "block has not parent container");
13742
+ assert(logger$4k, containers1[0] === containers2[0], "root container does not equal");
13760
13743
  let parentContainer = containers1[0];
13761
13744
  for (let i = 1; i < containers1.length || containers2.length; i++) {
13762
13745
  if (containers1[i] === containers2[i]) {
@@ -13775,23 +13758,23 @@ var __publicField = (obj, key, value) => {
13775
13758
  }
13776
13759
  function getParentContainerInComplexBlock(parentComplexBlock, element) {
13777
13760
  let block = getParentBlock(element);
13778
- assert(logger$4l, block, "element is not in a block");
13761
+ assert(logger$4k, block, "element is not in a block");
13779
13762
  while (block) {
13780
13763
  const container = getParentContainer(block);
13781
- assert(logger$4l, isChildContainer(container), "not a child container");
13764
+ assert(logger$4k, isChildContainer(container), "not a child container");
13782
13765
  const parentBlock = getParentBlock(container);
13783
- assert(logger$4l, parentBlock, "child container has not parent block");
13766
+ assert(logger$4k, parentBlock, "child container has not parent block");
13784
13767
  if (parentBlock === parentComplexBlock) {
13785
13768
  return container;
13786
13769
  }
13787
13770
  block = parentBlock;
13788
13771
  }
13789
- assert(logger$4l, false, "failed to find parent container in complex block");
13772
+ assert(logger$4k, false, "failed to find parent container in complex block");
13790
13773
  }
13791
13774
  function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
13792
13775
  const blockId = getBlockId(complexBlock);
13793
- assert(logger$4l, blockId === anchor2.blockId, "invalid start pos");
13794
- assert(logger$4l, blockId === focus.blockId, "invalid end pos");
13776
+ assert(logger$4k, blockId === anchor2.blockId, "invalid start pos");
13777
+ assert(logger$4k, blockId === focus.blockId, "invalid end pos");
13795
13778
  const blockClass = getComplexBlockClass(editor, complexBlock);
13796
13779
  if (blockClass.adjustSelectionPos) {
13797
13780
  return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
@@ -13825,8 +13808,8 @@ var __publicField = (obj, key, value) => {
13825
13808
  if (focus instanceof EditorComplexBlockPosition) {
13826
13809
  focus = createSimpleBlockPosition(focusBlock, getBlockTextLength$6(editor, focusBlock), "end");
13827
13810
  }
13828
- assert(logger$4l, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
13829
- assert(logger$4l, focus instanceof EditorSimpleBlockPosition, "not valid position type");
13811
+ assert(logger$4k, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
13812
+ assert(logger$4k, focus instanceof EditorSimpleBlockPosition, "not valid position type");
13830
13813
  return {
13831
13814
  anchor: anchor2,
13832
13815
  focus
@@ -13880,7 +13863,7 @@ var __publicField = (obj, key, value) => {
13880
13863
  focus
13881
13864
  };
13882
13865
  }
13883
- const logger$4k = getLogger("core");
13866
+ const logger$4j = getLogger("core");
13884
13867
  function createBlockAnchor(editor, block, id, refClientRect) {
13885
13868
  const tools = getBlockTools(block);
13886
13869
  let elem = tools.querySelector(`.block-anchor[data-id=${id}]`);
@@ -13898,7 +13881,7 @@ var __publicField = (obj, key, value) => {
13898
13881
  return elem;
13899
13882
  }
13900
13883
  function createBlockCaretAnchor(editor, block, offset, id) {
13901
- assert(logger$4k, isTextKindBlock(editor, block), "not a text kind block");
13884
+ assert(logger$4j, isTextKindBlock(editor, block), "not a text kind block");
13902
13885
  const caretRect = getTextCaretRect(block, createSimpleBlockPosition(block, offset, "normal"));
13903
13886
  const blockRect = block.getBoundingClientRect();
13904
13887
  const tools = getBlockTools(block);
@@ -14257,19 +14240,19 @@ var __publicField = (obj, key, value) => {
14257
14240
  return result + (index2 ? "-" : "") + word.toLowerCase();
14258
14241
  });
14259
14242
  const kebabCase$1 = kebabCase;
14260
- const logger$4j = getLogger("box");
14243
+ const logger$4i = getLogger("box");
14261
14244
  function isBoxOp(op) {
14262
14245
  if (!op.attributes)
14263
14246
  return false;
14264
14247
  if (!op.attributes.box)
14265
14248
  return false;
14266
- assert(logger$4j, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
14267
- assert(logger$4j, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
14249
+ assert(logger$4i, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
14250
+ assert(logger$4i, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
14268
14251
  return true;
14269
14252
  }
14270
- const logger$4i = getLogger("text-op");
14253
+ const logger$4h = getLogger("text-op");
14271
14254
  function getOpLength(op) {
14272
- assert(logger$4i, typeof op.insert === "string", "invalid op, no insert");
14255
+ assert(logger$4h, typeof op.insert === "string", "invalid op, no insert");
14273
14256
  return op.insert.length;
14274
14257
  }
14275
14258
  function getOpAt(text2, offset) {
@@ -14277,7 +14260,7 @@ var __publicField = (obj, key, value) => {
14277
14260
  let pos = 0;
14278
14261
  for (let i = 0; i < ops.length; i++) {
14279
14262
  const op = ops[i];
14280
- assert(logger$4i, typeof op.insert === "string", "invalid text op, no insert");
14263
+ assert(logger$4h, typeof op.insert === "string", "invalid text op, no insert");
14281
14264
  const end = pos + getOpLength(op);
14282
14265
  if (end > offset) {
14283
14266
  return [op];
@@ -14293,22 +14276,22 @@ var __publicField = (obj, key, value) => {
14293
14276
  }
14294
14277
  return [];
14295
14278
  }
14296
- const logger$4h = getLogger("rich-text-length");
14279
+ const logger$4g = getLogger("rich-text-length");
14297
14280
  function getTextOpLength(op) {
14298
- assert(logger$4h, typeof op.insert === "string", "op.insert is not string");
14281
+ assert(logger$4g, typeof op.insert === "string", "op.insert is not string");
14299
14282
  return op.insert.length;
14300
14283
  }
14301
14284
  function getTextLength(ops) {
14302
14285
  let count = 0;
14303
14286
  ops.forEach((op) => {
14304
14287
  if (op.insert) {
14305
- assert(logger$4h, typeof op.insert === "string", "op.insert is not string");
14288
+ assert(logger$4g, typeof op.insert === "string", "op.insert is not string");
14306
14289
  count += getTextOpLength(op);
14307
14290
  }
14308
14291
  });
14309
14292
  return count;
14310
14293
  }
14311
- const logger$4g = getLogger("split-text");
14294
+ const logger$4f = getLogger("split-text");
14312
14295
  function splitText(ops, offset, splitResult) {
14313
14296
  ops = cloneDeep__default.default(ops);
14314
14297
  if (offset === 0) {
@@ -14326,8 +14309,8 @@ var __publicField = (obj, key, value) => {
14326
14309
  let counted = 0;
14327
14310
  for (let i = 0; i < ops.length; i++) {
14328
14311
  const op = ops[i];
14329
- assert(logger$4g, typeof op === "object", `invalid op type, ${typeof op}`);
14330
- assert(logger$4g, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
14312
+ assert(logger$4f, typeof op === "object", `invalid op type, ${typeof op}`);
14313
+ assert(logger$4f, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
14331
14314
  const subLen = getTextOpLength(op);
14332
14315
  if (counted + subLen < offset) {
14333
14316
  counted += subLen;
@@ -14337,18 +14320,18 @@ var __publicField = (obj, key, value) => {
14337
14320
  right: ops.slice(i + 1)
14338
14321
  };
14339
14322
  } else {
14340
- assert(logger$4g, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
14323
+ assert(logger$4f, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
14341
14324
  const splitIndex = offset - counted;
14342
14325
  const copied = cloneDeep__default.default(op);
14343
- assert(logger$4g, copied.insert, "no copied.insert");
14344
- assert(logger$4g, typeof copied.insert === "string", "invalid copied.insert type");
14326
+ assert(logger$4f, copied.insert, "no copied.insert");
14327
+ assert(logger$4f, typeof copied.insert === "string", "invalid copied.insert type");
14345
14328
  copied.insert = copied.insert.substr(0, splitIndex);
14346
14329
  op.insert = op.insert.substr(splitIndex);
14347
14330
  if (copied.insert === "") {
14348
- assert(logger$4g, false, "invalid copied.insert, is empty string");
14331
+ assert(logger$4f, false, "invalid copied.insert, is empty string");
14349
14332
  }
14350
14333
  if (op.insert === "") {
14351
- assert(logger$4g, false, "invalid op.insert, is empty string");
14334
+ assert(logger$4f, false, "invalid op.insert, is empty string");
14352
14335
  }
14353
14336
  const right = [
14354
14337
  op,
@@ -14367,9 +14350,9 @@ var __publicField = (obj, key, value) => {
14367
14350
  throw new Error(`invalid split offset: ${offset}, ${JSON.stringify(ops)}`);
14368
14351
  }
14369
14352
  function splitToThree(text2, offset, length) {
14370
- assert(logger$4g, offset >= 0, "invalid offset, < 0");
14371
- assert(logger$4g, length > 0, "invalid length, <= 0");
14372
- assert(logger$4g, offset + length <= getTextLength(text2), "invalid offset + length < text length");
14353
+ assert(logger$4f, offset >= 0, "invalid offset, < 0");
14354
+ assert(logger$4f, length > 0, "invalid length, <= 0");
14355
+ assert(logger$4f, offset + length <= getTextLength(text2), "invalid offset + length < text length");
14373
14356
  const { left: temp, right } = splitText(text2, offset + length);
14374
14357
  const { left, right: middle } = splitText(temp, offset);
14375
14358
  return { left, middle, right };
@@ -14592,9 +14575,9 @@ var __publicField = (obj, key, value) => {
14592
14575
  }
14593
14576
  return [color, backgroundColor];
14594
14577
  }
14595
- const logger$4f = getLogger("text-block-content");
14578
+ const logger$4e = getLogger("text-block-content");
14596
14579
  function updateBlockContentCore(editor, blockPath, content, blockText, insertions) {
14597
- assert(logger$4f, blockText, "no text for block");
14580
+ assert(logger$4e, blockText, "no text for block");
14598
14581
  if (blockText.length === 0 && (!insertions || insertions.size === 0)) {
14599
14582
  content.innerHTML = "<span><br></span>";
14600
14583
  return;
@@ -14626,9 +14609,9 @@ var __publicField = (obj, key, value) => {
14626
14609
  for (let i2 = 0; i2 < text2.length; i2++) {
14627
14610
  const op = text2[i2];
14628
14611
  if (isBoxOp(op)) {
14629
- assert(logger$4f, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
14612
+ assert(logger$4e, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
14630
14613
  const span2 = editor.editorBoxes.createBox(content, op.attributes);
14631
- assert(logger$4f, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
14614
+ assert(logger$4e, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
14632
14615
  const ret = editor.editorBlockRenders.renderBox(blockPath, op.attributes);
14633
14616
  if (ret.classes) {
14634
14617
  addClass(span2, ...ret.classes);
@@ -14646,7 +14629,7 @@ var __publicField = (obj, key, value) => {
14646
14629
  fragment.appendChild(span2);
14647
14630
  continue;
14648
14631
  }
14649
- assert(logger$4f, op.insert, `no insert in op: ${JSON.stringify(op)}`);
14632
+ assert(logger$4e, op.insert, `no insert in op: ${JSON.stringify(op)}`);
14650
14633
  const span = createElement("span", ["text"], fragment, op.insert);
14651
14634
  if (op.attributes) {
14652
14635
  const ret = editor.editorBlockRenders.renderText(blockPath, op.attributes);
@@ -14677,7 +14660,7 @@ var __publicField = (obj, key, value) => {
14677
14660
  const compositionText = editor.compositingText;
14678
14661
  if (compositionText) {
14679
14662
  const pos = editor.selection.range.start;
14680
- assert(logger$4f, pos.isSimple(), "not an simple position while compositing");
14663
+ assert(logger$4e, pos.isSimple(), "not an simple position while compositing");
14681
14664
  if (pos.blockId === blockId) {
14682
14665
  const attributes = getAttributesAt(text2, 0);
14683
14666
  insertions.set(pos.offset, [{
@@ -14693,11 +14676,11 @@ var __publicField = (obj, key, value) => {
14693
14676
  function clearAllTempCompositionText(editor) {
14694
14677
  const children = editor.rootContainer.querySelectorAll('span[data-type="editor-insertion"].inputting-insertion');
14695
14678
  if (children.length) {
14696
- logger$4f.debug(`remove ${children.length} temp composition span`);
14679
+ logger$4e.debug(`remove ${children.length} temp composition span`);
14697
14680
  }
14698
14681
  Array.from(children).forEach((c) => c.remove());
14699
14682
  }
14700
- const logger$4e = getLogger("client-rects");
14683
+ const logger$4d = getLogger("client-rects");
14701
14684
  function getChildrenOffsets(block) {
14702
14685
  const children = getTextBlockContentChildren(block);
14703
14686
  let start = 0;
@@ -14715,15 +14698,15 @@ var __publicField = (obj, key, value) => {
14715
14698
  return ret;
14716
14699
  }
14717
14700
  function getChildrenInRange(editor, block, from, to) {
14718
- assert(logger$4e, from < to, `invalid from & to: ${from}, ${to}`);
14701
+ assert(logger$4d, from < to, `invalid from & to: ${from}, ${to}`);
14719
14702
  const blockLength = getBlockTextLength$6(editor, block);
14720
- assert(logger$4e, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
14703
+ assert(logger$4d, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
14721
14704
  const offsets = getChildrenOffsets(block);
14722
14705
  const startIndex = offsets.findIndex((c) => c.startBlockOffset <= from && from < c.endBlockOffset);
14723
14706
  const endIndex = offsets.findIndex((c) => c.startBlockOffset < to && to <= c.endBlockOffset);
14724
- assert(logger$4e, startIndex !== -1, "failed to find start child");
14725
- assert(logger$4e, endIndex !== -1, "failed to find end child");
14726
- assert(logger$4e, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
14707
+ assert(logger$4d, startIndex !== -1, "failed to find start child");
14708
+ assert(logger$4d, endIndex !== -1, "failed to find end child");
14709
+ assert(logger$4d, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
14727
14710
  if (startIndex === endIndex) {
14728
14711
  const child = offsets[startIndex];
14729
14712
  return [{
@@ -14805,16 +14788,16 @@ var __publicField = (obj, key, value) => {
14805
14788
  return rects;
14806
14789
  }
14807
14790
  function getRangeClientRects(editor, block, range) {
14808
- assert(logger$4e, range instanceof EditorSimpleSelectionRange, "invalid range");
14791
+ assert(logger$4d, range instanceof EditorSimpleSelectionRange, "invalid range");
14809
14792
  const start = range.start;
14810
14793
  const end = range.end;
14811
- assert(logger$4e, start.isSimple(), "text block only allow simple position");
14812
- assert(logger$4e, end.isSimple(), "text block only allow simple position");
14813
- assert(logger$4e, start.blockId === end.blockId, "only allow update one text block selection");
14814
- assert(logger$4e, start.blockId === getBlockId(block), "only allow update one text block selection");
14794
+ assert(logger$4d, start.isSimple(), "text block only allow simple position");
14795
+ assert(logger$4d, end.isSimple(), "text block only allow simple position");
14796
+ assert(logger$4d, start.blockId === end.blockId, "only allow update one text block selection");
14797
+ assert(logger$4d, start.blockId === getBlockId(block), "only allow update one text block selection");
14815
14798
  return getClientRects$2(editor, block, start, end);
14816
14799
  }
14817
- const logger$4d = getLogger("selection-background");
14800
+ const logger$4c = getLogger("selection-background");
14818
14801
  function getLineHeight(elem) {
14819
14802
  const style2 = window.getComputedStyle(elem);
14820
14803
  const lineHeightStyle = style2.getPropertyValue("line-height");
@@ -14834,9 +14817,9 @@ var __publicField = (obj, key, value) => {
14834
14817
  return lineHeight;
14835
14818
  }
14836
14819
  function updateSelection$4(editor, block, start, end) {
14837
- assert(logger$4d, start.isSimple(), "text block only allow simple position");
14838
- assert(logger$4d, end.isSimple(), "text block only allow simple position");
14839
- assert(logger$4d, start.blockId === end.blockId, "only allow update one text block selection");
14820
+ assert(logger$4c, start.isSimple(), "text block only allow simple position");
14821
+ assert(logger$4c, end.isSimple(), "text block only allow simple position");
14822
+ assert(logger$4c, start.blockId === end.blockId, "only allow update one text block selection");
14840
14823
  const from = start.offset;
14841
14824
  const to = end.offset;
14842
14825
  if (from === to) {
@@ -14895,7 +14878,7 @@ var __publicField = (obj, key, value) => {
14895
14878
  }
14896
14879
  });
14897
14880
  }
14898
- const logger$4c = getLogger("line-breaker");
14881
+ const logger$4b = getLogger("line-breaker");
14899
14882
  function mergeTextRects(rects) {
14900
14883
  const result = [];
14901
14884
  let lastRect = null;
@@ -15022,7 +15005,7 @@ var __publicField = (obj, key, value) => {
15022
15005
  }
15023
15006
  const textChild = child;
15024
15007
  const rects = mergeTextRects(textChild.getClientRects());
15025
- assert(logger$4c, rects.length > 0, "invalid text child dom");
15008
+ assert(logger$4b, rects.length > 0, "invalid text child dom");
15026
15009
  if (rects.length === 1) {
15027
15010
  const nextChild = children[i + 1];
15028
15011
  if (!nextChild) {
@@ -15047,10 +15030,10 @@ var __publicField = (obj, key, value) => {
15047
15030
  continue;
15048
15031
  }
15049
15032
  const textNode = textChild.firstChild;
15050
- assert(logger$4c, textNode, "invalid text child, no text node");
15051
- assert(logger$4c, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
15033
+ assert(logger$4b, textNode, "invalid text child, no text node");
15034
+ assert(logger$4b, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
15052
15035
  const textChildLength = getTextBlockContentChildTextLength(textChild);
15053
- assert(logger$4c, textNode.data.length === textChildLength, "text node data length not equal child text length");
15036
+ assert(logger$4b, textNode.data.length === textChildLength, "text node data length not equal child text length");
15054
15037
  const textRects = getTextRects(textNode);
15055
15038
  for (let rIndex = 0; rIndex < textRects.length - 1; rIndex++) {
15056
15039
  const rect = textRects[rIndex];
@@ -15092,7 +15075,7 @@ var __publicField = (obj, key, value) => {
15092
15075
  }
15093
15076
  }
15094
15077
  }
15095
- assert(logger$4c, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
15078
+ assert(logger$4b, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
15096
15079
  return {
15097
15080
  lineIndex: lineBreaks.length,
15098
15081
  lineBreaks
@@ -23865,7 +23848,7 @@ var __publicField = (obj, key, value) => {
23865
23848
  const Graphemer_1 = __importDefault(Graphemer$1);
23866
23849
  var _default = lib$1.default = Graphemer_1.default;
23867
23850
  const splitter = new _default();
23868
- const logger$4b = getLogger("text-offset");
23851
+ const logger$4a = getLogger("text-offset");
23869
23852
  function getChildOffset(block, child) {
23870
23853
  const children = getTextBlockContentChildren(block);
23871
23854
  let start = 0;
@@ -23881,26 +23864,26 @@ var __publicField = (obj, key, value) => {
23881
23864
  }
23882
23865
  start += testLength;
23883
23866
  }
23884
- assert(logger$4b, false, "can not find child in children");
23867
+ assert(logger$4a, false, "can not find child in children");
23885
23868
  }
23886
23869
  function isValidOffset(block, blockOffset) {
23887
- assert(logger$4b, blockOffset >= 0, `invalid offset: ${blockOffset}`);
23870
+ assert(logger$4a, blockOffset >= 0, `invalid offset: ${blockOffset}`);
23888
23871
  const childInfo = getTextBlockChild(block, blockOffset);
23889
23872
  const { prev, next: next2, offset } = childInfo;
23890
23873
  if (!prev && !next2) {
23891
- assert(logger$4b, false, "invalid offset, no prev & next child at offset");
23874
+ assert(logger$4a, false, "invalid offset, no prev & next child at offset");
23892
23875
  }
23893
23876
  if (prev !== next2) {
23894
23877
  return true;
23895
23878
  }
23896
23879
  const child = prev;
23897
- assert(logger$4b, child, "no child");
23880
+ assert(logger$4a, child, "no child");
23898
23881
  if (isTextBlockContentBoxChild(child)) {
23899
- assert(logger$4b, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
23882
+ assert(logger$4a, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
23900
23883
  return true;
23901
23884
  }
23902
23885
  const text2 = child.textContent;
23903
- assert(logger$4b, text2, "no content for text child");
23886
+ assert(logger$4a, text2, "no content for text child");
23904
23887
  const chars = splitter.splitGraphemes(text2);
23905
23888
  const validOffsets = /* @__PURE__ */ new Set();
23906
23889
  let start = 0;
@@ -23930,7 +23913,7 @@ var __publicField = (obj, key, value) => {
23930
23913
  }
23931
23914
  function getNextValidOffset(block, blockOffset) {
23932
23915
  const length = getTextBlockLength(block);
23933
- assert(logger$4b, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
23916
+ assert(logger$4a, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
23934
23917
  if (blockOffset === length) {
23935
23918
  return length;
23936
23919
  }
@@ -23944,7 +23927,7 @@ var __publicField = (obj, key, value) => {
23944
23927
  }
23945
23928
  return ret;
23946
23929
  }
23947
- const logger$4a = getLogger("line-offset");
23930
+ const logger$49 = getLogger("line-offset");
23948
23931
  function getLineOffsets(block) {
23949
23932
  const lineBreaks = getLineBreaks(block);
23950
23933
  const ret = [];
@@ -23965,7 +23948,7 @@ var __publicField = (obj, key, value) => {
23965
23948
  }
23966
23949
  function getLineOffset(block, lineIndex) {
23967
23950
  const lines = getLineOffsets(block);
23968
- assert(logger$4a, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
23951
+ assert(logger$49, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
23969
23952
  return lines[lineIndex];
23970
23953
  }
23971
23954
  function getLineOffsetByPos(block, pos) {
@@ -24022,7 +24005,7 @@ var __publicField = (obj, key, value) => {
24022
24005
  function getLineCount(block) {
24023
24006
  return getLineOffsets(block).length;
24024
24007
  }
24025
- const logger$49 = getLogger("find-text-position");
24008
+ const logger$48 = getLogger("find-text-position");
24026
24009
  function isWrappedLine(block, lineIndex) {
24027
24010
  const { start, end } = getLineOffset(block, lineIndex);
24028
24011
  const blockId = getBlockId(block);
@@ -24033,13 +24016,13 @@ var __publicField = (obj, key, value) => {
24033
24016
  return false;
24034
24017
  }
24035
24018
  const childInfo = getTextBlockChild(block, start);
24036
- assert(logger$49, childInfo.next, "no next child at offset");
24037
- assert(logger$49, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
24019
+ assert(logger$48, childInfo.next, "no next child at offset");
24020
+ assert(logger$48, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
24038
24021
  return true;
24039
24022
  }
24040
24023
  function getWrappedLineOffsets(block, lineIndex) {
24041
24024
  const blockId = getBlockId(block);
24042
- assert(logger$49, isWrappedLine(block, lineIndex), "line is not wrapped");
24025
+ assert(logger$48, isWrappedLine(block, lineIndex), "line is not wrapped");
24043
24026
  const { start, end } = getLineOffset(block, lineIndex);
24044
24027
  const homePos = createSimpleBlockPosition(blockId, start, "home");
24045
24028
  for (let offset = start + 1; offset <= end; offset += 1) {
@@ -24054,11 +24037,11 @@ var __publicField = (obj, key, value) => {
24054
24037
  return offset - 1;
24055
24038
  }
24056
24039
  }
24057
- assert(logger$49, false, "failed to find wrapped offset");
24040
+ assert(logger$48, false, "failed to find wrapped offset");
24058
24041
  return 0;
24059
24042
  }
24060
24043
  function findTextPositionInLine(editor, block, lineIndex, sourceBlock, pos, findDirection, suggestedX) {
24061
- assert(logger$49, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
24044
+ assert(logger$48, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
24062
24045
  const { start, end } = getLineOffset(block, lineIndex);
24063
24046
  let from = start;
24064
24047
  const blockId = getBlockId(block);
@@ -24100,11 +24083,11 @@ var __publicField = (obj, key, value) => {
24100
24083
  return retPos;
24101
24084
  }
24102
24085
  function findPrevTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
24103
- assert(logger$49, isTextKindBlock(editor, block), "not a text block");
24086
+ assert(logger$48, isTextKindBlock(editor, block), "not a text block");
24104
24087
  return findTextPositionInLine(editor, block, getLineCount(block) - 1, sourceBlock, pos, "up", suggestedX);
24105
24088
  }
24106
24089
  function findNextTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
24107
- assert(logger$49, isTextKindBlock(editor, block), "not a text block");
24090
+ assert(logger$48, isTextKindBlock(editor, block), "not a text block");
24108
24091
  return findTextPositionInLine(editor, block, 0, sourceBlock, pos, "down", suggestedX);
24109
24092
  }
24110
24093
  function moveDown(editor, block, position, suggestedX) {
@@ -24212,7 +24195,7 @@ var __publicField = (obj, key, value) => {
24212
24195
  }
24213
24196
  return pos;
24214
24197
  }
24215
- const logger$48 = getLogger("move-caret");
24198
+ const logger$47 = getLogger("move-caret");
24216
24199
  function moveTextCaret(editor, block, position, direction) {
24217
24200
  if (direction === "ArrowLeft") {
24218
24201
  const ret = moveLeft(block, position);
@@ -24242,9 +24225,9 @@ var __publicField = (obj, key, value) => {
24242
24225
  }
24243
24226
  return createSimpleBlockPosition(getBlockId(block), ret.offset, ret.type);
24244
24227
  }
24245
- assert(logger$48, false, `invalid navigation direction: ${direction}`);
24228
+ assert(logger$47, false, `invalid navigation direction: ${direction}`);
24246
24229
  }
24247
- const logger$47 = getLogger("text-range");
24230
+ const logger$46 = getLogger("text-range");
24248
24231
  function getBlockRects(block) {
24249
24232
  const ret = [];
24250
24233
  const children = getTextBlockContentChildren(block);
@@ -24302,9 +24285,9 @@ var __publicField = (obj, key, value) => {
24302
24285
  return null;
24303
24286
  }
24304
24287
  const children = getTextBlockContentChildren(block);
24305
- assert(logger$47, children.indexOf(child) !== -1, "failed to find child in children");
24288
+ assert(logger$46, children.indexOf(child) !== -1, "failed to find child in children");
24306
24289
  const offsetInfo = getChildOffset(block, child);
24307
- assert(logger$47, offsetInfo, "failed to get child offset");
24290
+ assert(logger$46, offsetInfo, "failed to get child offset");
24308
24291
  const { start } = offsetInfo;
24309
24292
  let offset;
24310
24293
  let length;
@@ -24320,7 +24303,7 @@ var __publicField = (obj, key, value) => {
24320
24303
  }
24321
24304
  length = 0;
24322
24305
  } else {
24323
- assert(logger$47, child.firstChild instanceof Text, "child is not text");
24306
+ assert(logger$46, child.firstChild instanceof Text, "child is not text");
24324
24307
  offset = start + textNodeOffsetFromPoint(child.firstChild, x, y);
24325
24308
  length = 0;
24326
24309
  }
@@ -24344,9 +24327,9 @@ var __publicField = (obj, key, value) => {
24344
24327
  }
24345
24328
  return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
24346
24329
  }
24347
- const logger$46 = getLogger("create-text-op");
24330
+ const logger$45 = getLogger("create-text-op");
24348
24331
  function createTextOp(text2, attributes) {
24349
- assert(logger$46, text2, "text is empty");
24332
+ assert(logger$45, text2, "text is empty");
24350
24333
  const ret = {
24351
24334
  insert: text2
24352
24335
  };
@@ -24369,7 +24352,7 @@ var __publicField = (obj, key, value) => {
24369
24352
  }
24370
24353
  return result;
24371
24354
  }
24372
- const logger$45 = getLogger("merge-ops");
24355
+ const logger$44 = getLogger("merge-ops");
24373
24356
  function mergeOps(text2) {
24374
24357
  if (text2.length <= 1) {
24375
24358
  return text2;
@@ -24391,10 +24374,10 @@ var __publicField = (obj, key, value) => {
24391
24374
  return false;
24392
24375
  }
24393
24376
  if (op1.attributes === void 0) {
24394
- assert(logger$45, op2.attributes === void 0, "op2.attributes is not undefined");
24377
+ assert(logger$44, op2.attributes === void 0, "op2.attributes is not undefined");
24395
24378
  return true;
24396
24379
  }
24397
- assert(logger$45, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
24380
+ assert(logger$44, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
24398
24381
  return isEqual__default.default(op1.attributes, op2.attributes);
24399
24382
  };
24400
24383
  const newOps = [];
@@ -24403,8 +24386,8 @@ var __publicField = (obj, key, value) => {
24403
24386
  for (let i = 1; i < text2.length; i += 1) {
24404
24387
  const op = text2[i];
24405
24388
  if (isSameTypeOp(before, op)) {
24406
- assert(logger$45, typeof before.insert === "string", "before.insert is not string");
24407
- assert(logger$45, typeof op.insert === "string", "op.insert is not string");
24389
+ assert(logger$44, typeof before.insert === "string", "before.insert is not string");
24390
+ assert(logger$44, typeof op.insert === "string", "op.insert is not string");
24408
24391
  before.insert += op.insert;
24409
24392
  } else {
24410
24393
  newOps.push(op);
@@ -24432,15 +24415,15 @@ var __publicField = (obj, key, value) => {
24432
24415
  }
24433
24416
  return text2.slice(0, i + 1);
24434
24417
  }
24435
- const logger$44 = getLogger("delete-text");
24418
+ const logger$43 = getLogger("delete-text");
24436
24419
  function deleteText(richText2, offset, count) {
24437
24420
  const { left, right } = splitToThree(richText2, offset, count);
24438
24421
  const result = [...left, ...right];
24439
24422
  return mergeOps(result);
24440
24423
  }
24441
24424
  function createDeleteOps(offset, count) {
24442
- assert(logger$44, offset >= 0, `invalid offset: ${offset}`);
24443
- assert(logger$44, count >= 1, `invalid delete count: ${count}`);
24425
+ assert(logger$43, offset >= 0, `invalid offset: ${offset}`);
24426
+ assert(logger$43, count >= 1, `invalid delete count: ${count}`);
24444
24427
  const ops = [];
24445
24428
  if (offset !== 0) {
24446
24429
  ops.push({
@@ -24452,7 +24435,7 @@ var __publicField = (obj, key, value) => {
24452
24435
  });
24453
24436
  return ops;
24454
24437
  }
24455
- const logger$43 = getLogger("delta");
24438
+ const logger$42 = getLogger("delta");
24456
24439
  function diffRichText(oldText, newText) {
24457
24440
  const delta1D = new Delta__default.default(oldText);
24458
24441
  const delta2D = new Delta__default.default(newText);
@@ -24462,7 +24445,7 @@ var __publicField = (obj, key, value) => {
24462
24445
  return new Delta__default.default(ops).transformPosition(cursor, !isLocalOp);
24463
24446
  }
24464
24447
  function isValidDocText(text2) {
24465
- assert(logger$43, text2, "ops is null or undefined");
24448
+ assert(logger$42, text2, "ops is null or undefined");
24466
24449
  for (let i = 0; i < text2.length; i++) {
24467
24450
  const op = text2[i];
24468
24451
  if (op.insert === null || op.insert === void 0) {
@@ -24482,7 +24465,7 @@ var __publicField = (obj, key, value) => {
24482
24465
  }
24483
24466
  class RichText {
24484
24467
  static ensureValidText(text2) {
24485
- assert(logger$43, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
24468
+ assert(logger$42, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
24486
24469
  }
24487
24470
  static diff(oldText, newText) {
24488
24471
  this.ensureValidText(oldText);
@@ -24504,9 +24487,9 @@ var __publicField = (obj, key, value) => {
24504
24487
  return resultText;
24505
24488
  }
24506
24489
  }
24507
- const logger$42 = getLogger("insert-text");
24490
+ const logger$41 = getLogger("insert-text");
24508
24491
  function insertText(richText2, offset, text2, attributes) {
24509
- assert(logger$42, text2, `invalid text to insert: ${text2}`);
24492
+ assert(logger$41, text2, `invalid text to insert: ${text2}`);
24510
24493
  const { left, right } = splitText(richText2, offset);
24511
24494
  const insertedText = typeof text2 === "string" ? [createTextOp(text2, attributes)] : text2;
24512
24495
  const result = [...left, ...insertedText, ...right];
@@ -24519,7 +24502,7 @@ var __publicField = (obj, key, value) => {
24519
24502
  };
24520
24503
  }
24521
24504
  function createInsertOps(offset, text2, attributes) {
24522
- assert(logger$42, offset >= 0, `invalid offset: ${offset}`);
24505
+ assert(logger$41, offset >= 0, `invalid offset: ${offset}`);
24523
24506
  if (text2.length === 0) {
24524
24507
  return [];
24525
24508
  }
@@ -24549,7 +24532,7 @@ var __publicField = (obj, key, value) => {
24549
24532
  function cloneText(text2) {
24550
24533
  return cloneDeep__default.default(text2);
24551
24534
  }
24552
- const logger$41 = getLogger("update-op-attribute");
24535
+ const logger$40 = getLogger("update-op-attribute");
24553
24536
  function updateOpAttributes(orgOps, key, value, newAttributes) {
24554
24537
  const ops = cloneText(orgOps);
24555
24538
  const index2 = ops.findIndex((op2) => {
@@ -24557,7 +24540,7 @@ var __publicField = (obj, key, value) => {
24557
24540
  return false;
24558
24541
  return op2.attributes[key] === value;
24559
24542
  });
24560
- assert(logger$41, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
24543
+ assert(logger$40, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
24561
24544
  const op = ops[index2];
24562
24545
  op.attributes = {
24563
24546
  ...op.attributes,
@@ -24639,11 +24622,11 @@ var __publicField = (obj, key, value) => {
24639
24622
  ]);
24640
24623
  }
24641
24624
  const FILL_CHAR = "\u200B";
24642
- const logger$40 = getLogger("to-plain-text");
24625
+ const logger$3$ = getLogger("to-plain-text");
24643
24626
  function toPlainText(ops, options) {
24644
24627
  let text2 = "";
24645
24628
  ops.forEach((op) => {
24646
- assert(logger$40, typeof op.insert === "string", "invalid op");
24629
+ assert(logger$3$, typeof op.insert === "string", "invalid op");
24647
24630
  if (op.attributes && op.attributes.box === true) {
24648
24631
  if (options == null ? void 0 : options.boxReplacement) {
24649
24632
  text2 += options.boxReplacement;
@@ -24698,11 +24681,11 @@ var __publicField = (obj, key, value) => {
24698
24681
  focus: pos
24699
24682
  };
24700
24683
  }
24701
- const logger$3$ = getLogger("block-to-text");
24684
+ const logger$3_ = getLogger("block-to-text");
24702
24685
  function textBlockToText$1(editor, ops, doc2) {
24703
24686
  let text2 = "";
24704
24687
  ops.forEach((op) => {
24705
- assert(logger$3$, typeof op.insert === "string", "invalid op");
24688
+ assert(logger$3_, typeof op.insert === "string", "invalid op");
24706
24689
  if (op.attributes && op.attributes.box === true) {
24707
24690
  const box = op.attributes;
24708
24691
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24720,11 +24703,11 @@ var __publicField = (obj, key, value) => {
24720
24703
  });
24721
24704
  return text2;
24722
24705
  }
24723
- const logger$3_ = getLogger("block-to-text");
24706
+ const logger$3Z = getLogger("block-to-text");
24724
24707
  function textToMarkdownText(editor, ops, doc2) {
24725
24708
  let text2 = "";
24726
24709
  ops.forEach((op) => {
24727
- assert(logger$3_, typeof op.insert === "string", "invalid op");
24710
+ assert(logger$3Z, typeof op.insert === "string", "invalid op");
24728
24711
  if (op.attributes && op.attributes.box === true) {
24729
24712
  const box = op.attributes;
24730
24713
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24847,12 +24830,12 @@ var __publicField = (obj, key, value) => {
24847
24830
  return void 0;
24848
24831
  }
24849
24832
  }
24850
- const logger$3Z = getLogger("block-to-text");
24833
+ const logger$3Y = getLogger("block-to-text");
24851
24834
  function textBlockToHtml(editor, blockData, doc2) {
24852
24835
  let html = "";
24853
24836
  const ops = blockData.text || [];
24854
24837
  ops.forEach((op) => {
24855
- assert(logger$3Z, typeof op.insert === "string", "invalid op");
24838
+ assert(logger$3Y, typeof op.insert === "string", "invalid op");
24856
24839
  if (op.attributes && op.attributes.box === true) {
24857
24840
  const box = op.attributes;
24858
24841
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24928,16 +24911,16 @@ var __publicField = (obj, key, value) => {
24928
24911
  }
24929
24912
  return `<p>${html}</p>`;
24930
24913
  }
24931
- const logger$3Y = getLogger("text-block");
24914
+ const logger$3X = getLogger("text-block");
24932
24915
  function createBlockContent$5(editor, path, container, blockElement, blockData) {
24933
24916
  const { text: text2 } = blockData;
24934
- assert(logger$3Y, text2, "no text for text block");
24917
+ assert(logger$3X, text2, "no text for text block");
24935
24918
  const content = createBlockContentElement(blockElement, "div");
24936
24919
  updateBlockContent$1(editor, path, blockData.id, content, text2);
24937
24920
  return content;
24938
24921
  }
24939
24922
  function updateBlockText$1(editor, block, text2) {
24940
- assert(logger$3Y, text2, "no text to update");
24923
+ assert(logger$3X, text2, "no text to update");
24941
24924
  const newContent = createBlockContentElement(null, "div");
24942
24925
  updateBlockContent$1(editor, getBlockPath(block), getBlockId(block), newContent, text2);
24943
24926
  const oldContent = getBlockContent(block);
@@ -24947,7 +24930,7 @@ var __publicField = (obj, key, value) => {
24947
24930
  return getRangeClientRects(editor, block, range);
24948
24931
  }
24949
24932
  function convertTo$k(editor, blockData, doc2, type) {
24950
- assert(logger$3Y, blockData.text, "no text for text block");
24933
+ assert(logger$3X, blockData.text, "no text for text block");
24951
24934
  if (type === "text") {
24952
24935
  return textBlockToText$1(editor, blockData.text, doc2);
24953
24936
  }
@@ -24961,7 +24944,7 @@ var __publicField = (obj, key, value) => {
24961
24944
  blockData.id = genId();
24962
24945
  info == null ? void 0 : info.blockIdMap.set(srcBlockData.id, blockData.id);
24963
24946
  const { text: text2 } = blockData;
24964
- assert(logger$3Y, text2, "no text for text block");
24947
+ assert(logger$3X, text2, "no text for text block");
24965
24948
  text2.forEach((op) => {
24966
24949
  if (op.insert && op.attributes && op.attributes.box === true) {
24967
24950
  const boxId = genId();
@@ -24993,7 +24976,7 @@ var __publicField = (obj, key, value) => {
24993
24976
  blockToDoc: blockToDoc$1
24994
24977
  };
24995
24978
  const updateTextBlockContent = updateBlockContent$1;
24996
- const logger$3X = getLogger("action-helper");
24979
+ const logger$3W = getLogger("action-helper");
24997
24980
  function editorGetBlockData(editor, block) {
24998
24981
  const container = getParentContainer(block);
24999
24982
  const containerId = getContainerId(container);
@@ -25001,10 +24984,10 @@ var __publicField = (obj, key, value) => {
25001
24984
  return editor.doc.getBlockData(containerId, blockIndex);
25002
24985
  }
25003
24986
  function editorGetBlockText(editor, block) {
25004
- assert(logger$3X, isTextKindBlock(editor, block), "not a text kind block");
24987
+ assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
25005
24988
  const data2 = editorGetBlockData(editor, block);
25006
24989
  const text2 = data2.text;
25007
- assert(logger$3X, text2, "no text in block");
24990
+ assert(logger$3W, text2, "no text in block");
25008
24991
  return text2;
25009
24992
  }
25010
24993
  function editorGetBlockTextEx(editor, block, length) {
@@ -25012,7 +24995,7 @@ var __publicField = (obj, key, value) => {
25012
24995
  }
25013
24996
  function editorGetBoxData(editor, box) {
25014
24997
  const block = getParentBlock(box);
25015
- assert(logger$3X, block, "no parent block");
24998
+ assert(logger$3W, block, "no parent block");
25016
24999
  const text2 = editorGetBlockText(editor, block);
25017
25000
  const id = getBoxId(box);
25018
25001
  const op = text2.find((op2) => {
@@ -25022,60 +25005,60 @@ var __publicField = (obj, key, value) => {
25022
25005
  }
25023
25006
  return false;
25024
25007
  });
25025
- assert(logger$3X, op, "failed to find box");
25008
+ assert(logger$3W, op, "failed to find box");
25026
25009
  return op.attributes;
25027
25010
  }
25028
- const logger$3W = getLogger("block-text");
25011
+ const logger$3V = getLogger("block-text");
25029
25012
  function getTextAfterOffset(editor, block, offset) {
25030
- assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
25031
- assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
25032
- assert(logger$3W, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25013
+ assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
25014
+ assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
25015
+ assert(logger$3V, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25033
25016
  const newOffset = getNextValidOffset(block, offset);
25034
25017
  const length = newOffset - offset;
25035
25018
  if (length === 0) {
25036
- assert(logger$3W, false, `no text after offset: ${offset}`);
25019
+ assert(logger$3V, false, `no text after offset: ${offset}`);
25037
25020
  }
25038
25021
  const text2 = editorGetBlockText(editor, block);
25039
25022
  const { middle } = splitToThree(text2, offset, length);
25040
- assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
25023
+ assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
25041
25024
  const op = middle[0];
25042
25025
  if (isBoxOp(op)) {
25043
25026
  return " ";
25044
25027
  }
25045
- assert(logger$3W, op.insert.length === 1 || op.insert.length === 2, "invalid op");
25028
+ assert(logger$3V, op.insert.length === 1 || op.insert.length === 2, "invalid op");
25046
25029
  return op.insert;
25047
25030
  }
25048
25031
  function getTextBeforeOffset(editor, block, offset) {
25049
- assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
25050
- assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
25051
- assert(logger$3W, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25032
+ assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
25033
+ assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
25034
+ assert(logger$3V, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25052
25035
  const newOffset = getPrevValidOffset(block, offset);
25053
25036
  const length = offset - newOffset;
25054
25037
  if (length === 0) {
25055
- assert(logger$3W, false, `no text before offset: ${offset}`);
25038
+ assert(logger$3V, false, `no text before offset: ${offset}`);
25056
25039
  }
25057
25040
  const text2 = editorGetBlockText(editor, block);
25058
25041
  const { middle } = splitToThree(text2, newOffset, length);
25059
- assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
25042
+ assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
25060
25043
  const op = middle[0];
25061
25044
  if (isBoxOp(op)) {
25062
25045
  return " ";
25063
25046
  }
25064
- assert(logger$3W, op.insert.length === 1 || op.insert.length === 2, "invalid op");
25047
+ assert(logger$3V, op.insert.length === 1 || op.insert.length === 2, "invalid op");
25065
25048
  return op.insert;
25066
25049
  }
25067
25050
  function getOffsetInfoBefore(editor, block, offset) {
25068
- assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
25069
- assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
25070
- assert(logger$3W, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25051
+ assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
25052
+ assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
25053
+ assert(logger$3V, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25071
25054
  const newOffset = getPrevValidOffset(block, offset);
25072
25055
  const length = offset - newOffset;
25073
25056
  if (length === 0) {
25074
- assert(logger$3W, false, `no text before offset: ${offset}`);
25057
+ assert(logger$3V, false, `no text before offset: ${offset}`);
25075
25058
  }
25076
25059
  const text2 = editorGetBlockText(editor, block);
25077
25060
  const { middle } = splitToThree(text2, newOffset, length);
25078
- assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
25061
+ assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
25079
25062
  const op = middle[0];
25080
25063
  if (isBoxOp(op)) {
25081
25064
  return {
@@ -25085,33 +25068,25 @@ var __publicField = (obj, key, value) => {
25085
25068
  length: 1
25086
25069
  };
25087
25070
  }
25088
- let charType = "text";
25089
- if (isSpace(op.insert)) {
25090
- charType = "space";
25091
- } else if (isCJKPunctuation(op.insert)) {
25092
- charType = "cjk_punctuation";
25093
- } else if (isCJK(op.insert)) {
25094
- charType = "cjk";
25095
- }
25096
25071
  return {
25097
25072
  op,
25098
- charType,
25073
+ charType: isSpace(op.insert) ? "space" : "text",
25099
25074
  offset: newOffset,
25100
25075
  length: op.insert.length
25101
25076
  };
25102
25077
  }
25103
25078
  function getOffsetInfoAfter(editor, block, offset) {
25104
- assert(logger$3W, isTextKindBlock(editor, block), "not a text kind block");
25105
- assert(logger$3W, isValidOffset(block, offset), "not a valid offset");
25106
- assert(logger$3W, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25079
+ assert(logger$3V, isTextKindBlock(editor, block), "not a text kind block");
25080
+ assert(logger$3V, isValidOffset(block, offset), "not a valid offset");
25081
+ assert(logger$3V, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
25107
25082
  const newOffset = getNextValidOffset(block, offset);
25108
25083
  const length = newOffset - offset;
25109
25084
  if (length === 0) {
25110
- assert(logger$3W, false, `no text after offset: ${offset}`);
25085
+ assert(logger$3V, false, `no text after offset: ${offset}`);
25111
25086
  }
25112
25087
  const text2 = editorGetBlockText(editor, block);
25113
25088
  const { middle } = splitToThree(text2, offset, length);
25114
- assert(logger$3W, middle.length === 1, "failed to split text to 3 parts");
25089
+ assert(logger$3V, middle.length === 1, "failed to split text to 3 parts");
25115
25090
  const op = middle[0];
25116
25091
  if (isBoxOp(op)) {
25117
25092
  return {
@@ -25121,17 +25096,9 @@ var __publicField = (obj, key, value) => {
25121
25096
  length: 1
25122
25097
  };
25123
25098
  }
25124
- let charType = "text";
25125
- if (isSpace(op.insert)) {
25126
- charType = "space";
25127
- } else if (isCJKPunctuation(op.insert)) {
25128
- charType = "cjk_punctuation";
25129
- } else if (isCJK(op.insert)) {
25130
- charType = "cjk";
25131
- }
25132
25099
  return {
25133
25100
  op,
25134
- charType,
25101
+ charType: isSpace(op.insert) ? "space" : "text",
25135
25102
  offset,
25136
25103
  length: op.insert.length
25137
25104
  };
@@ -25183,7 +25150,7 @@ var __publicField = (obj, key, value) => {
25183
25150
  return null;
25184
25151
  }
25185
25152
  function findWordLeft(editor, block, offset) {
25186
- assert(logger$3W, isTextKindBlock(editor, block), "invalid blok type");
25153
+ assert(logger$3V, isTextKindBlock(editor, block), "invalid blok type");
25187
25154
  if (isEmptyTextBlock(editor, block)) {
25188
25155
  return 0;
25189
25156
  }
@@ -25192,7 +25159,6 @@ var __publicField = (obj, key, value) => {
25192
25159
  return offset - 1;
25193
25160
  }
25194
25161
  let start = offset;
25195
- let find = offsetInfo.charType;
25196
25162
  if (offsetInfo.charType === "space") {
25197
25163
  const startInfo2 = findPrevOffsetNotType(editor, block, start, "space");
25198
25164
  if (!startInfo2) {
@@ -25205,15 +25171,14 @@ var __publicField = (obj, key, value) => {
25205
25171
  return startInfo2.offset;
25206
25172
  }
25207
25173
  start = startInfo2.offset;
25208
- find = getOffsetInfoBefore(editor, block, start).charType;
25209
25174
  }
25210
- const startInfo = findPrevOffsetNotType(editor, block, start, find);
25175
+ const startInfo = findPrevOffsetNotType(editor, block, start, "text");
25211
25176
  if (!startInfo)
25212
25177
  return 0;
25213
25178
  return startInfo.offset + startInfo.length;
25214
25179
  }
25215
25180
  function findWordEnd(editor, block, offset) {
25216
- assert(logger$3W, isTextKindBlock(editor, block), "invalid blok type");
25181
+ assert(logger$3V, isTextKindBlock(editor, block), "invalid blok type");
25217
25182
  if (isEmptyTextBlock(editor, block)) {
25218
25183
  return 0;
25219
25184
  }
@@ -25222,7 +25187,6 @@ var __publicField = (obj, key, value) => {
25222
25187
  return offset + 1;
25223
25188
  }
25224
25189
  let start = offset;
25225
- let find = offsetInfo.charType;
25226
25190
  if (offsetInfo.charType === "space") {
25227
25191
  const startInfo2 = findAfterOffsetNotType(editor, block, start, "space");
25228
25192
  if (!startInfo2) {
@@ -25235,17 +25199,16 @@ var __publicField = (obj, key, value) => {
25235
25199
  return startInfo2.offset;
25236
25200
  }
25237
25201
  start = startInfo2.offset;
25238
- find = getOffsetInfoAfter(editor, block, start).charType;
25239
25202
  }
25240
- const startInfo = findAfterOffsetNotType(editor, block, start, find);
25203
+ const startInfo = findAfterOffsetNotType(editor, block, start, "text");
25241
25204
  if (!startInfo)
25242
25205
  return getBlockTextLength$6(editor, block);
25243
25206
  return startInfo.offset;
25244
25207
  }
25245
- const logger$3V = getLogger("text-box");
25208
+ const logger$3U = getLogger("text-box");
25246
25209
  function updateBoxContent$8(editor, boxElement, boxContent, boxData) {
25247
- assert(logger$3V, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
25248
- assert(logger$3V, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
25210
+ assert(logger$3U, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
25211
+ assert(logger$3U, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
25249
25212
  createElement("span", [], boxContent, boxData.text);
25250
25213
  }
25251
25214
  function convertTo$j(editor, boxData, doc2, type) {
@@ -25279,7 +25242,7 @@ var __publicField = (obj, key, value) => {
25279
25242
  updateBoxContent: updateBoxContent$7,
25280
25243
  convertTo: convertTo$i
25281
25244
  };
25282
- const logger$3U = getLogger("editor-boxes");
25245
+ const logger$3T = getLogger("editor-boxes");
25283
25246
  class EditorBoxes {
25284
25247
  constructor(editor) {
25285
25248
  __publicField(this, "boxes", /* @__PURE__ */ new Map());
@@ -25288,12 +25251,12 @@ var __publicField = (obj, key, value) => {
25288
25251
  registerBoxClass(boxClass) {
25289
25252
  const type = boxClass.boxType;
25290
25253
  const exists = this.boxes.get(type);
25291
- assert(logger$3U, !exists, `duplicated box type: ${type}`);
25254
+ assert(logger$3T, !exists, `duplicated box type: ${type}`);
25292
25255
  this.boxes.set(type, boxClass);
25293
25256
  }
25294
25257
  getBoxClass(type) {
25295
25258
  const exists = this.boxes.get(type);
25296
- assert(logger$3U, exists, `unknown box type: ${type}`);
25259
+ assert(logger$3T, exists, `unknown box type: ${type}`);
25297
25260
  return exists;
25298
25261
  }
25299
25262
  createBox(blockContent, box) {
@@ -25658,7 +25621,7 @@ var __publicField = (obj, key, value) => {
25658
25621
  return { classes, attributes: newAttributes, styles: newStyles };
25659
25622
  }
25660
25623
  }
25661
- const logger$3T = getLogger("editor-insertion");
25624
+ const logger$3S = getLogger("editor-insertion");
25662
25625
  class EditorInsertions {
25663
25626
  constructor(editor) {
25664
25627
  __publicField(this, "insertions", /* @__PURE__ */ new Map());
@@ -25667,12 +25630,12 @@ var __publicField = (obj, key, value) => {
25667
25630
  registerInsertionClass(insertionClass) {
25668
25631
  const type = insertionClass.insertionType;
25669
25632
  const exists = this.insertions.get(type);
25670
- assert(logger$3T, !exists, `duplicated insertion type: ${type}`);
25633
+ assert(logger$3S, !exists, `duplicated insertion type: ${type}`);
25671
25634
  this.insertions.set(type, insertionClass);
25672
25635
  }
25673
25636
  getInsertionClass(type) {
25674
25637
  const exists = this.insertions.get(type);
25675
- assert(logger$3T, exists, `unknown insertion type: ${type}`);
25638
+ assert(logger$3S, exists, `unknown insertion type: ${type}`);
25676
25639
  return exists;
25677
25640
  }
25678
25641
  createInsertionElement(type, id, attributes) {
@@ -25792,7 +25755,7 @@ var __publicField = (obj, key, value) => {
25792
25755
  };
25793
25756
  }
25794
25757
  }
25795
- const logger$3S = getLogger("editor-input");
25758
+ const logger$3R = getLogger("editor-input");
25796
25759
  class EditorInput$1 {
25797
25760
  constructor(editor, callbacks) {
25798
25761
  __publicField(this, "editor");
@@ -25914,7 +25877,7 @@ var __publicField = (obj, key, value) => {
25914
25877
  return;
25915
25878
  }
25916
25879
  this.callbacks.onCut(event);
25917
- logger$3S.debug("on cut");
25880
+ logger$3R.debug("on cut");
25918
25881
  });
25919
25882
  __publicField(this, "handlePaste", (event) => {
25920
25883
  if (event.isTrusted) {
@@ -26029,11 +25992,11 @@ var __publicField = (obj, key, value) => {
26029
25992
  this.callbacks.removeHandler(handler);
26030
25993
  }
26031
25994
  defaultInsertText(editor, containerId, blockIndex, offset, text2) {
26032
- assert(logger$3S, editor === this.editor, "invalid editor");
25995
+ assert(logger$3R, editor === this.editor, "invalid editor");
26033
25996
  this.callbacks.defaultInsertText(editor, containerId, blockIndex, offset, text2);
26034
25997
  }
26035
25998
  defaultHandleKeydown(editor, event) {
26036
- assert(logger$3S, editor === this.editor, "invalid editor");
25999
+ assert(logger$3R, editor === this.editor, "invalid editor");
26037
26000
  return this.callbacks.defaultHandleKeydown(editor, event);
26038
26001
  }
26039
26002
  forEach(callback) {
@@ -26058,7 +26021,7 @@ var __publicField = (obj, key, value) => {
26058
26021
  input2.style.left = `${x / scale}px`;
26059
26022
  input2.style.top = `${y / scale}px`;
26060
26023
  }
26061
- const logger$3R = getLogger("editor-caret");
26024
+ const logger$3Q = getLogger("editor-caret");
26062
26025
  function getFirefoxVersion() {
26063
26026
  const userAgent = window.navigator.userAgent;
26064
26027
  const match = userAgent.match(/Firefox\/(\d+)\./);
@@ -26121,11 +26084,11 @@ var __publicField = (obj, key, value) => {
26121
26084
  return;
26122
26085
  }
26123
26086
  const { range } = this.editor.selection;
26124
- assert(logger$3R, range.isCollapsed, "range is not collapsed");
26087
+ assert(logger$3Q, range.isCollapsed, "range is not collapsed");
26125
26088
  const pos = range.start;
26126
- assert(logger$3R, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
26089
+ assert(logger$3Q, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
26127
26090
  const block = this.editor.getBlockById(pos.blockId);
26128
- assert(logger$3R, isTextKindBlock(this.editor, block), "only text kind block can has caret");
26091
+ assert(logger$3Q, isTextKindBlock(this.editor, block), "only text kind block can has caret");
26129
26092
  let rect;
26130
26093
  const compositionSpan = block.querySelector("span.inputting-insertion");
26131
26094
  if (compositionSpan) {
@@ -26163,7 +26126,7 @@ var __publicField = (obj, key, value) => {
26163
26126
  clearAllSelection(editor);
26164
26127
  editor.selection.range.getSelectedBlocks().forEach((s) => updateBlockSelection(editor, s.block, s.start, s.end));
26165
26128
  }
26166
- const logger$3Q = getLogger("editor-dom");
26129
+ const logger$3P = getLogger("editor-dom");
26167
26130
  function editorGetClientHeight(editor) {
26168
26131
  const scrollContainer = getScrollContainer$1(editor.rootContainer);
26169
26132
  return scrollContainer.clientHeight;
@@ -26251,7 +26214,7 @@ var __publicField = (obj, key, value) => {
26251
26214
  }
26252
26215
  function editorScrollIntoView(editor) {
26253
26216
  if (!isElementVisible(editor.rootContainer)) {
26254
- logger$3Q.warn("editorScrollIntoView: editor is not visible");
26217
+ logger$3P.warn("editorScrollIntoView: editor is not visible");
26255
26218
  return;
26256
26219
  }
26257
26220
  const rootClientRect = editor.rootContainer.getBoundingClientRect();
@@ -26316,7 +26279,7 @@ var __publicField = (obj, key, value) => {
26316
26279
  const { start, end } = range;
26317
26280
  return start.blockId === getBlockId(firstChildBlock) && start.offset === 0 && end.blockId === getBlockId(lastChildBlock) && end.offset === getBlockTextLength$6(editor, lastChildBlock);
26318
26281
  }
26319
- const logger$3P = getLogger("range-in-block");
26282
+ const logger$3O = getLogger("range-in-block");
26320
26283
  function rangeInBlock(block, range) {
26321
26284
  const editor = range.getEditor();
26322
26285
  const start = editor.getBlockById(range.start.blockId);
@@ -26337,16 +26300,16 @@ var __publicField = (obj, key, value) => {
26337
26300
  while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
26338
26301
  prevBlock = getPrevVisibleBlock(prevBlock);
26339
26302
  }
26340
- assert(logger$3P, prevBlock, "no prev block while deleting a block");
26303
+ assert(logger$3O, prevBlock, "no prev block while deleting a block");
26341
26304
  newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
26342
26305
  } else {
26343
26306
  const nextBlock = getNextVisibleBlock(block);
26344
- assert(logger$3P, nextBlock, "no prev and next block while deleting a block");
26307
+ assert(logger$3O, nextBlock, "no prev and next block while deleting a block");
26345
26308
  newRange = createBlockSimpleRange(editor, nextBlock, 0);
26346
26309
  }
26347
26310
  return newRange;
26348
26311
  }
26349
- const logger$3O = getLogger("block-to-html");
26312
+ const logger$3N = getLogger("block-to-html");
26350
26313
  function blockToHtml(editor, blockData, doc2, path) {
26351
26314
  const blockClass = getBlockClassByType(editor, blockData.type);
26352
26315
  if (blockClass.convertTo) {
@@ -26355,15 +26318,15 @@ var __publicField = (obj, key, value) => {
26355
26318
  if (blockClass.blockKind !== "text") {
26356
26319
  return `[${blockData.type}]`;
26357
26320
  }
26358
- assert(logger$3O, blockData.text, "no text");
26321
+ assert(logger$3N, blockData.text, "no text");
26359
26322
  const plainText = toPlainText(blockData.text);
26360
26323
  return `<div>${escapeHtmlText(plainText)}</div>`;
26361
26324
  }
26362
- const logger$3N = getLogger("block-to-text");
26325
+ const logger$3M = getLogger("block-to-text");
26363
26326
  function textBlockToText(editor, ops, doc2) {
26364
26327
  let text2 = "";
26365
26328
  ops.forEach((op) => {
26366
- assert(logger$3N, typeof op.insert === "string", "invalid op");
26329
+ assert(logger$3M, typeof op.insert === "string", "invalid op");
26367
26330
  if (op.attributes && op.attributes.box === true) {
26368
26331
  const box = op.attributes;
26369
26332
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -26389,7 +26352,7 @@ var __publicField = (obj, key, value) => {
26389
26352
  if (blockClass.blockKind !== "text") {
26390
26353
  return `[${blockData.type}]`;
26391
26354
  }
26392
- assert(logger$3N, blockData.text, "no text");
26355
+ assert(logger$3M, blockData.text, "no text");
26393
26356
  const plainText = textBlockToText(editor, blockData.text, doc2);
26394
26357
  return plainText;
26395
26358
  }
@@ -26422,11 +26385,11 @@ var __publicField = (obj, key, value) => {
26422
26385
  const markdown = lines.join("\n");
26423
26386
  return markdown;
26424
26387
  }
26425
- const logger$3M = getLogger("get-text-position");
26388
+ const logger$3L = getLogger("get-text-position");
26426
26389
  function editorGetTextPosition(editor, insertPos) {
26427
26390
  const pos = insertPos != null ? insertPos : editor.selection.range.start;
26428
26391
  if (!(pos instanceof EditorSimpleBlockPosition)) {
26429
- assert(logger$3M, false, `invalid insert pos type: ${typeof pos}`);
26392
+ assert(logger$3L, false, `invalid insert pos type: ${typeof pos}`);
26430
26393
  }
26431
26394
  const { blockId } = pos;
26432
26395
  const block = editor.getBlockById(blockId);
@@ -26514,14 +26477,14 @@ var __publicField = (obj, key, value) => {
26514
26477
  return attributes;
26515
26478
  }
26516
26479
  }
26517
- const logger$3L = getLogger("insert-text");
26480
+ const logger$3K = getLogger("insert-text");
26518
26481
  function getTextAttributes(editor, containerId, blockIndex, offset) {
26519
26482
  var _a, _b;
26520
26483
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26521
- assert(logger$3L, blockData, "no block data");
26522
- assert(logger$3L, blockData.text, "no block text");
26484
+ assert(logger$3K, blockData, "no block data");
26485
+ assert(logger$3K, blockData.text, "no block text");
26523
26486
  if (getTextLength(blockData.text) === 0) {
26524
- assert(logger$3L, offset === 0, "invalid text offset");
26487
+ assert(logger$3K, offset === 0, "invalid text offset");
26525
26488
  return BlockAttributesHandler.get(editor).getEmptyBlockTextAttributes(blockData.id);
26526
26489
  }
26527
26490
  if (offset === 0) {
@@ -26568,7 +26531,7 @@ var __publicField = (obj, key, value) => {
26568
26531
  }
26569
26532
  for (let i = 0; i < text2.length; i++) {
26570
26533
  const op = text2[i];
26571
- assert(logger$3L, typeof op.insert === "string", "invalid text op, no insert");
26534
+ assert(logger$3K, typeof op.insert === "string", "invalid text op, no insert");
26572
26535
  const endPos = pos + getOpLength(op);
26573
26536
  if (endPos === start) {
26574
26537
  return false;
@@ -26582,8 +26545,8 @@ var __publicField = (obj, key, value) => {
26582
26545
  }
26583
26546
  function editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset) {
26584
26547
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26585
- assert(logger$3L, blockData, "no block data");
26586
- assert(logger$3L, blockData.text, "no block text");
26548
+ assert(logger$3K, blockData, "no block data");
26549
+ assert(logger$3K, blockData.text, "no block text");
26587
26550
  const attributes = getTextAttributes(editor, containerId, blockIndex, offset);
26588
26551
  if (attributes && Object.keys(attributes).includes("link")) {
26589
26552
  const inOp = checkRangeInOp(blockData.text, offset);
@@ -26602,21 +26565,21 @@ var __publicField = (obj, key, value) => {
26602
26565
  const { containerId, blockIndex, offset } = editorGetTextPosition(editor);
26603
26566
  editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset);
26604
26567
  }
26605
- const logger$3K = getLogger("update-composition-text");
26568
+ const logger$3J = getLogger("update-composition-text");
26606
26569
  function editorUpdateCompositionText(editor) {
26607
26570
  const pos = editor.selection.range.start;
26608
26571
  if (!(pos instanceof EditorSimpleBlockPosition)) {
26609
- assert(logger$3K, false, `invalid insert pos type: ${typeof pos}`);
26572
+ assert(logger$3J, false, `invalid insert pos type: ${typeof pos}`);
26610
26573
  }
26611
26574
  const { blockId } = pos;
26612
26575
  const block = editor.getBlockById(blockId);
26613
- assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
26576
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
26614
26577
  const container = getParentContainer(block);
26615
26578
  const containerId = getContainerId(container);
26616
26579
  const blockIndex = getBlockIndex(block);
26617
26580
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26618
- assert(logger$3K, blockData, "no block data in doc");
26619
- assert(logger$3K, blockData.text, "no text data in text block");
26581
+ assert(logger$3J, blockData, "no block data in doc");
26582
+ assert(logger$3J, blockData.text, "no text data in text block");
26620
26583
  const blockContent = getBlockContent(block);
26621
26584
  updateBlockContent$1(editor, getBlockPath(block), blockId, blockContent, blockData.text);
26622
26585
  }
@@ -26628,25 +26591,25 @@ var __publicField = (obj, key, value) => {
26628
26591
  const block = editor.getBlockById(blockData.id);
26629
26592
  return block;
26630
26593
  }
26631
- const logger$3J = getLogger("delete-block-text");
26594
+ const logger$3I = getLogger("delete-block-text");
26632
26595
  function editorDeleteBlockText(editor, block, offset, count, options) {
26633
26596
  if (!editor.isBlockWritable(block)) {
26634
- logger$3J.error("block is not writable");
26597
+ logger$3I.error("block is not writable");
26635
26598
  return 0;
26636
26599
  }
26637
- assert(logger$3J, isTextKindBlock(editor, block), "block is not a text kind block");
26600
+ assert(logger$3I, isTextKindBlock(editor, block), "block is not a text kind block");
26638
26601
  const container = getParentContainer(block);
26639
26602
  const containerId = getContainerId(container);
26640
26603
  const blockIndex = getBlockIndex(block);
26641
26604
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26642
- assert(logger$3J, blockData, "no block data in doc");
26643
- assert(logger$3J, blockData.text, "no text data in text block");
26605
+ assert(logger$3I, blockData, "no block data in doc");
26606
+ assert(logger$3I, blockData.text, "no text data in text block");
26644
26607
  let from = offset;
26645
26608
  if (!isValidOffset(block, offset)) {
26646
26609
  from = getPrevValidOffset(block, from);
26647
26610
  }
26648
26611
  let to = offset + count;
26649
- assert(logger$3J, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
26612
+ assert(logger$3I, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
26650
26613
  if (!isValidOffset(block, to)) {
26651
26614
  to = getNextValidOffset(block, to);
26652
26615
  }
@@ -26655,7 +26618,7 @@ var __publicField = (obj, key, value) => {
26655
26618
  editor.doc.localUpdateBlockText(containerId, blockIndex, actions2, options);
26656
26619
  return deleteCount;
26657
26620
  }
26658
- const logger$3I = getLogger("break-text-block");
26621
+ const logger$3H = getLogger("break-text-block");
26659
26622
  function copyBlockAttributes(editor, block) {
26660
26623
  const blockData = editor.getBlockData(block);
26661
26624
  const quoted = blockData.quoted;
@@ -26667,8 +26630,8 @@ var __publicField = (obj, key, value) => {
26667
26630
  return {};
26668
26631
  }
26669
26632
  function editorBreakTextBlock(editor, block, offset, options) {
26670
- assert(logger$3I, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
26671
- assert(logger$3I, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
26633
+ assert(logger$3H, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
26634
+ assert(logger$3H, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
26672
26635
  const container = getParentContainer(block);
26673
26636
  const containerId = getContainerId(container);
26674
26637
  const blockIndex = getBlockIndex(block);
@@ -26698,7 +26661,7 @@ var __publicField = (obj, key, value) => {
26698
26661
  };
26699
26662
  }
26700
26663
  }
26701
- assert(logger$3I, isValidOffset(block, offset), "not a valid offset");
26664
+ assert(logger$3H, isValidOffset(block, offset), "not a valid offset");
26702
26665
  const text2 = editorGetBlockText(editor, block);
26703
26666
  const { right } = splitText(text2, offset);
26704
26667
  const rightLength = getTextLength(right);
@@ -26724,12 +26687,12 @@ var __publicField = (obj, key, value) => {
26724
26687
  newBlock
26725
26688
  };
26726
26689
  }
26727
- const logger$3H = getLogger("prepare-insert-new-block");
26690
+ const logger$3G = getLogger("prepare-insert-new-block");
26728
26691
  function editorPrepareInsertNewBlock(editor, containerId, blockIndex) {
26729
26692
  if (containerId && blockIndex !== void 0 && blockIndex !== null) {
26730
26693
  const container = editor.getContainerById(containerId);
26731
26694
  const blocks = getChildBlocks(container);
26732
- assert(logger$3H, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
26695
+ assert(logger$3G, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
26733
26696
  return {
26734
26697
  containerId,
26735
26698
  blockIndex
@@ -26763,15 +26726,15 @@ var __publicField = (obj, key, value) => {
26763
26726
  blockIndex: getBlockIndex(newBlock)
26764
26727
  };
26765
26728
  }
26766
- const logger$3G = getLogger("auto-insert-block");
26729
+ const logger$3F = getLogger("auto-insert-block");
26767
26730
  function editorAutoInsertBlock(editor, blockData, containerId, blockIndex, newRange, insertBlockOptions) {
26768
26731
  const result = editorPrepareInsertNewBlock(editor, containerId, blockIndex);
26769
- assert(logger$3G, result, `not an valid insert position: ${editor.selection.range}`);
26732
+ assert(logger$3F, result, `not an valid insert position: ${editor.selection.range}`);
26770
26733
  const defaultPos = { blockId: blockData.id, offset: 0 };
26771
26734
  const defaultRange = { anchor: defaultPos, focus: defaultPos };
26772
26735
  return editorInsertBlock(editor, result.containerId, result.blockIndex, blockData, newRange != null ? newRange : defaultRange, insertBlockOptions);
26773
26736
  }
26774
- const logger$3F = getLogger("delete-block");
26737
+ const logger$3E = getLogger("delete-block");
26775
26738
  function getAllChildContainers(editor, blockData, containerIds) {
26776
26739
  if (blockData.children) {
26777
26740
  containerIds.push(...blockData.children);
@@ -26788,7 +26751,7 @@ var __publicField = (obj, key, value) => {
26788
26751
  const containerId = getContainerId(container);
26789
26752
  const blockIndex = getBlockIndex(block);
26790
26753
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26791
- assert(logger$3F, blockData, "no block data in doc");
26754
+ assert(logger$3E, blockData, "no block data in doc");
26792
26755
  editor.doc.localDeleteBlock(containerId, blockIndex, createEditorSelectionRange(editor, { anchor: newRange.start, focus: newRange.end }));
26793
26756
  return blockData;
26794
26757
  }
@@ -26834,15 +26797,15 @@ var __publicField = (obj, key, value) => {
26834
26797
  });
26835
26798
  editor.doc.localDeleteChildContainers(containerIds);
26836
26799
  }
26837
- const logger$3E = getLogger("merge-text-block");
26800
+ const logger$3D = getLogger("merge-text-block");
26838
26801
  function editorMergeTextBlock(editor, block1, block2) {
26839
- assert(logger$3E, isTextKindBlock(editor, block1), "only text block can be merged");
26840
- assert(logger$3E, isTextKindBlock(editor, block2), "only text block can be merged");
26802
+ assert(logger$3D, isTextKindBlock(editor, block1), "only text block can be merged");
26803
+ assert(logger$3D, isTextKindBlock(editor, block2), "only text block can be merged");
26841
26804
  const data1 = editorGetBlockData(editor, block1);
26842
26805
  const data2 = editorGetBlockData(editor, block2);
26843
26806
  const text1 = data1.text;
26844
26807
  const text2 = data2.text;
26845
- assert(logger$3E, text1 && text2, "block data has no text");
26808
+ assert(logger$3D, text1 && text2, "block data has no text");
26846
26809
  const container = getParentContainer(block1);
26847
26810
  const containerId = getContainerId(container);
26848
26811
  const blockIndex = getBlockIndex(block1);
@@ -26852,15 +26815,15 @@ var __publicField = (obj, key, value) => {
26852
26815
  editorDeleteBlock(editor, block2, newRange);
26853
26816
  return block;
26854
26817
  }
26855
- const logger$3D = getLogger("clear-selected-contents");
26818
+ const logger$3C = getLogger("clear-selected-contents");
26856
26819
  function deleteTextBlockSelection(editor, selectedBlock) {
26857
- assert(logger$3D, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
26820
+ assert(logger$3C, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
26858
26821
  const { start, end } = selectedBlock;
26859
- assert(logger$3D, start.isSimple(), "not a simple block position");
26860
- assert(logger$3D, end.isSimple(), "not a simple block position");
26822
+ assert(logger$3C, start.isSimple(), "not a simple block position");
26823
+ assert(logger$3C, end.isSimple(), "not a simple block position");
26861
26824
  const startOffset = start.offset;
26862
26825
  const endOffset = end.offset;
26863
- assert(logger$3D, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
26826
+ assert(logger$3C, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
26864
26827
  if (startOffset === endOffset) {
26865
26828
  return;
26866
26829
  }
@@ -26885,7 +26848,7 @@ var __publicField = (obj, key, value) => {
26885
26848
  return;
26886
26849
  }
26887
26850
  if (isEmbedBlock(block) || start.isSimple()) {
26888
- assert(logger$3D, end.isSimple(), "invalid range");
26851
+ assert(logger$3C, end.isSimple(), "invalid range");
26889
26852
  const container = getParentContainer(block);
26890
26853
  const blockIndex = getBlockIndex(block);
26891
26854
  const newBlock = editor.insertTextBlock("", getContainerId(container), blockIndex);
@@ -26893,8 +26856,8 @@ var __publicField = (obj, key, value) => {
26893
26856
  editor.deleteBlock(block);
26894
26857
  return;
26895
26858
  }
26896
- assert(logger$3D, isComplexKindBlock(editor, block), "invalid block kind");
26897
- assert(logger$3D, !start.isSimple() && !end.isSimple(), "invalid range");
26859
+ assert(logger$3C, isComplexKindBlock(editor, block), "invalid block kind");
26860
+ assert(logger$3C, !start.isSimple() && !end.isSimple(), "invalid range");
26898
26861
  complexBlockGetSelectedContainers(editor, block, start, end);
26899
26862
  const containers = editor.selection.range.getSelectedContainers();
26900
26863
  containers.forEach((container, index2) => {
@@ -26911,7 +26874,7 @@ var __publicField = (obj, key, value) => {
26911
26874
  return;
26912
26875
  }
26913
26876
  const selectedBlocks = range.getSelectedBlocks();
26914
- assert(logger$3D, selectedBlocks.length > 0, "no selected block");
26877
+ assert(logger$3C, selectedBlocks.length > 0, "no selected block");
26915
26878
  if (selectedBlocks.length === 1) {
26916
26879
  clearOneBlock(editor, selectedBlocks[0]);
26917
26880
  return;
@@ -26919,7 +26882,7 @@ var __publicField = (obj, key, value) => {
26919
26882
  const firstSelectedBlock = selectedBlocks[0];
26920
26883
  const firstBlock = firstSelectedBlock.block;
26921
26884
  const container = getParentContainer(firstBlock);
26922
- assert(logger$3D, selectedBlocks.length > 1, "no selected block");
26885
+ assert(logger$3C, selectedBlocks.length > 1, "no selected block");
26923
26886
  const lastSelectedBlock = selectedBlocks[selectedBlocks.length - 1];
26924
26887
  const lastBlock2 = lastSelectedBlock.block;
26925
26888
  if (isTextKindBlock(editor, firstBlock)) {
@@ -26949,7 +26912,7 @@ var __publicField = (obj, key, value) => {
26949
26912
  }
26950
26913
  const prevBlock = getPrevBlock(firstBlock);
26951
26914
  const nextBlock = getNextBlock(lastBlock2);
26952
- assert(logger$3D, prevBlock || nextBlock, "no prev or next block");
26915
+ assert(logger$3C, prevBlock || nextBlock, "no prev or next block");
26953
26916
  selectedBlocks.forEach((selectedBlock) => editor.deleteBlock(selectedBlock.block));
26954
26917
  }
26955
26918
  function editorClearSelectedContents(editor, selectionRange) {
@@ -26968,7 +26931,7 @@ var __publicField = (obj, key, value) => {
26968
26931
  editor.emit("afterClearSelection", editor);
26969
26932
  });
26970
26933
  }
26971
- const logger$3C = getLogger("core");
26934
+ const logger$3B = getLogger("core");
26972
26935
  function editorUpdateBlockText(editor, block, ops, options) {
26973
26936
  const container = getParentContainer(block);
26974
26937
  const containerId = getContainerId(container);
@@ -26981,7 +26944,7 @@ var __publicField = (obj, key, value) => {
26981
26944
  }
26982
26945
  function editorSetBlockText(editor, block, newText, options) {
26983
26946
  if (!editor.isBlockWritable(block)) {
26984
- logger$3C.error("block is not writable");
26947
+ logger$3B.error("block is not writable");
26985
26948
  return;
26986
26949
  }
26987
26950
  const oldText = editor.getBlockText(block);
@@ -26994,7 +26957,7 @@ var __publicField = (obj, key, value) => {
26994
26957
  const ops = RichText.diff(oldText, newText);
26995
26958
  return editorUpdateBlockText(editor, block, ops);
26996
26959
  }
26997
- const logger$3B = getLogger("update-block-data");
26960
+ const logger$3A = getLogger("update-block-data");
26998
26961
  function editorUpdateBlockData(editor, block, data2, newRange, options) {
26999
26962
  const container = getParentContainer(block);
27000
26963
  const containerId = getContainerId(container);
@@ -27011,17 +26974,17 @@ var __publicField = (obj, key, value) => {
27011
26974
  if (oldKey === "id" || oldKey === "type" || oldKey === "text") {
27012
26975
  return;
27013
26976
  }
27014
- logger$3B.debug(`delete key: ${oldKey}`);
26977
+ logger$3A.debug(`delete key: ${oldKey}`);
27015
26978
  delta.delete.push(oldKey);
27016
26979
  }
27017
26980
  });
27018
26981
  const entries = Object.entries(data2);
27019
26982
  entries.forEach(([key, value]) => {
27020
- assert(logger$3B, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
26983
+ assert(logger$3A, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
27021
26984
  const oldValue = oldData[key];
27022
26985
  if (value === null || value === void 0) {
27023
26986
  if (oldValue !== null && oldValue !== void 0) {
27024
- logger$3B.debug(`delete key: ${key}`);
26987
+ logger$3A.debug(`delete key: ${key}`);
27025
26988
  delta.delete.push(key);
27026
26989
  }
27027
26990
  return;
@@ -27039,10 +27002,10 @@ var __publicField = (obj, key, value) => {
27039
27002
  }
27040
27003
  }
27041
27004
  if (oldKeys.has(key)) {
27042
- logger$3B.debug(`replace key: ${key}`);
27005
+ logger$3A.debug(`replace key: ${key}`);
27043
27006
  delta.delete.push(key);
27044
27007
  } else {
27045
- logger$3B.debug(`insert key: ${key}`);
27008
+ logger$3A.debug(`insert key: ${key}`);
27046
27009
  }
27047
27010
  delta.insert[key] = value;
27048
27011
  });
@@ -27087,13 +27050,13 @@ var __publicField = (obj, key, value) => {
27087
27050
  comments: {}
27088
27051
  };
27089
27052
  }
27090
- const logger$3A = getLogger("clone-block");
27053
+ const logger$3z = getLogger("clone-block");
27091
27054
  function cloneBlock(editorBlocks, oldDoc, data2, info) {
27092
27055
  var _a;
27093
27056
  const blockClass = editorBlocks.getBlockClass(data2.type);
27094
27057
  if (blockClass.blockToDoc) {
27095
27058
  return blockClass.blockToDoc(oldDoc, data2, (oldDoc2, childBlock) => {
27096
- assert(logger$3A, data2 !== childBlock, "invalid child block");
27059
+ assert(logger$3z, data2 !== childBlock, "invalid child block");
27097
27060
  return cloneBlock(editorBlocks, oldDoc2, data2, info);
27098
27061
  }, info);
27099
27062
  }
@@ -27106,7 +27069,7 @@ var __publicField = (obj, key, value) => {
27106
27069
  }
27107
27070
  const newChildContainerId = genId();
27108
27071
  const childBlocks = oldDoc.blocks[oldChildContainerId];
27109
- assert(logger$3A, Array.isArray(childBlocks), "invalid child blocks");
27072
+ assert(logger$3z, Array.isArray(childBlocks), "invalid child blocks");
27110
27073
  const newDocs = childBlocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
27111
27074
  const newDoc = mergeDocs(newDocs);
27112
27075
  const { root: root2, ...childContainersData } = newDoc.blocks;
@@ -27135,7 +27098,7 @@ var __publicField = (obj, key, value) => {
27135
27098
  if (key.startsWith(prefix1)) {
27136
27099
  const keyContent = key.substring(prefix1.length);
27137
27100
  const newKey = `${newContainerId}/${keyContent}`;
27138
- logger$3A.debug(`replace key: ${key} -> ${newKey}`);
27101
+ logger$3z.debug(`replace key: ${key} -> ${newKey}`);
27139
27102
  return newKey;
27140
27103
  }
27141
27104
  }
@@ -27144,7 +27107,7 @@ var __publicField = (obj, key, value) => {
27144
27107
  if (key.startsWith(prefix2)) {
27145
27108
  const keyContent = key.substring(prefix2.length);
27146
27109
  const newKey = `${newContainerId}_${keyContent}`;
27147
- logger$3A.debug(`replace key: ${key} -> ${newKey}`);
27110
+ logger$3z.debug(`replace key: ${key} -> ${newKey}`);
27148
27111
  return newKey;
27149
27112
  }
27150
27113
  }
@@ -27174,7 +27137,7 @@ var __publicField = (obj, key, value) => {
27174
27137
  }
27175
27138
  function cloneChildContainer(editorBlocks, oldDoc, containerId, info) {
27176
27139
  const blocks = oldDoc.blocks[containerId];
27177
- assert(logger$3A, Array.isArray(blocks), "invalid child blocks");
27140
+ assert(logger$3z, Array.isArray(blocks), "invalid child blocks");
27178
27141
  const newDocs = blocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
27179
27142
  const newDoc = mergeDocs(newDocs);
27180
27143
  return newDoc;
@@ -27183,10 +27146,10 @@ var __publicField = (obj, key, value) => {
27183
27146
  const docs = doc2.blocks.root.map((b) => cloneBlock(editor.editorBlocks, doc2, b, info));
27184
27147
  return cloneDeep__default.default(mergeDocs(docs));
27185
27148
  }
27186
- const logger$3z = getLogger("insert-doc");
27149
+ const logger$3y = getLogger("insert-doc");
27187
27150
  function editorInsertDoc(editor, block, offset, insertedDoc, cloneDocResult) {
27188
27151
  if (isComplexKindBlock(editor, block)) {
27189
- logger$3z.warn("failed to insert doc into a complex block");
27152
+ logger$3y.warn("failed to insert doc into a complex block");
27190
27153
  return;
27191
27154
  }
27192
27155
  const doc2 = cloneDoc(editor, insertedDoc, cloneDocResult);
@@ -27220,7 +27183,7 @@ var __publicField = (obj, key, value) => {
27220
27183
  }
27221
27184
  return;
27222
27185
  }
27223
- assert(logger$3z, isTextKindBlock(editor, block), "not a text block");
27186
+ assert(logger$3y, isTextKindBlock(editor, block), "not a text block");
27224
27187
  if (isEmptyTextBlock(editor, block)) {
27225
27188
  const blockIndex2 = getBlockIndex(block);
27226
27189
  let lastBlock22;
@@ -27352,11 +27315,11 @@ var __publicField = (obj, key, value) => {
27352
27315
  editor.deleteBlock(block);
27353
27316
  }
27354
27317
  }
27355
- const logger$3y = getLogger("add-text-attribute");
27318
+ const logger$3x = getLogger("add-text-attribute");
27356
27319
  function editorRemoveTextAttribute(editor, block, range, attributeName) {
27357
27320
  const { start, end } = range;
27358
- assert(logger$3y, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
27359
- assert(logger$3y, attributeName, "invalid attribute name");
27321
+ assert(logger$3x, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
27322
+ assert(logger$3x, attributeName, "invalid attribute name");
27360
27323
  const oldText = editor.getBlockText(block);
27361
27324
  const newText = rangeRemoveAttribute(start.offset, end.offset - start.offset, oldText, attributeName, void 0, { ignoreValue: true });
27362
27325
  editor.setBlockText(block, newText);
@@ -27364,8 +27327,8 @@ var __publicField = (obj, key, value) => {
27364
27327
  }
27365
27328
  function editorAddTextAttribute(editor, block, range, attributeName, value) {
27366
27329
  const { start, end } = range;
27367
- assert(logger$3y, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
27368
- assert(logger$3y, attributeName, "invalid attribute name");
27330
+ assert(logger$3x, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
27331
+ assert(logger$3x, attributeName, "invalid attribute name");
27369
27332
  const oldText = editor.getBlockText(block);
27370
27333
  const newText = rangeAddAttribute(start.offset, end.offset - start.offset, oldText, attributeName, value);
27371
27334
  editor.setBlockText(block, newText);
@@ -27373,7 +27336,7 @@ var __publicField = (obj, key, value) => {
27373
27336
  }
27374
27337
  function editorSetTextColor(editor, block, range, type, value) {
27375
27338
  const { start, end } = range;
27376
- assert(logger$3y, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
27339
+ assert(logger$3x, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
27377
27340
  const oldText = editor.getBlockText(block);
27378
27341
  const newText = rangeSetTextColor(start.offset, end.offset - start.offset, oldText, type, value);
27379
27342
  editor.setBlockText(block, newText);
@@ -27462,10 +27425,10 @@ var __publicField = (obj, key, value) => {
27462
27425
  });
27463
27426
  return [color, backgroundColor];
27464
27427
  }
27465
- const logger$3x = getLogger("move-complex-block-position");
27428
+ const logger$3w = getLogger("move-complex-block-position");
27466
27429
  function moveComplexBlockPosition(editor, old, type) {
27467
27430
  const block = editor.getBlockById(old.blockId);
27468
- assert(logger$3x, isComplexKindBlock(editor, block), "is not a complex block");
27431
+ assert(logger$3w, isComplexKindBlock(editor, block), "is not a complex block");
27469
27432
  const blockClass = getComplexBlockClass(editor, block);
27470
27433
  const focusedContainer = editor.getContainerById(old.childContainerId);
27471
27434
  const nextContainer = blockClass.getNextContainer(editor, block, focusedContainer, type, { noWrap: true });
@@ -27474,24 +27437,24 @@ var __publicField = (obj, key, value) => {
27474
27437
  }
27475
27438
  return createComplexBlockPosition(block, getContainerId(nextContainer));
27476
27439
  }
27477
- const logger$3w = getLogger("move-simple-block-position");
27440
+ const logger$3v = getLogger("move-simple-block-position");
27478
27441
  function getFirstChildBlockInComplexBlock(editor, complexBlock) {
27479
27442
  const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
27480
27443
  if (containers.length === 0) {
27481
- logger$3w.warn("complex block has not any child container, not loaded?");
27444
+ logger$3v.warn("complex block has not any child container, not loaded?");
27482
27445
  return null;
27483
27446
  }
27484
- assert(logger$3w, containers.length > 0, "complex block has not any child container");
27447
+ assert(logger$3v, containers.length > 0, "complex block has not any child container");
27485
27448
  const container = containers[0];
27486
27449
  return getFirstChildBlock(container);
27487
27450
  }
27488
27451
  function getLastChildBlockInComplexBlock(editor, complexBlock) {
27489
27452
  const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
27490
27453
  if (containers.length === 0) {
27491
- logger$3w.warn("complex block has not any child container, not loaded?");
27454
+ logger$3v.warn("complex block has not any child container, not loaded?");
27492
27455
  return null;
27493
27456
  }
27494
- assert(logger$3w, containers.length > 0, "complex block has not any child container");
27457
+ assert(logger$3v, containers.length > 0, "complex block has not any child container");
27495
27458
  const container = containers[containers.length - 1];
27496
27459
  return getLastChildBlock(container);
27497
27460
  }
@@ -27536,8 +27499,8 @@ var __publicField = (obj, key, value) => {
27536
27499
  return null;
27537
27500
  }
27538
27501
  const parentComplexBlock = getParentBlock(container);
27539
- assert(logger$3w, parentComplexBlock, "child container has not parent block");
27540
- assert(logger$3w, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
27502
+ assert(logger$3v, parentComplexBlock, "child container has not parent block");
27503
+ assert(logger$3v, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
27541
27504
  const nextContainer = getComplexBlockClass(editor, parentComplexBlock).getNextContainer(editor, parentComplexBlock, container, type);
27542
27505
  if (nextContainer) {
27543
27506
  if (isFindPrev(type)) {
@@ -27559,7 +27522,7 @@ var __publicField = (obj, key, value) => {
27559
27522
  return null;
27560
27523
  }
27561
27524
  const parentBlock = getParentBlock(container);
27562
- assert(logger$3w, parentBlock, "child container has not parent block");
27525
+ assert(logger$3v, parentBlock, "child container has not parent block");
27563
27526
  if (isFindPrev(type)) {
27564
27527
  const prev = getPrevBlock(parentBlock);
27565
27528
  if (prev) {
@@ -27614,7 +27577,7 @@ var __publicField = (obj, key, value) => {
27614
27577
  }
27615
27578
  if (!targetBlock) {
27616
27579
  if (isComplexKindBlock(editor, block) && complexBlockGetAllChildContainers(editor, block).length === 0) {
27617
- logger$3w.warn("complex block has not any child container, not loaded?");
27580
+ logger$3v.warn("complex block has not any child container, not loaded?");
27618
27581
  targetBlock = direction === "ArrowDown" || direction === "ArrowRight" ? getNextVisibleBlock(block) : getPrevVisibleBlock(block);
27619
27582
  }
27620
27583
  }
@@ -27761,10 +27724,10 @@ var __publicField = (obj, key, value) => {
27761
27724
  editorAdjustSelection(editor, "ArrowUp", "select");
27762
27725
  return true;
27763
27726
  }
27764
- const logger$3v = getLogger("word-offset");
27727
+ const logger$3u = getLogger("word-offset");
27765
27728
  function editorGetWordLeftPos(editor, type) {
27766
27729
  const old = editor.selection.range.focus;
27767
- assert(logger$3v, old.isSimple(), "invalid range type");
27730
+ assert(logger$3u, old.isSimple(), "invalid range type");
27768
27731
  const block = editor.getBlockById(old.blockId);
27769
27732
  if (isEmptyTextBlock(editor, block)) {
27770
27733
  return createSimpleBlockPosition(block, 0, "home");
@@ -27789,7 +27752,7 @@ var __publicField = (obj, key, value) => {
27789
27752
  }
27790
27753
  function editorGetWordRightPos(editor, type) {
27791
27754
  const old = editor.selection.range.focus;
27792
- assert(logger$3v, old.isSimple(), "invalid range type");
27755
+ assert(logger$3u, old.isSimple(), "invalid range type");
27793
27756
  const block = editor.getBlockById(old.blockId);
27794
27757
  if (isEmptyTextBlock(editor, block)) {
27795
27758
  return createSimpleBlockPosition(block, 0, "end");
@@ -27901,10 +27864,10 @@ var __publicField = (obj, key, value) => {
27901
27864
  editor.selection.setSelection(editor.selection.getAnchorPos(), pos);
27902
27865
  return true;
27903
27866
  }
27904
- const logger$3u = getLogger("line-offset");
27867
+ const logger$3t = getLogger("line-offset");
27905
27868
  function editorGetLineHomePos(editor) {
27906
27869
  const old = editor.selection.range.focus;
27907
- assert(logger$3u, old.isSimple(), "invalid range type");
27870
+ assert(logger$3t, old.isSimple(), "invalid range type");
27908
27871
  const block = editor.getBlockById(old.blockId);
27909
27872
  if (old.offset === 0 || !isTextKindBlock(editor, block)) {
27910
27873
  const newPos2 = createSimpleBlockPosition(block, 0, "home");
@@ -27921,7 +27884,7 @@ var __publicField = (obj, key, value) => {
27921
27884
  }
27922
27885
  function editorGetLineEndPos(editor) {
27923
27886
  const old = editor.selection.range.focus;
27924
- assert(logger$3u, old.isSimple(), "invalid range type");
27887
+ assert(logger$3t, old.isSimple(), "invalid range type");
27925
27888
  const block = editor.getBlockById(old.blockId);
27926
27889
  if (old.offset === getBlockTextLength$6(editor, block) || !isTextKindBlock(editor, block)) {
27927
27890
  const newPos2 = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
@@ -28021,7 +27984,7 @@ var __publicField = (obj, key, value) => {
28021
27984
  editorPageDownScroll(editor);
28022
27985
  return true;
28023
27986
  }
28024
- const logger$3t = getLogger("table-scroll");
27987
+ const logger$3s = getLogger("table-scroll");
28025
27988
  class DomEventHandler {
28026
27989
  constructor(editor, dom, name, handler, data2, options) {
28027
27990
  __publicField(this, "handleEvent", (event) => {
@@ -28053,7 +28016,7 @@ var __publicField = (obj, key, value) => {
28053
28016
  const existsHandlers = this.handlers.get(element);
28054
28017
  if (existsHandlers) {
28055
28018
  if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
28056
- logger$3t.warn(`event has already registered: ${eventName}`);
28019
+ logger$3s.warn(`event has already registered: ${eventName}`);
28057
28020
  return;
28058
28021
  }
28059
28022
  existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
@@ -28163,7 +28126,7 @@ var __publicField = (obj, key, value) => {
28163
28126
  });
28164
28127
  return true;
28165
28128
  }
28166
- const logger$3s = getLogger("select-all");
28129
+ const logger$3r = getLogger("select-all");
28167
28130
  function isContainerSelectedAllChildBlocks(container, range) {
28168
28131
  const firstBlock = getFirstChildBlock(container);
28169
28132
  const lastBlock2 = getLastChildBlock(container);
@@ -28178,8 +28141,8 @@ var __publicField = (obj, key, value) => {
28178
28141
  return range.start.blockId === blockId && range.start.childContainerId === getContainerId(first) && range.end.blockId === blockId && range.end.childContainerId === getContainerId(last);
28179
28142
  }
28180
28143
  function selectComplexBlock(editor, block) {
28181
- assert(logger$3s, block, "no parent block");
28182
- assert(logger$3s, isComplexKindBlock(editor, block), "not a complex block");
28144
+ assert(logger$3r, block, "no parent block");
28145
+ assert(logger$3r, isComplexKindBlock(editor, block), "not a complex block");
28183
28146
  const containers = getComplexBlockClass(editor, block).getChildContainers(editor, block);
28184
28147
  const first = containers[0];
28185
28148
  const last = containers[containers.length - 1];
@@ -28215,13 +28178,13 @@ var __publicField = (obj, key, value) => {
28215
28178
  selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
28216
28179
  return false;
28217
28180
  }
28218
- assert(logger$3s, !range.isSimple(), "invalid range type");
28181
+ assert(logger$3r, !range.isSimple(), "invalid range type");
28219
28182
  if (isComplexBlockSelectedAllChildContainer(focusedBlock, range)) {
28220
28183
  selectParentContainer(editor, focusedBlock);
28221
28184
  return false;
28222
28185
  }
28223
- assert(logger$3s, focusedBlock, "no parent block");
28224
- assert(logger$3s, isComplexKindBlock(editor, focusedBlock), "not a complex block");
28186
+ assert(logger$3r, focusedBlock, "no parent block");
28187
+ assert(logger$3r, isComplexKindBlock(editor, focusedBlock), "not a complex block");
28225
28188
  selectComplexBlock(editor, focusedBlock);
28226
28189
  return true;
28227
28190
  }
@@ -28257,30 +28220,6 @@ var __publicField = (obj, key, value) => {
28257
28220
  }
28258
28221
  editor.selection.setSelection(newStartPos, newEndPos);
28259
28222
  }
28260
- function editorMoveBlockStart(editor) {
28261
- const focus = editor.selection.range.focus;
28262
- const block = editor.getBlockById(focus.blockId);
28263
- if (!block)
28264
- return false;
28265
- if (!isSimpleBlock(editor, block))
28266
- return false;
28267
- const newPos = createSimpleBlockPosition(block, 0, "home");
28268
- editor.selection.setSelection(newPos);
28269
- editor.selection.updateLastCaretRect();
28270
- return true;
28271
- }
28272
- function editorMoveBlockEnd(editor) {
28273
- const focus = editor.selection.range.focus;
28274
- const block = editor.getBlockById(focus.blockId);
28275
- if (!block)
28276
- return false;
28277
- if (!isSimpleBlock(editor, block))
28278
- return false;
28279
- const newPos = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
28280
- editor.selection.setSelection(newPos);
28281
- editor.selection.updateLastCaretRect();
28282
- return true;
28283
- }
28284
28223
  function editorFocusToEnd(editor) {
28285
28224
  editorSelectEnd(editor);
28286
28225
  editor.focus();
@@ -28360,7 +28299,7 @@ var __publicField = (obj, key, value) => {
28360
28299
  }
28361
28300
  return cloned;
28362
28301
  }
28363
- const logger$3r = getLogger("selected-block-to-doc");
28302
+ const logger$3q = getLogger("selected-block-to-doc");
28364
28303
  function appendBlockChildren(editor, data2, doc2) {
28365
28304
  if (!data2.children)
28366
28305
  return;
@@ -28381,7 +28320,7 @@ var __publicField = (obj, key, value) => {
28381
28320
  if (isTextKindBlock(editor, selectedBlock.block)) {
28382
28321
  const start = selectedBlock.start;
28383
28322
  const end = selectedBlock.end;
28384
- assert(logger$3r, data2.text, "no block text");
28323
+ assert(logger$3q, data2.text, "no block text");
28385
28324
  if (start.offset === end.offset) {
28386
28325
  return {
28387
28326
  blocks: {
@@ -28415,8 +28354,8 @@ var __publicField = (obj, key, value) => {
28415
28354
  comments: {}
28416
28355
  };
28417
28356
  }
28418
- assert(logger$3r, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
28419
- assert(logger$3r, data2.children, "no children");
28357
+ assert(logger$3q, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
28358
+ assert(logger$3q, data2.children, "no children");
28420
28359
  const ret = {
28421
28360
  blocks: {
28422
28361
  root: [
@@ -28434,9 +28373,9 @@ var __publicField = (obj, key, value) => {
28434
28373
  const end = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
28435
28374
  return selectedBlockToDoc(editor, { block, start, end });
28436
28375
  }
28437
- const logger$3q = getLogger("block-to-doc");
28376
+ const logger$3p = getLogger("block-to-doc");
28438
28377
  function blocksToDoc(editor, blocks) {
28439
- assert(logger$3q, blocks.length > 0, "invalid params, no blocks");
28378
+ assert(logger$3p, blocks.length > 0, "invalid params, no blocks");
28440
28379
  const docs = blocks.map((b) => blockToDoc(editor, b));
28441
28380
  return mergeDocs(docs);
28442
28381
  }
@@ -28456,7 +28395,7 @@ var __publicField = (obj, key, value) => {
28456
28395
  const newDocs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
28457
28396
  return mergeDocs(newDocs);
28458
28397
  }
28459
- const logger$3p = getLogger("ensure-block-visible");
28398
+ const logger$3o = getLogger("ensure-block-visible");
28460
28399
  function ensureBlockVisible(editor, block) {
28461
28400
  var _a;
28462
28401
  while (block) {
@@ -28466,16 +28405,16 @@ var __publicField = (obj, key, value) => {
28466
28405
  return;
28467
28406
  }
28468
28407
  const parentComplexBlock = getParentBlock(container);
28469
- assert(logger$3p, parentComplexBlock, "no parent block");
28408
+ assert(logger$3o, parentComplexBlock, "no parent block");
28470
28409
  const parentComplexBlockClass = getBlockClass(editor, parentComplexBlock);
28471
28410
  if (parentComplexBlockClass.isChildContainerVisible && !((_a = parentComplexBlockClass.isChildContainerVisible) == null ? void 0 : _a.call(parentComplexBlockClass, editor, parentComplexBlock, container))) {
28472
- assert(logger$3p, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
28411
+ assert(logger$3o, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
28473
28412
  parentComplexBlockClass.showChildContainer(editor, parentComplexBlock, container);
28474
28413
  }
28475
28414
  block = parentComplexBlock;
28476
28415
  }
28477
28416
  }
28478
- const logger$3o = getLogger("editor-selection");
28417
+ const logger$3n = getLogger("editor-selection");
28479
28418
  class EditorSelection {
28480
28419
  constructor(editor) {
28481
28420
  __publicField(this, "editor");
@@ -28488,7 +28427,7 @@ var __publicField = (obj, key, value) => {
28488
28427
  }
28489
28428
  const range = this.range;
28490
28429
  if (rangeInBlock(deletedBlock, range)) {
28491
- logger$3o.debug("adjust selection because remote deleted current block");
28430
+ logger$3n.debug("adjust selection because remote deleted current block");
28492
28431
  const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
28493
28432
  this.setRange(newRange, { noScroll: true });
28494
28433
  }
@@ -28613,14 +28552,14 @@ var __publicField = (obj, key, value) => {
28613
28552
  if (pos.isSimple()) {
28614
28553
  const ok = pos.offset >= 0 && pos.offset <= getBlockTextLength$6(this.editor, block);
28615
28554
  if (!ok) {
28616
- assert(logger$3o, false, "invalid block position, out of range");
28555
+ assert(logger$3n, false, "invalid block position, out of range");
28617
28556
  }
28618
28557
  } else {
28619
28558
  const childContainerId = pos.childContainerId;
28620
28559
  const container = this.editor.getContainerById(childContainerId);
28621
28560
  const ok = !!container;
28622
28561
  if (!ok) {
28623
- assert(logger$3o, false, "invalid complex block position, no container found");
28562
+ assert(logger$3n, false, "invalid complex block position, no container found");
28624
28563
  }
28625
28564
  }
28626
28565
  }
@@ -28681,7 +28620,7 @@ var __publicField = (obj, key, value) => {
28681
28620
  let container = getParentContainer(block);
28682
28621
  while (isChildContainer(container)) {
28683
28622
  const parentBlock = getParentBlock(container);
28684
- assert(logger$3o, parentBlock, "parent block not found");
28623
+ assert(logger$3n, parentBlock, "parent block not found");
28685
28624
  addClass(parentBlock, "child-focused");
28686
28625
  container = getParentContainer(parentBlock);
28687
28626
  }
@@ -28791,15 +28730,15 @@ var __publicField = (obj, key, value) => {
28791
28730
  editor.undoManager.redo();
28792
28731
  return true;
28793
28732
  }
28794
- const logger$3n = getLogger("delete-text");
28733
+ const logger$3m = getLogger("delete-text");
28795
28734
  function editorDeleteText(editor, type, count, insertPos) {
28796
28735
  const pos = insertPos != null ? insertPos : editor.selection.range.start;
28797
28736
  if (!(pos instanceof EditorSimpleBlockPosition)) {
28798
- assert(logger$3n, false, `invalid insert pos type: ${typeof pos}`);
28737
+ assert(logger$3m, false, `invalid insert pos type: ${typeof pos}`);
28799
28738
  }
28800
28739
  const { blockId } = pos;
28801
28740
  const block = editor.getBlockById(blockId);
28802
- assert(logger$3n, isTextKindBlock(editor, block), "block is not a text kind block");
28741
+ assert(logger$3m, isTextKindBlock(editor, block), "block is not a text kind block");
28803
28742
  let { offset } = pos;
28804
28743
  if (type === "backward") {
28805
28744
  if (offset - count < 0) {
@@ -28829,7 +28768,7 @@ var __publicField = (obj, key, value) => {
28829
28768
  }
28830
28769
  return false;
28831
28770
  }
28832
- const logger$3m = getLogger("handle-backspace");
28771
+ const logger$3l = getLogger("handle-backspace");
28833
28772
  function tryDeleteEmptyBlock(editor, block) {
28834
28773
  if (!isEmptyTextBlock(editor, block)) {
28835
28774
  return;
@@ -28869,7 +28808,7 @@ var __publicField = (obj, key, value) => {
28869
28808
  }
28870
28809
  } else {
28871
28810
  tryDeleteEmptyBlock(editor, block);
28872
- assert(logger$3m, isEmbedBlock(prevBlock), "prev block is not embed block");
28811
+ assert(logger$3l, isEmbedBlock(prevBlock), "prev block is not embed block");
28873
28812
  editor.selection.selectBlock(prevBlock, 1);
28874
28813
  }
28875
28814
  } else {
@@ -28896,7 +28835,6 @@ var __publicField = (obj, key, value) => {
28896
28835
  editor.deleteBlock(block);
28897
28836
  }
28898
28837
  }
28899
- const logger$3l = getLogger("word-offset");
28900
28838
  function handleEditorDelete(editor, event) {
28901
28839
  if (!editor.selection.range.isCollapsed()) {
28902
28840
  editor.clearSelectedContents();
@@ -28931,130 +28869,6 @@ var __publicField = (obj, key, value) => {
28931
28869
  editor.deleteBlock(block);
28932
28870
  }
28933
28871
  }
28934
- function handleEditorDeleteLeftWord(editor, event) {
28935
- const old = editor.selection.range.focus;
28936
- assert(logger$3l, old.isSimple(), "invalid range type");
28937
- const block = editor.getBlockById(old.blockId);
28938
- if (!isTextKindBlock(editor, block)) {
28939
- editor.deleteBlock(block);
28940
- return true;
28941
- }
28942
- if (old.offset === 0) {
28943
- const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
28944
- if (!isTextKindBlock(editor, block2))
28945
- return true;
28946
- return !isEmptyTextBlock(editor, block2);
28947
- };
28948
- const prevBlock = getPrevVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
28949
- if (!prevBlock)
28950
- return false;
28951
- const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
28952
- const emptyTextBlocks = getBlocksBetween(prevBlock, block, matchEmptyTextBlock);
28953
- emptyTextBlocks.forEach((b) => {
28954
- editor.deleteBlock(b);
28955
- });
28956
- if (!isTextKindBlock(editor, prevBlock)) {
28957
- editor.deleteBlock(prevBlock);
28958
- return true;
28959
- }
28960
- const textBlockLen = getBlockTextLength$6(editor, prevBlock);
28961
- const newOffset2 = findWordLeft(editor, prevBlock, textBlockLen);
28962
- editor.deleteTextFromBlock(prevBlock, newOffset2, textBlockLen - newOffset2);
28963
- const currentBlockText = editor.getBlockText(block);
28964
- editor.insertTextToBlock(prevBlock, newOffset2, currentBlockText);
28965
- editor.deleteBlock(block);
28966
- const pos = createSimpleBlockPosition(prevBlock, newOffset2, "normal");
28967
- editor.selection.setSelection(pos);
28968
- editor.selection.updateLastCaretRect();
28969
- return true;
28970
- }
28971
- const newOffset = findWordLeft(editor, block, old.offset);
28972
- const deletedCount = old.offset - newOffset;
28973
- editor.deleteTextFromBlock(block, newOffset, deletedCount);
28974
- return true;
28975
- }
28976
- function handleEditorDeleteRightWord(editor, event) {
28977
- const old = editor.selection.range.focus;
28978
- assert(logger$3l, old.isSimple(), "invalid range type");
28979
- const block = editor.getBlockById(old.blockId);
28980
- if (!isTextKindBlock(editor, block)) {
28981
- editor.deleteBlock(block);
28982
- return true;
28983
- }
28984
- if (old.offset === getTextBlockLength(block)) {
28985
- const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
28986
- if (!isTextKindBlock(editor, block2))
28987
- return true;
28988
- return !isEmptyTextBlock(editor, block2);
28989
- };
28990
- const nextBlock = getNextVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
28991
- if (!nextBlock)
28992
- return false;
28993
- const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
28994
- const emptyTextBlocks = getBlocksBetween(block, nextBlock, matchEmptyTextBlock);
28995
- emptyTextBlocks.forEach((b) => {
28996
- editor.deleteBlock(b);
28997
- });
28998
- if (!isTextKindBlock(editor, nextBlock)) {
28999
- editor.deleteBlock(nextBlock);
29000
- return true;
29001
- }
29002
- const newOffset = findWordEnd(editor, nextBlock, 0);
29003
- editor.deleteTextFromBlock(nextBlock, 0, newOffset);
29004
- const nextBlockText = editor.getBlockText(nextBlock);
29005
- editor.insertTextToBlock(block, old.offset, nextBlockText);
29006
- editor.deleteBlock(nextBlock);
29007
- const pos = createSimpleBlockPosition(block, old.offset, "normal");
29008
- editor.selection.setSelection(pos);
29009
- editor.selection.updateLastCaretRect();
29010
- return true;
29011
- }
29012
- const endOffset = findWordEnd(editor, block, old.offset);
29013
- const deletedCount = endOffset - old.offset;
29014
- editor.deleteTextFromBlock(block, old.offset, deletedCount);
29015
- return true;
29016
- }
29017
- function handleEditorDeleteAfterWords(editor) {
29018
- const old = editor.selection.range.focus;
29019
- assert(logger$3l, old.isSimple(), "invalid range type");
29020
- const block = editor.getBlockById(old.blockId);
29021
- if (!isTextKindBlock(editor, block)) {
29022
- editor.deleteBlock(block);
29023
- return;
29024
- }
29025
- const needDeleteCount = getTextBlockLength(block) - old.offset;
29026
- if (needDeleteCount === 0)
29027
- return;
29028
- editor.deleteTextFromBlock(block, old.offset, needDeleteCount);
29029
- }
29030
- function handleEditorDeleteRightChar(editor) {
29031
- const old = editor.selection.range.focus;
29032
- assert(logger$3l, old.isSimple(), "invalid range type");
29033
- const block = editor.getBlockById(old.blockId);
29034
- if (!isTextKindBlock(editor, block)) {
29035
- editor.deleteBlock(block);
29036
- return;
29037
- }
29038
- if (old.offset === getBlockTextLength$6(editor, block)) {
29039
- const nextVisibleBlock = getNextVisibleBlock(block);
29040
- if (!nextVisibleBlock)
29041
- return;
29042
- if (!isTextKindBlock(editor, nextVisibleBlock))
29043
- return;
29044
- if (isEmptyTextBlock(editor, nextVisibleBlock)) {
29045
- editor.deleteBlock(nextVisibleBlock);
29046
- return;
29047
- }
29048
- const nextBlockText = editor.getBlockText(nextVisibleBlock);
29049
- editor.deleteBlock(nextVisibleBlock);
29050
- editor.insertTextToBlock(block, old.offset, nextBlockText);
29051
- const pos = createSimpleBlockPosition(block, old.offset, "normal");
29052
- editor.selection.setSelection(pos);
29053
- editor.selection.updateLastCaretRect();
29054
- return;
29055
- }
29056
- editorDeleteText(editor, "forward", 1, null);
29057
- }
29058
28872
  function handleEditorEnterEvent$1(editor, event) {
29059
28873
  if (isFullSelectedOneComplexBlock(editor)) {
29060
28874
  const focusedBlock2 = editor.getFocusedBlock();
@@ -29276,42 +29090,6 @@ var __publicField = (obj, key, value) => {
29276
29090
  return true;
29277
29091
  });
29278
29092
  }
29279
- function editorHandleDeleteLeftWord(editor, event) {
29280
- if (editor.readonly || !editor.isWritable()) {
29281
- return false;
29282
- }
29283
- return editor.undoManager.runInGroup(() => {
29284
- handleEditorDeleteLeftWord(editor);
29285
- return true;
29286
- });
29287
- }
29288
- function editorHandleDeleteRightWord(editor, event) {
29289
- if (editor.readonly || !editor.isWritable()) {
29290
- return false;
29291
- }
29292
- return editor.undoManager.runInGroup(() => {
29293
- handleEditorDeleteRightWord(editor);
29294
- return true;
29295
- });
29296
- }
29297
- function editorHandleDeleteAfterWords(editor, event) {
29298
- if (editor.readonly || !editor.isWritable()) {
29299
- return false;
29300
- }
29301
- return editor.undoManager.runInGroup(() => {
29302
- handleEditorDeleteAfterWords(editor);
29303
- return true;
29304
- });
29305
- }
29306
- function editorHandleDeleteRightChar(editor, event) {
29307
- if (editor.readonly || !editor.isWritable()) {
29308
- return false;
29309
- }
29310
- return editor.undoManager.runInGroup(() => {
29311
- handleEditorDeleteRightChar(editor);
29312
- return true;
29313
- });
29314
- }
29315
29093
  function editorHandleBackspace(editor, event) {
29316
29094
  if (editor.readonly || !editor.isWritable()) {
29317
29095
  return false;
@@ -29405,10 +29183,6 @@ ${codeText}
29405
29183
  __proto__: null,
29406
29184
  editorHandleEnter,
29407
29185
  editorHandleDelete,
29408
- editorHandleDeleteLeftWord,
29409
- editorHandleDeleteRightWord,
29410
- editorHandleDeleteAfterWords,
29411
- editorHandleDeleteRightChar,
29412
29186
  editorHandleBackspace,
29413
29187
  editorHandleInsertBr,
29414
29188
  editorHandlePastePlainText,
@@ -29416,41 +29190,6 @@ ${codeText}
29416
29190
  getSelectedCodeBlockMarkdown,
29417
29191
  editorHandleCopyMarkdown
29418
29192
  }, Symbol.toStringTag, { value: "Module" }));
29419
- const MacShortcuts = {
29420
- "Cmd+ArrowLeft": editorMoveLineHome,
29421
- "Cmd+ArrowRight": editorMoveLineEnd,
29422
- "Option+ArrowLeft": editorMoveWordLeft,
29423
- "Option+ArrowRight": editorMoveWordEnd,
29424
- "Option+Shift+ArrowLeft": editorSelectWordLeft,
29425
- "Option+Shift+ArrowRight": editorSelectWordEnd,
29426
- "Cmd+Shift+ArrowLeft": editorSelectLineHome,
29427
- "Cmd+Shift+ArrowRight": editorSelectLineEnd,
29428
- "Ctrl+A": editorMoveBlockStart,
29429
- "Ctrl+E": editorMoveBlockEnd,
29430
- "Option+Delete": editorHandleDeleteRightWord,
29431
- "Option+Backspace": editorHandleDeleteLeftWord,
29432
- "Ctrl+B": editorMoveLeft,
29433
- "Ctrl+F": editorMoveRight,
29434
- "Ctrl+N": editorMoveDown,
29435
- "Ctrl+P": editorMoveUp,
29436
- "Ctrl+K": editorHandleDeleteAfterWords,
29437
- "Ctrl+H": editorHandleBackspace,
29438
- "Ctrl+D": editorHandleDeleteRightChar
29439
- };
29440
- const WinLinuxShortcuts = {
29441
- "Home": editorMoveLineHome,
29442
- "End": editorMoveLineEnd,
29443
- "Shift+Home": editorSelectLineHome,
29444
- "Shift+End": editorSelectLineEnd,
29445
- "Ctrl+Delete": editorHandleDeleteRightWord,
29446
- "Ctrl+Backspace": editorHandleDeleteLeftWord,
29447
- "Ctrl+ArrowLeft": editorMoveWordLeft,
29448
- "Ctrl+ArrowRight": editorMoveWordEnd,
29449
- "Ctrl+Shift+ArrowLeft": editorSelectWordLeft,
29450
- "Ctrl+Shift+ArrowRight": editorSelectWordEnd
29451
- };
29452
- const isMac = clientType.isMac;
29453
- const CustomShortcuts = isMac ? MacShortcuts : WinLinuxShortcuts;
29454
29193
  const DefaultShortcuts = {
29455
29194
  "ArrowDown": editorMoveDown,
29456
29195
  "ArrowUp": editorMoveUp,
@@ -29460,11 +29199,19 @@ ${codeText}
29460
29199
  "Shift+ArrowUp": editorSelectUp,
29461
29200
  "Shift+ArrowLeft": editorSelectLeft,
29462
29201
  "Shift+ArrowRight": editorSelectRight,
29202
+ "CtrlOrCmd+ArrowLeft": editorMoveWordLeft,
29203
+ "CtrlOrCmd+ArrowRight": editorMoveWordEnd,
29204
+ "CtrlOrCmd+Shift+ArrowLeft": editorSelectWordLeft,
29205
+ "CtrlOrCmd+Shift+ArrowRight": editorSelectWordEnd,
29463
29206
  "CtrlOrCmd+ArrowUp": editorMoveHome,
29464
29207
  "CtrlOrCmd+ArrowDown": editorMoveEnd,
29465
29208
  "CtrlOrCmd+Shift+ArrowUp": editorSelectHome,
29466
29209
  "CtrlOrCmd+Shift+ArrowDown": editorSelectEnd,
29467
29210
  "CtrlOrCmd+A": editorSelectAll,
29211
+ "Home": editorMoveLineHome,
29212
+ "End": editorMoveLineEnd,
29213
+ "Shift+Home": editorSelectLineHome,
29214
+ "Shift+End": editorSelectLineEnd,
29468
29215
  "PageUp": editorMovePageUp,
29469
29216
  "PageDown": editorMovePageDown,
29470
29217
  "Shift+PageUp": editorSelectPageUp,
@@ -29476,8 +29223,7 @@ ${codeText}
29476
29223
  "Backspace": editorHandleBackspace,
29477
29224
  "Shift+Enter": editorHandleInsertBr,
29478
29225
  "CtrlOrCmd+Shift+V": editorHandlePastePlainText,
29479
- "CtrlOrCmd+Shift+C": editorHandleCopyMarkdown,
29480
- ...CustomShortcuts
29226
+ "CtrlOrCmd+Shift+C": editorHandleCopyMarkdown
29481
29227
  };
29482
29228
  function editorHandleKeyboardEvent(editor, event) {
29483
29229
  const result = editor.shortcuts.handleKeyboardEvents(editor, event);
@@ -43255,21 +43001,8 @@ ${codeText}
43255
43001
  const textColorItem = "";
43256
43002
  const DEFAULT_BG_COLOR = 2;
43257
43003
  const NULLABLE_COLOR = -1;
43258
- const STORAGE_NAME = "color-item";
43259
- function getColorsFromLocalStorage(editor) {
43260
- const colors = [null, null];
43261
- const color = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-color`) || "", 10);
43262
- const backgroundColor = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-backgroundColor`) || `${DEFAULT_BG_COLOR}`, 10);
43263
- if (!Number.isNaN(color)) {
43264
- colors[0] = color;
43265
- }
43266
- if (!Number.isNaN(backgroundColor)) {
43267
- colors[1] = backgroundColor;
43268
- }
43269
- return colors;
43270
- }
43271
43004
  class TextColorItem extends tinyTypedEmitter.TypedEmitter {
43272
- constructor(editor, storageName = STORAGE_NAME) {
43005
+ constructor(editor, storageName = "color-item") {
43273
43006
  super();
43274
43007
  __publicField(this, "id", "text-color-item");
43275
43008
  __publicField(this, "name", i18n$1.t("colorPalette.name"));
@@ -50964,7 +50697,7 @@ ${codeText}
50964
50697
  }
50965
50698
  return handleDragList(editor, draggedBlock, targetBlock, insertPos);
50966
50699
  }
50967
- function executeShortcut$3(editor, type) {
50700
+ function executeShortcut$1(editor, type) {
50968
50701
  if (!editor.isWritable()) {
50969
50702
  return false;
50970
50703
  }
@@ -50978,8 +50711,8 @@ ${codeText}
50978
50711
  return true;
50979
50712
  }
50980
50713
  const ListBlockShortcuts = {
50981
- "Shift+CtrlOrCmd+L": (editor) => executeShortcut$3(editor, "ordered-list"),
50982
- "Shift+CtrlOrCmd+U": (editor) => executeShortcut$3(editor, "unordered-list")
50714
+ "Shift+CtrlOrCmd+L": (editor) => executeShortcut$1(editor, "ordered-list"),
50715
+ "Shift+CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "unordered-list")
50983
50716
  };
50984
50717
  function getBlockPadding$1(block) {
50985
50718
  const padding = block.getAttribute("block-padding-level");
@@ -61489,31 +61222,6 @@ $$${mathData.mathjaxText}$$
61489
61222
  return editor.addCustom("overflow-tooltip-helper", () => new OverflowTooltipHelper(editor));
61490
61223
  }
61491
61224
  }
61492
- function executeShortcut$2(editor, style2) {
61493
- if (!editor.isWritable()) {
61494
- return false;
61495
- }
61496
- const range = editor.selection.range;
61497
- const allCommands = editor.editorCommandProviders.getCommands(range);
61498
- const alignCommands = allCommands.flatMap((command2) => {
61499
- if (command2.id === "align") {
61500
- return command2.children;
61501
- }
61502
- return [];
61503
- });
61504
- const command = alignCommands.find((c) => c.id === `align-${style2}`);
61505
- if (!command) {
61506
- return false;
61507
- }
61508
- editor.editorCommandProviders.executeCommand(range, command, {});
61509
- OnesEditorToolbar.get(editor).update("selectionChange");
61510
- return true;
61511
- }
61512
- const AlignShortcuts = {
61513
- "CtrlOrCmd+Shift+E": (editor) => executeShortcut$2(editor, "center"),
61514
- "CtrlOrCmd+Shift+O": (editor) => executeShortcut$2(editor, "left"),
61515
- "CtrlOrCmd+Shift+R": (editor) => executeShortcut$2(editor, "right")
61516
- };
61517
61225
  const TextCommands = {
61518
61226
  "text/style-bold": "bold",
61519
61227
  "text/style-italic": "italic",
@@ -61522,15 +61230,14 @@ $$${mathData.mathjaxText}$$
61522
61230
  "text/style-code": "code",
61523
61231
  "text/style-sub": "subscript",
61524
61232
  "text/style-super": "superscript",
61525
- link: "link",
61526
- "insert-link": "link"
61233
+ link: "link"
61527
61234
  };
61528
61235
  function getTextCommands(editor, blockCommands) {
61529
61236
  const styleCommandsSet = new Set(Object.keys(TextCommands));
61530
61237
  const styleCommands = blockCommands.filter((command) => styleCommandsSet.has(command.id));
61531
61238
  return styleCommands;
61532
61239
  }
61533
- function executeShortcut$1(editor, style2) {
61240
+ function executeShortcut(editor, style2) {
61534
61241
  if (!editor.isWritable()) {
61535
61242
  return false;
61536
61243
  }
@@ -61540,7 +61247,7 @@ $$${mathData.mathjaxText}$$
61540
61247
  const range = editor.selection.range;
61541
61248
  const allCommands = editor.editorCommandProviders.getCommands(range);
61542
61249
  const textCommands = getTextCommands(editor, allCommands);
61543
- const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link" || c.id === "insert-link");
61250
+ const command = textCommands.find((c) => c.id === `text/${style2}` || c.id === "link");
61544
61251
  if (!command) {
61545
61252
  return false;
61546
61253
  }
@@ -61575,37 +61282,13 @@ $$${mathData.mathjaxText}$$
61575
61282
  return shortcuts2;
61576
61283
  };
61577
61284
  const TextStyleShortcuts = {
61578
- "CtrlOrCmd+B": (editor) => executeShortcut$1(editor, "style-bold"),
61579
- "CtrlOrCmd+I": (editor) => executeShortcut$1(editor, "style-italic"),
61580
- "CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "style-underline"),
61581
- "CtrlOrCmd+D": (editor) => executeShortcut$1(editor, "style-strikethrough"),
61582
- "CtrlOrCmd+K": (editor) => executeShortcut$1(editor, "insert-link"),
61285
+ "CtrlOrCmd+B": (editor) => executeShortcut(editor, "style-bold"),
61286
+ "CtrlOrCmd+I": (editor) => executeShortcut(editor, "style-italic"),
61287
+ "CtrlOrCmd+U": (editor) => executeShortcut(editor, "style-underline"),
61288
+ "CtrlOrCmd+D": (editor) => executeShortcut(editor, "style-strikethrough"),
61289
+ "CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
61583
61290
  ...headingShortcut()
61584
61291
  };
61585
- function executeShortcut(editor) {
61586
- if (!editor.isWritable()) {
61587
- return false;
61588
- }
61589
- const range = editor.selection.range;
61590
- if (range.isCollapsed()) {
61591
- return false;
61592
- }
61593
- editor.undoManager.runInGroup(() => {
61594
- const colors = getColorsFromLocalStorage(editor);
61595
- colors.forEach((color, idx) => {
61596
- if (color === null) {
61597
- return;
61598
- }
61599
- const type = idx === 0 ? "color" : "backgroundColor";
61600
- editorRangeSetColor(editor, type, color, () => {
61601
- });
61602
- });
61603
- });
61604
- return true;
61605
- }
61606
- const TextColorShortcuts = {
61607
- "CtrlOrCmd+Alt+KeyH": (editor) => executeShortcut(editor)
61608
- };
61609
61292
  const zhCN$p = {
61610
61293
  quickMenu: {
61611
61294
  basic: {
@@ -62364,7 +62047,7 @@ $$${mathData.mathjaxText}$$
62364
62047
  __publicField(this, "updateButtonColor", (range) => {
62365
62048
  const currentTextColor = editorRangeGetColor(this.editor, range, this.getEmptyTextBlockColor);
62366
62049
  this.colorItem.setCurrentTextColors(currentTextColor);
62367
- const lastButtonColor = getColorsFromLocalStorage(this.editor);
62050
+ const lastButtonColor = this.colorItem.getColorsFromLocalStorage();
62368
62051
  this.colorItem.setCurrentButtonColor(lastButtonColor);
62369
62052
  });
62370
62053
  __publicField(this, "setActiveAttribute", (type, value) => {
@@ -92219,11 +91902,9 @@ ${data2.plantumlText}
92219
91902
  FindReplaceShortcuts,
92220
91903
  BlockPaddingShortcuts,
92221
91904
  TextStyleShortcuts,
92222
- AlignShortcuts,
92223
91905
  AutoLinkShortcuts,
92224
91906
  DefaultShortcuts,
92225
91907
  ListBlockShortcuts,
92226
- TextColorShortcuts,
92227
91908
  ...options.shortcuts || []
92228
91909
  ],
92229
91910
  colors: [
@@ -92432,7 +92113,7 @@ ${data2.plantumlText}
92432
92113
  }
92433
92114
  }
92434
92115
  });
92435
- editor.version = "2.6.1-beta.4";
92116
+ editor.version = "2.7.1-beta.2";
92436
92117
  return editor;
92437
92118
  }
92438
92119
  function isDoc(doc2) {
@@ -92545,7 +92226,7 @@ ${data2.plantumlText}
92545
92226
  }
92546
92227
  });
92547
92228
  OnesEditorToolbar.register(editor);
92548
- editor.version = "2.6.1-beta.4";
92229
+ editor.version = "2.7.1-beta.2";
92549
92230
  return editor;
92550
92231
  }
92551
92232
  async function showDocVersions(editor, options, serverUrl) {
@@ -138331,7 +138012,6 @@ ${data2.plantumlText}
138331
138012
  exports2.AlignProvider = AlignProvider;
138332
138013
  exports2.AlignRightIcon = AlignRightIcon;
138333
138014
  exports2.AlignRightItem = AlignRightItem;
138334
- exports2.AlignShortcuts = AlignShortcuts;
138335
138015
  exports2.AnchorBox = AnchorBox;
138336
138016
  exports2.ArrowDownIcon = ArrowDownIcon$1;
138337
138017
  exports2.ArrowLeftIcon = arrowLeft;
@@ -138588,7 +138268,6 @@ ${data2.plantumlText}
138588
138268
  exports2.TextBox = TextBox;
138589
138269
  exports2.TextColorIcon = TextColorIcon;
138590
138270
  exports2.TextColorItem = TextColorItem;
138591
- exports2.TextColorShortcuts = TextColorShortcuts;
138592
138271
  exports2.TextCommandProvider = TextCommandProvider;
138593
138272
  exports2.TextGroupIcon = TextGroupIcon;
138594
138273
  exports2.TextIcon = TextIcon;
@@ -138758,8 +138437,6 @@ ${data2.plantumlText}
138758
138437
  exports2.editorInsertTextToBlock = editorInsertTextToBlock;
138759
138438
  exports2.editorInsertTextToBlockEx = editorInsertTextToBlockEx;
138760
138439
  exports2.editorMergeTextBlock = editorMergeTextBlock;
138761
- exports2.editorMoveBlockEnd = editorMoveBlockEnd;
138762
- exports2.editorMoveBlockStart = editorMoveBlockStart;
138763
138440
  exports2.editorMoveDown = editorMoveDown;
138764
138441
  exports2.editorMoveEnd = editorMoveEnd;
138765
138442
  exports2.editorMoveHome = editorMoveHome;
@@ -138864,7 +138541,6 @@ ${data2.plantumlText}
138864
138541
  exports2.getBlockTextLength = getBlockTextLength$6;
138865
138542
  exports2.getBlockTools = getBlockTools;
138866
138543
  exports2.getBlockType = getBlockType;
138867
- exports2.getBlocksBetween = getBlocksBetween;
138868
138544
  exports2.getBlocksWidth = getBlocksWidth;
138869
138545
  exports2.getBoxContent = getBoxContent;
138870
138546
  exports2.getBoxId = getBoxId;
@@ -138877,7 +138553,6 @@ ${data2.plantumlText}
138877
138553
  exports2.getClosestContainerByCondition = getClosestContainerByCondition;
138878
138554
  exports2.getColorFromAttributes = getColorFromAttributes;
138879
138555
  exports2.getColorFromContent = getColorFromContent;
138880
- exports2.getColorsFromLocalStorage = getColorsFromLocalStorage;
138881
138556
  exports2.getComplexBlockClass = getComplexBlockClass;
138882
138557
  exports2.getContainerBlockOverrideOptions = getContainerBlockOverrideOptions;
138883
138558
  exports2.getContainerBlockPath = getContainerBlockPath;
@@ -138980,7 +138655,6 @@ ${data2.plantumlText}
138980
138655
  exports2.isBox = isBox;
138981
138656
  exports2.isBoxOp = isBoxOp;
138982
138657
  exports2.isCJK = isCJK;
138983
- exports2.isCJKPunctuation = isCJKPunctuation;
138984
138658
  exports2.isChildContainer = isChildContainer;
138985
138659
  exports2.isChildNode = isChildNode;
138986
138660
  exports2.isClipboardEmpty = isClipboardEmpty$1;
@@ -139053,7 +138727,7 @@ ${data2.plantumlText}
139053
138727
  exports2.loadJs = loadJs;
139054
138728
  exports2.loadJsPromise = loadJsPromise;
139055
138729
  exports2.lockers = lockers;
139056
- exports2.logger = logger$4q;
138730
+ exports2.logger = logger$4p;
139057
138731
  exports2.markdownToDoc = markdownToDoc;
139058
138732
  exports2.mergeCommands = mergeCommands;
139059
138733
  exports2.mergeDocs = mergeDocs;