@ones-editor/editor 2.2.23-beta.1 → 2.2.24

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
@@ -8436,7 +8436,7 @@ var __publicField = (obj, key, value) => {
8436
8436
  imageExportFailed: "\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"
8437
8437
  }
8438
8438
  };
8439
- const logger$4G = getLogger("i18n");
8439
+ const logger$4F = getLogger("i18n");
8440
8440
  const langs$3 = {
8441
8441
  "en-US": enUS$x,
8442
8442
  "zh-CN": zhCN$x,
@@ -8456,7 +8456,7 @@ var __publicField = (obj, key, value) => {
8456
8456
  function t$8(key, args) {
8457
8457
  const ret = i18n.get(key, args);
8458
8458
  if (ret === key) {
8459
- logger$4G.warn(`no locale value for key ${key}`);
8459
+ logger$4F.warn(`no locale value for key ${key}`);
8460
8460
  }
8461
8461
  return ret;
8462
8462
  }
@@ -9069,7 +9069,7 @@ var __publicField = (obj, key, value) => {
9069
9069
  this._callbacks.clear();
9070
9070
  }
9071
9071
  }
9072
- const logger$4F = getLogger("await-locker");
9072
+ const logger$4E = getLogger("await-locker");
9073
9073
  class AwaitLock {
9074
9074
  constructor() {
9075
9075
  __publicField(this, "_acquired", false);
@@ -9111,7 +9111,7 @@ var __publicField = (obj, key, value) => {
9111
9111
  }
9112
9112
  if (this._waitingResolvers.length > 0) {
9113
9113
  const resolve = this._waitingResolvers.shift();
9114
- assert(logger$4F, resolve, "Resolver missing");
9114
+ assert(logger$4E, resolve, "Resolver missing");
9115
9115
  resolve(void 0);
9116
9116
  } else {
9117
9117
  this._acquired = false;
@@ -9194,7 +9194,7 @@ var __publicField = (obj, key, value) => {
9194
9194
  isMobileSafari: false
9195
9195
  };
9196
9196
  clientType.isMobileSafari = clientType.isMobile && clientType.isSafari;
9197
- const logger$4E = getLogger("dom-utils");
9197
+ const logger$4D = getLogger("dom-utils");
9198
9198
  function addClass(dom, ...className) {
9199
9199
  if (dom && dom.nodeType === Node.ELEMENT_NODE) {
9200
9200
  dom.classList.add(...className);
@@ -9248,7 +9248,7 @@ var __publicField = (obj, key, value) => {
9248
9248
  range.setStart(node, offset);
9249
9249
  return range;
9250
9250
  } catch (err) {
9251
- assert(logger$4E, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
9251
+ assert(logger$4D, false, `failed to create range: ${node.childNodes.length}, ${offset}, ${err.message}`);
9252
9252
  }
9253
9253
  }
9254
9254
  function createExpandedRange(startNode, startOffset, endNode, endOffset) {
@@ -9258,17 +9258,17 @@ var __publicField = (obj, key, value) => {
9258
9258
  range.setEnd(endNode, endOffset);
9259
9259
  return range;
9260
9260
  } catch (err) {
9261
- assert(logger$4E, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
9261
+ assert(logger$4D, false, `failed to create expanded range: ${startNode.childNodes.length}, ${startOffset}, ${endNode.childNodes.length}, ${endOffset}, ${err.message}`);
9262
9262
  }
9263
9263
  }
9264
9264
  function getFirstClientRect(elem) {
9265
9265
  const rects = elem.getClientRects();
9266
- assert(logger$4E, rects.length >= 1, "getFirstClientRect: no rects");
9266
+ assert(logger$4D, rects.length >= 1, "getFirstClientRect: no rects");
9267
9267
  return rects[0];
9268
9268
  }
9269
9269
  function getLastClientRect(elem) {
9270
9270
  const rects = elem.getClientRects();
9271
- assert(logger$4E, rects.length >= 1, "getLastClientRect: no rects");
9271
+ assert(logger$4D, rects.length >= 1, "getLastClientRect: no rects");
9272
9272
  return rects[rects.length - 1];
9273
9273
  }
9274
9274
  function getDistanceSquare(rect, x, y) {
@@ -9315,7 +9315,7 @@ var __publicField = (obj, key, value) => {
9315
9315
  return 0;
9316
9316
  }
9317
9317
  if (!elem1.parentElement || !elem2.parentElement) {
9318
- assert(logger$4E, false, "invalid dom node to compare");
9318
+ assert(logger$4D, false, "invalid dom node to compare");
9319
9319
  }
9320
9320
  if (elem1.parentElement === elem2.parentElement) {
9321
9321
  const children = Array.from(elem1.parentElement.children);
@@ -9332,7 +9332,7 @@ var __publicField = (obj, key, value) => {
9332
9332
  const parents1 = getParents(elem1);
9333
9333
  const parents2 = getParents(elem2);
9334
9334
  if (parents1[0] !== parents2[0]) {
9335
- assert(logger$4E, false, "invalid dom node to compare, different tree");
9335
+ assert(logger$4D, false, "invalid dom node to compare, different tree");
9336
9336
  }
9337
9337
  for (let i = 1; ; i++) {
9338
9338
  const parent1 = parents1[i];
@@ -9916,7 +9916,7 @@ var __publicField = (obj, key, value) => {
9916
9916
  }
9917
9917
  }
9918
9918
  const MIN_DISTANCE_THRESHOLD$3 = 3;
9919
- const logger$4D = getLogger("drag-drop");
9919
+ const logger$4C = getLogger("drag-drop");
9920
9920
  class DragDrop {
9921
9921
  constructor(options) {
9922
9922
  __publicField(this, "dragStarted", false);
@@ -9937,7 +9937,7 @@ var __publicField = (obj, key, value) => {
9937
9937
  var _a;
9938
9938
  event.preventDefault();
9939
9939
  event.stopPropagation();
9940
- assert(logger$4D, this.mouseDownEvent, "no mouse down event");
9940
+ assert(logger$4C, this.mouseDownEvent, "no mouse down event");
9941
9941
  const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
9942
9942
  const newPos = DragDrop.getEventPosition(event);
9943
9943
  const deltaX = newPos.x - oldPos.x;
@@ -9953,7 +9953,7 @@ var __publicField = (obj, key, value) => {
9953
9953
  });
9954
9954
  __publicField(this, "handleMouseUp", (event) => {
9955
9955
  if (event instanceof MouseEvent && event.button === 0 || event instanceof TouchEvent) {
9956
- assert(logger$4D, this.mouseDownEvent, "no mouse down event");
9956
+ assert(logger$4C, this.mouseDownEvent, "no mouse down event");
9957
9957
  const oldPos = DragDrop.getEventPosition(this.mouseDownEvent);
9958
9958
  const newPos = DragDrop.getEventPosition(event);
9959
9959
  const deltaX = newPos.x - oldPos.x;
@@ -10062,7 +10062,7 @@ var __publicField = (obj, key, value) => {
10062
10062
  const dragDrop = new DragDrop(options);
10063
10063
  return dragDrop;
10064
10064
  }
10065
- const logger$4C = getLogger("character");
10065
+ const logger$4B = getLogger("character");
10066
10066
  function checkChar(charCode, rangeList) {
10067
10067
  for (let i = 0; i < rangeList.length; i++) {
10068
10068
  const start = rangeList[i][0];
@@ -10109,7 +10109,7 @@ var __publicField = (obj, key, value) => {
10109
10109
  }
10110
10110
  function trimChar(s, char) {
10111
10111
  let c = char;
10112
- assert(logger$4C, c.length === 1, "invalid char length");
10112
+ assert(logger$4B, c.length === 1, "invalid char length");
10113
10113
  if (c === "]")
10114
10114
  c = "\\]";
10115
10115
  if (c === "\\")
@@ -10443,7 +10443,7 @@ var __publicField = (obj, key, value) => {
10443
10443
  const metrics = context.measureText(text2);
10444
10444
  return metrics.width + 4;
10445
10445
  }
10446
- const logger$4B = getLogger("editor-clipboard");
10446
+ const logger$4A = getLogger("editor-clipboard");
10447
10447
  async function setClipboardDataByEvent(items, event) {
10448
10448
  if (event.clipboardData) {
10449
10449
  const data2 = event.clipboardData;
@@ -10501,7 +10501,7 @@ var __publicField = (obj, key, value) => {
10501
10501
  document.body.removeChild(textarea2);
10502
10502
  return true;
10503
10503
  } catch (ex) {
10504
- logger$4B.error(ex);
10504
+ logger$4A.error(ex);
10505
10505
  document.body.removeChild(textarea2);
10506
10506
  return false;
10507
10507
  }
@@ -10522,7 +10522,7 @@ var __publicField = (obj, key, value) => {
10522
10522
  document.body.removeChild(div);
10523
10523
  return true;
10524
10524
  } catch (ex) {
10525
- logger$4B.error(ex);
10525
+ logger$4A.error(ex);
10526
10526
  document.body.removeChild(div);
10527
10527
  return false;
10528
10528
  }
@@ -10549,7 +10549,7 @@ var __publicField = (obj, key, value) => {
10549
10549
  await navigator.clipboard.write([clipboardItems]);
10550
10550
  return true;
10551
10551
  } catch (err) {
10552
- logger$4B.error(err);
10552
+ logger$4A.error(err);
10553
10553
  return await execCommandCopy(items);
10554
10554
  }
10555
10555
  }
@@ -10605,7 +10605,7 @@ var __publicField = (obj, key, value) => {
10605
10605
  a.click();
10606
10606
  a.remove();
10607
10607
  }
10608
- const logger$4A = getLogger("auto-scroll");
10608
+ const logger$4z = getLogger("auto-scroll");
10609
10609
  function scrollable(scrollElement, direction) {
10610
10610
  if (scrollElement.scrollHeight === scrollElement.clientHeight) {
10611
10611
  return false;
@@ -10629,7 +10629,7 @@ var __publicField = (obj, key, value) => {
10629
10629
  const isHorizontal = direction === "left" || direction === "right";
10630
10630
  const scroll = () => {
10631
10631
  if (!scrollable(scrollElement, direction)) {
10632
- logger$4A.debug("No need for scroll");
10632
+ logger$4z.debug("No need for scroll");
10633
10633
  return null;
10634
10634
  }
10635
10635
  if (isHorizontal) {
@@ -10659,11 +10659,10 @@ var __publicField = (obj, key, value) => {
10659
10659
  constructor(options) {
10660
10660
  __publicField(this, "cancelScroll", null);
10661
10661
  __publicField(this, "options");
10662
- __publicField(this, "scrollDomInfo");
10663
10662
  __publicField(this, "scrolling", false);
10664
10663
  __publicField(this, "getScrollingDirection", (e2) => {
10665
10664
  const { x, y } = e2;
10666
- const { top, bottom, left, right } = this.scrollDomInfo;
10665
+ const { top, bottom, left, right } = this.getScrollDomInfo();
10667
10666
  const { edge } = this.options;
10668
10667
  if (edge.top && y <= edge.top + top) {
10669
10668
  return "top";
@@ -10687,7 +10686,7 @@ var __publicField = (obj, key, value) => {
10687
10686
  if (this.scrolling) {
10688
10687
  return;
10689
10688
  }
10690
- logger$4A.debug(`scroll direction: ${direction}`);
10689
+ logger$4z.debug(`scroll direction: ${direction}`);
10691
10690
  this.cancelScroll = continuousScroll(scrollElement, {
10692
10691
  direction,
10693
10692
  step
@@ -10700,7 +10699,6 @@ var __publicField = (obj, key, value) => {
10700
10699
  }
10701
10700
  });
10702
10701
  this.options = options;
10703
- this.scrollDomInfo = this.getScrollDomInfo();
10704
10702
  }
10705
10703
  getScrollDomInfo() {
10706
10704
  const { scrollElement } = this.options;
@@ -10938,7 +10936,7 @@ var __publicField = (obj, key, value) => {
10938
10936
  const colorIndex = Math.abs(typeof content === "string" && content.trim() ? hashCode(content.trim()) : 0) % ColorNames.length;
10939
10937
  return ColorNames[colorIndex];
10940
10938
  }
10941
- const logger$4z = getLogger("container");
10939
+ const logger$4y = getLogger("container");
10942
10940
  function isContainer(elem) {
10943
10941
  return elem.getAttribute("data-type") === "editor-container";
10944
10942
  }
@@ -10950,9 +10948,9 @@ var __publicField = (obj, key, value) => {
10950
10948
  }
10951
10949
  function getContainerId(container) {
10952
10950
  const id = container.getAttribute("data-container-id");
10953
- assert(logger$4z, id, "no id for container");
10951
+ assert(logger$4y, id, "no id for container");
10954
10952
  if (isRootContainer(container)) {
10955
- assert(logger$4z, id === "root", `invalid root container id, : ${id}`);
10953
+ assert(logger$4y, id === "root", `invalid root container id, : ${id}`);
10956
10954
  }
10957
10955
  return id;
10958
10956
  }
@@ -10963,7 +10961,7 @@ var __publicField = (obj, key, value) => {
10963
10961
  function generateEditorContainerId(containerId) {
10964
10962
  return `ones-editor-container-${containerId}`;
10965
10963
  }
10966
- const logger$4y = getLogger("element");
10964
+ const logger$4x = getLogger("element");
10967
10965
  function createContainerElement(parent, type, containerId) {
10968
10966
  const container = createElement("div", [type], parent);
10969
10967
  container.setAttribute("data-type", "editor-container");
@@ -10974,7 +10972,7 @@ var __publicField = (obj, key, value) => {
10974
10972
  }
10975
10973
  function getContainerById(editor, containerId) {
10976
10974
  const container = editor.rootElement.querySelector(`[data-container-id=${containerId}]`);
10977
- assert(logger$4y, container, `no container: ${containerId}`);
10975
+ assert(logger$4x, container, `no container: ${containerId}`);
10978
10976
  return container;
10979
10977
  }
10980
10978
  function getExistsContainerById(editor, containerId) {
@@ -10983,7 +10981,7 @@ var __publicField = (obj, key, value) => {
10983
10981
  }
10984
10982
  function getContainerBlocksElement(container) {
10985
10983
  const blocks = container.querySelector(":scope > .container-blocks");
10986
- assert(logger$4y, blocks, "no container blocks element");
10984
+ assert(logger$4x, blocks, "no container blocks element");
10987
10985
  return blocks;
10988
10986
  }
10989
10987
  function getContainerToolsElement(container) {
@@ -10996,11 +10994,11 @@ var __publicField = (obj, key, value) => {
10996
10994
  function isContainerBlocksElement(element) {
10997
10995
  return element.classList.contains("container-blocks");
10998
10996
  }
10999
- const logger$4x = getLogger("container-children");
10997
+ const logger$4w = getLogger("container-children");
11000
10998
  function getChildBlocks(container, traverseChild) {
11001
10999
  const content = getContainerBlocksElement(container);
11002
11000
  const blocks = Array.from(content.children);
11003
- assert(logger$4x, blocks.length > 0, "container have not any child block");
11001
+ assert(logger$4w, blocks.length > 0, "container have not any child block");
11004
11002
  if (traverseChild) {
11005
11003
  const { condition, editor } = traverseChild;
11006
11004
  return blocks.reduce((result, block) => {
@@ -11023,7 +11021,7 @@ var __publicField = (obj, key, value) => {
11023
11021
  }
11024
11022
  function getFirstChildBlock(container) {
11025
11023
  const block = container.querySelector(":scope > .container-blocks > div[data-type=editor-block]");
11026
- assert(logger$4x, block, "container have not any child block");
11024
+ assert(logger$4w, block, "container have not any child block");
11027
11025
  return block;
11028
11026
  }
11029
11027
  function getLastChildBlock(container) {
@@ -11035,14 +11033,14 @@ var __publicField = (obj, key, value) => {
11035
11033
  }
11036
11034
  function getBlockByIndex(container, blockIndex) {
11037
11035
  const block = getChildBlocks(container)[blockIndex];
11038
- assert(logger$4x, block, `container have not block at index ${blockIndex}`);
11036
+ assert(logger$4w, block, `container have not block at index ${blockIndex}`);
11039
11037
  return block;
11040
11038
  }
11041
11039
  function findBlockByIndex(container, blockIndex) {
11042
11040
  var _a;
11043
11041
  return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
11044
11042
  }
11045
- const logger$4w = getLogger("block-dom");
11043
+ const logger$4v = getLogger("block-dom");
11046
11044
  function isBlock$1(node) {
11047
11045
  if (!(node instanceof HTMLDivElement)) {
11048
11046
  return false;
@@ -11063,12 +11061,12 @@ var __publicField = (obj, key, value) => {
11063
11061
  }
11064
11062
  function getBlockId(block) {
11065
11063
  const { id } = block;
11066
- assert(logger$4w, id, "no block id");
11064
+ assert(logger$4v, id, "no block id");
11067
11065
  return id;
11068
11066
  }
11069
11067
  function getBlockType(block) {
11070
11068
  const type = block.getAttribute("data-block-type");
11071
- assert(logger$4w, type, "invalid block dom, no data-type");
11069
+ assert(logger$4v, type, "invalid block dom, no data-type");
11072
11070
  return type;
11073
11071
  }
11074
11072
  function getParentBlock(node) {
@@ -11091,12 +11089,12 @@ var __publicField = (obj, key, value) => {
11091
11089
  }
11092
11090
  function getParentContainer(block) {
11093
11091
  const container = block.closest("div[data-type=editor-container]");
11094
- assert(logger$4w, container, "failed to get block container");
11092
+ assert(logger$4v, container, "failed to get block container");
11095
11093
  return container;
11096
11094
  }
11097
11095
  function getBlockContent(block) {
11098
11096
  const content = block.querySelector(":scope >div[data-type=block-content]");
11099
- assert(logger$4w, content, "no block content");
11097
+ assert(logger$4v, content, "no block content");
11100
11098
  return content;
11101
11099
  }
11102
11100
  function getBlockTools(block) {
@@ -11105,7 +11103,7 @@ var __publicField = (obj, key, value) => {
11105
11103
  tools = createElement("div", [], block);
11106
11104
  tools.setAttribute("data-type", "block-tools");
11107
11105
  }
11108
- assert(logger$4w, tools, "no block tools");
11106
+ assert(logger$4v, tools, "no block tools");
11109
11107
  return tools;
11110
11108
  }
11111
11109
  function getExistsBlockTools(block) {
@@ -11126,7 +11124,7 @@ var __publicField = (obj, key, value) => {
11126
11124
  function createBlockElement(editor, path, data2) {
11127
11125
  const blockData = editor.editorDecorators.decorateBlock(path, data2);
11128
11126
  const { id, type } = blockData;
11129
- assert(logger$4w, id, "no block id");
11127
+ assert(logger$4v, id, "no block id");
11130
11128
  const elem = createElement("div", [`${type}-block`], null);
11131
11129
  elem.id = id;
11132
11130
  elem.setAttribute("data-type", "editor-block");
@@ -11164,7 +11162,7 @@ var __publicField = (obj, key, value) => {
11164
11162
  }
11165
11163
  function getBoxTypeFromElement(box) {
11166
11164
  const type = box.getAttribute("data-box-type");
11167
- assert(logger$4w, type, "not a valid box element, no type");
11165
+ assert(logger$4v, type, "not a valid box element, no type");
11168
11166
  return type;
11169
11167
  }
11170
11168
  function isBox(node) {
@@ -11175,7 +11173,7 @@ var __publicField = (obj, key, value) => {
11175
11173
  }
11176
11174
  function getBoxId(box) {
11177
11175
  const { id } = box;
11178
- assert(logger$4w, id, "no box id");
11176
+ assert(logger$4v, id, "no box id");
11179
11177
  return id;
11180
11178
  }
11181
11179
  function getParentBox(node) {
@@ -11197,7 +11195,7 @@ var __publicField = (obj, key, value) => {
11197
11195
  }
11198
11196
  function getBoxContent(box) {
11199
11197
  const content = box.querySelector("span[data-type=box-content]");
11200
- assert(logger$4w, content, "invalid box dom, no content");
11198
+ assert(logger$4v, content, "invalid box dom, no content");
11201
11199
  return content;
11202
11200
  }
11203
11201
  function createInsertionElement(type, id, attributes) {
@@ -11219,7 +11217,7 @@ var __publicField = (obj, key, value) => {
11219
11217
  }
11220
11218
  function getInsertionContent(insertion) {
11221
11219
  const content = insertion.querySelector("span[data-type=insertion-content]");
11222
- assert(logger$4w, content, "invalid insertion-child dom, no content");
11220
+ assert(logger$4v, content, "invalid insertion-child dom, no content");
11223
11221
  return content;
11224
11222
  }
11225
11223
  function getPrevBlock(block) {
@@ -11242,44 +11240,31 @@ var __publicField = (obj, key, value) => {
11242
11240
  }
11243
11241
  return null;
11244
11242
  }
11245
- function getPrevVisibleBlock(block, matcher) {
11246
- const mergedMatcher = matcher || (() => true);
11243
+ function getPrevVisibleBlock(block) {
11247
11244
  let prev = block.previousElementSibling;
11248
11245
  while (prev) {
11249
- if (isBlock$1(prev) && isVisibleBlock(prev) && mergedMatcher(prev)) {
11246
+ if (isBlock$1(prev) && isVisibleBlock(prev)) {
11250
11247
  return prev;
11251
11248
  }
11252
11249
  prev = prev.previousElementSibling;
11253
11250
  }
11254
11251
  return null;
11255
11252
  }
11256
- function getNextVisibleBlock(block, matcher) {
11257
- const mergedMatcher = matcher || (() => true);
11253
+ function getNextVisibleBlock(block) {
11258
11254
  let next2 = block.nextElementSibling;
11259
11255
  while (next2) {
11260
- if (isBlock$1(next2) && isVisibleBlock(next2) && mergedMatcher(next2)) {
11256
+ if (isBlock$1(next2) && isVisibleBlock(next2)) {
11261
11257
  return next2;
11262
11258
  }
11263
11259
  next2 = next2.nextElementSibling;
11264
11260
  }
11265
11261
  return null;
11266
11262
  }
11267
- function getBlocksBetween(start, end, matcher) {
11268
- const blocks = [];
11269
- let cur = start;
11270
- while (cur !== end) {
11271
- if (isBlock$1(cur) && matcher(cur)) {
11272
- blocks.push(cur);
11273
- }
11274
- cur = cur.nextElementSibling;
11275
- }
11276
- return blocks;
11277
- }
11278
11263
  function getBlockIndex(block) {
11279
11264
  const container = getParentContainer(block);
11280
11265
  const children = getChildBlocks(container);
11281
11266
  const index2 = children.indexOf(block);
11282
- assert(logger$4w, index2 !== -1, "invalid block & container dom, failed to get block index");
11267
+ assert(logger$4v, index2 !== -1, "invalid block & container dom, failed to get block index");
11283
11268
  return index2;
11284
11269
  }
11285
11270
  function isInBlock(target) {
@@ -11304,18 +11289,18 @@ var __publicField = (obj, key, value) => {
11304
11289
  function isTitleBlock$2(block) {
11305
11290
  return block.hasAttribute("data-document-title");
11306
11291
  }
11307
- const logger$4v = getLogger("block-class");
11292
+ const logger$4u = getLogger("block-class");
11308
11293
  function getBlockClass(editor, block) {
11309
11294
  return editor.editorBlocks.getBlockClass(getBlockType(block));
11310
11295
  }
11311
11296
  function getTextBlockClass(editor, block) {
11312
11297
  const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
11313
- assert(logger$4v, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
11298
+ assert(logger$4u, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
11314
11299
  return text2;
11315
11300
  }
11316
11301
  function getComplexBlockClass(editor, block) {
11317
11302
  const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
11318
- assert(logger$4v, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
11303
+ assert(logger$4u, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
11319
11304
  return complex;
11320
11305
  }
11321
11306
  function getBlockClassByType(editor, type) {
@@ -11336,7 +11321,7 @@ var __publicField = (obj, key, value) => {
11336
11321
  function getBlockKind(editor, block) {
11337
11322
  return getBlockClass(editor, block).blockKind;
11338
11323
  }
11339
- const logger$4u = getLogger("text-block-child");
11324
+ const logger$4t = getLogger("text-block-child");
11340
11325
  function isTextBlockContentChild(elem) {
11341
11326
  if (elem.tagName !== "SPAN") {
11342
11327
  return false;
@@ -11344,14 +11329,14 @@ var __publicField = (obj, key, value) => {
11344
11329
  return true;
11345
11330
  }
11346
11331
  function isTextBlockContentBoxChild(elem) {
11347
- assert(logger$4u, isTextBlockContentChild(elem), "not a valid text child");
11332
+ assert(logger$4t, isTextBlockContentChild(elem), "not a valid text child");
11348
11333
  if (elem.getAttribute("data-type") === "editor-box") {
11349
11334
  return true;
11350
11335
  }
11351
11336
  return false;
11352
11337
  }
11353
11338
  function isTextBlockContentInsertionChild(elem) {
11354
- assert(logger$4u, isTextBlockContentChild(elem), "not a valid text child");
11339
+ assert(logger$4t, isTextBlockContentChild(elem), "not a valid text child");
11355
11340
  if (elem.getAttribute("data-type") === "editor-insertion") {
11356
11341
  return true;
11357
11342
  }
@@ -11361,7 +11346,7 @@ var __publicField = (obj, key, value) => {
11361
11346
  return !isTextBlockContentBoxChild(elem) && !isTextBlockContentInsertionChild(elem);
11362
11347
  }
11363
11348
  function getTextBlockContentChildType(child) {
11364
- assert(logger$4u, isTextBlockContentChild(child), "not a valid text child");
11349
+ assert(logger$4t, isTextBlockContentChild(child), "not a valid text child");
11365
11350
  if (isTextBlockContentBoxChild(child)) {
11366
11351
  return "box";
11367
11352
  }
@@ -11376,15 +11361,15 @@ var __publicField = (obj, key, value) => {
11376
11361
  return 0;
11377
11362
  if (type === "box")
11378
11363
  return 1;
11379
- assert(logger$4u, child.textContent !== null, "text block content is undefined");
11380
- assert(logger$4u, child.textContent.length >= 0, "text block content length is negative");
11364
+ assert(logger$4t, child.textContent !== null, "text block content is undefined");
11365
+ assert(logger$4t, child.textContent.length >= 0, "text block content length is negative");
11381
11366
  return child.textContent.length;
11382
11367
  }
11383
11368
  function getTextBlockContentChildren(block) {
11384
11369
  const content = getBlockContent(block);
11385
11370
  const children = Array.from(content.children);
11386
11371
  children.forEach((child) => {
11387
- assert(logger$4u, isTextBlockContentChild(child), "not a valid text child");
11372
+ assert(logger$4t, isTextBlockContentChild(child), "not a valid text child");
11388
11373
  });
11389
11374
  return children;
11390
11375
  }
@@ -11413,17 +11398,17 @@ var __publicField = (obj, key, value) => {
11413
11398
  };
11414
11399
  }
11415
11400
  const offset = blockOffset - start;
11416
- assert(logger$4u, offset > 0, "invalid offset value");
11417
- assert(logger$4u, !isTextBlockContentBoxChild(child), "invalid box child");
11401
+ assert(logger$4t, offset > 0, "invalid offset value");
11402
+ assert(logger$4t, !isTextBlockContentBoxChild(child), "invalid box child");
11418
11403
  return {
11419
11404
  prev: child,
11420
11405
  next: child,
11421
11406
  offset
11422
11407
  };
11423
11408
  }
11424
- assert(logger$4u, false, `invalid block child at position: ${blockOffset}`);
11409
+ assert(logger$4t, false, `invalid block child at position: ${blockOffset}`);
11425
11410
  }
11426
- const logger$4t = getLogger("block-path");
11411
+ const logger$4s = getLogger("block-path");
11427
11412
  function getBlockPath(block) {
11428
11413
  const ret = [];
11429
11414
  let current = block;
@@ -11437,26 +11422,26 @@ var __publicField = (obj, key, value) => {
11437
11422
  return ret;
11438
11423
  }
11439
11424
  const parentBlock = getParentBlock(container);
11440
- assert(logger$4t, parentBlock, "no parent block");
11425
+ assert(logger$4s, parentBlock, "no parent block");
11441
11426
  current = parentBlock;
11442
11427
  }
11443
- assert(logger$4t, false, "no parent block");
11428
+ assert(logger$4s, false, "no parent block");
11444
11429
  return [];
11445
11430
  }
11446
- const logger$4s = getLogger("child-container-path");
11431
+ const logger$4r = getLogger("child-container-path");
11447
11432
  function getContainerBlockPath(container) {
11448
11433
  if (isRootContainer(container)) {
11449
11434
  return [];
11450
11435
  }
11451
11436
  const parentBlock = getParentBlock(container);
11452
- assert(logger$4s, parentBlock, "no parent block");
11437
+ assert(logger$4r, parentBlock, "no parent block");
11453
11438
  return getBlockPath(parentBlock);
11454
11439
  }
11455
- const logger$4r = getLogger("load-blocks");
11440
+ const logger$4q = getLogger("load-blocks");
11456
11441
  function loadBlocks(editor, container, path) {
11457
11442
  const containerId = getContainerId(container);
11458
11443
  const blocks = getContainerBlocks$1(container, editor.doc);
11459
- assert(logger$4r, blocks.length > 0, "no blocks in container");
11444
+ assert(logger$4q, blocks.length > 0, "no blocks in container");
11460
11445
  const fragment = document.createDocumentFragment();
11461
11446
  blocks.forEach((b, index2) => {
11462
11447
  const block = editor.editorBlocks.createBlock([...path, { containerId, blockIndex: index2 }], container, b);
@@ -11472,7 +11457,7 @@ var __publicField = (obj, key, value) => {
11472
11457
  return block;
11473
11458
  }
11474
11459
  const blocks = getChildBlocks(container);
11475
- assert(logger$4r, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
11460
+ assert(logger$4q, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
11476
11461
  if (blockIndex === blocks.length) {
11477
11462
  containerBlocksElement.appendChild(block);
11478
11463
  } else {
@@ -11490,7 +11475,7 @@ var __publicField = (obj, key, value) => {
11490
11475
  insertBlockAt(container, blockIndex, block);
11491
11476
  return block;
11492
11477
  }
11493
- const logger$4q = getLogger("root-container");
11478
+ const logger$4p = getLogger("root-container");
11494
11479
  const MIN_DISTANCE_THRESHOLD$2 = 3;
11495
11480
  class RootContainer {
11496
11481
  constructor(editor, rootContainer) {
@@ -11518,7 +11503,7 @@ var __publicField = (obj, key, value) => {
11518
11503
  this.editor.selection.updateSelection(null);
11519
11504
  this.editor.emit("resize", this.editor);
11520
11505
  } catch (err) {
11521
- logger$4q.warn(`failed to update selection while container resizing: ${err.message}`);
11506
+ logger$4p.warn(`failed to update selection while container resizing: ${err.message}`);
11522
11507
  }
11523
11508
  });
11524
11509
  __publicField(this, "handleClick", (event) => {
@@ -11551,7 +11536,7 @@ var __publicField = (obj, key, value) => {
11551
11536
  const box = getParentBox(elem);
11552
11537
  if (box) {
11553
11538
  const block2 = getParentBlock(box);
11554
- assert(logger$4q, block2, "no parent block");
11539
+ assert(logger$4p, block2, "no parent block");
11555
11540
  (_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
11556
11541
  return;
11557
11542
  }
@@ -11606,7 +11591,7 @@ var __publicField = (obj, key, value) => {
11606
11591
  this.editor.input.focus({ preventScroll: true });
11607
11592
  });
11608
11593
  __publicField(this, "handleMouseMove", (event) => {
11609
- assert(logger$4q, this.mouseDownEvent, "no mouse down event");
11594
+ assert(logger$4p, this.mouseDownEvent, "no mouse down event");
11610
11595
  if (ensureIsMobileEvent(this.mouseDownEvent))
11611
11596
  return;
11612
11597
  const deltaX = event.x - this.mouseDownEvent.x;
@@ -11722,7 +11707,7 @@ var __publicField = (obj, key, value) => {
11722
11707
  loadBlocks(editor, container, path);
11723
11708
  return container;
11724
11709
  }
11725
- const logger$4p = getLogger("block");
11710
+ const logger$4o = getLogger("block");
11726
11711
  function getBlockTextLength$6(editor, block) {
11727
11712
  return getBlockClass(editor, block).getBlockTextLength(block);
11728
11713
  }
@@ -11741,7 +11726,7 @@ var __publicField = (obj, key, value) => {
11741
11726
  return block;
11742
11727
  }
11743
11728
  const parent = getParentBlock(container);
11744
- assert(logger$4p, parent, "no parent block exists for child container");
11729
+ assert(logger$4o, parent, "no parent block exists for child container");
11745
11730
  block = parent;
11746
11731
  }
11747
11732
  }
@@ -11777,7 +11762,7 @@ var __publicField = (obj, key, value) => {
11777
11762
  }
11778
11763
  return fun(editor, block, options);
11779
11764
  } catch (err) {
11780
- logger$4p.debug(`unsupported block type: ${type}`);
11765
+ logger$4o.debug(`unsupported block type: ${type}`);
11781
11766
  return null;
11782
11767
  }
11783
11768
  }
@@ -11797,7 +11782,7 @@ var __publicField = (obj, key, value) => {
11797
11782
  const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
11798
11783
  Object.entries(styles).forEach(([, value]) => {
11799
11784
  const type = typeof value;
11800
- assert(logger$4p, type === "string" || type === "number" || type === "boolean", "invalid style value");
11785
+ assert(logger$4o, type === "string" || type === "number" || type === "boolean", "invalid style value");
11801
11786
  });
11802
11787
  return styles;
11803
11788
  }
@@ -11922,7 +11907,7 @@ var __publicField = (obj, key, value) => {
11922
11907
  }
11923
11908
  return { element: null, blockCommands: [], boxCommands: [] };
11924
11909
  }
11925
- const logger$4o = getLogger("embed-block-common");
11910
+ const logger$4n = getLogger("embed-block-common");
11926
11911
  function isColumnsBlock(block) {
11927
11912
  return getBlockType(block) === "layout";
11928
11913
  }
@@ -11930,9 +11915,9 @@ var __publicField = (obj, key, value) => {
11930
11915
  return getBlockType(block) === "embed";
11931
11916
  }
11932
11917
  function getEmbedType(block) {
11933
- assert(logger$4o, isEmbedBlock(block), "not an embed block");
11918
+ assert(logger$4n, isEmbedBlock(block), "not an embed block");
11934
11919
  const type = block.getAttribute("data-embed-type");
11935
- assert(logger$4o, type, "no embed data type");
11920
+ assert(logger$4n, type, "no embed data type");
11936
11921
  return type;
11937
11922
  }
11938
11923
  function getEmbedClassFromBlock(editor, block) {
@@ -11998,10 +11983,10 @@ var __publicField = (obj, key, value) => {
11998
11983
  data: (_c = overrideOptions == null ? void 0 : overrideOptions.data) != null ? _c : data2
11999
11984
  });
12000
11985
  }
12001
- const logger$4n = getLogger("execute-block-command");
11986
+ const logger$4m = getLogger("execute-block-command");
12002
11987
  function executeEmbedBlockCommand(editor, block, commandGroup, item) {
12003
11988
  var _a;
12004
- assert(logger$4n, isEmbedBlock(block), "not a embed block");
11989
+ assert(logger$4m, isEmbedBlock(block), "not a embed block");
12005
11990
  const embedType = getEmbedType(block);
12006
11991
  const embed = getEmbedClassByType(editor, embedType);
12007
11992
  if (!embed.getOptions) {
@@ -12034,14 +12019,14 @@ var __publicField = (obj, key, value) => {
12034
12019
  }
12035
12020
  return void 0;
12036
12021
  }
12037
- const logger$4m = getLogger("block-class");
12022
+ const logger$4l = getLogger("block-class");
12038
12023
  function isHeadingBlock$1(block) {
12039
12024
  return !!block.getAttribute("data-style-heading");
12040
12025
  }
12041
12026
  function getBlockHeading(block) {
12042
12027
  var _a;
12043
12028
  const heading = Number.parseInt((_a = block.getAttribute("data-style-heading")) != null ? _a : "", 10);
12044
- assert(logger$4m, heading, "not a heading block");
12029
+ assert(logger$4l, heading, "not a heading block");
12045
12030
  return heading;
12046
12031
  }
12047
12032
  function isExpandedHeadingBlock(block) {
@@ -12052,7 +12037,7 @@ var __publicField = (obj, key, value) => {
12052
12037
  }
12053
12038
  function getHeadingBlockChildren(block, oldHeading) {
12054
12039
  if (!oldHeading) {
12055
- assert(logger$4m, isHeadingBlock$1(block), "not a heading block");
12040
+ assert(logger$4l, isHeadingBlock$1(block), "not a heading block");
12056
12041
  }
12057
12042
  const children = [];
12058
12043
  const heading = oldHeading != null ? oldHeading : getBlockHeading(block);
@@ -12082,7 +12067,7 @@ var __publicField = (obj, key, value) => {
12082
12067
  }
12083
12068
  return children;
12084
12069
  }
12085
- const logger$4l = getLogger("complex-block-position");
12070
+ const logger$4k = getLogger("complex-block-position");
12086
12071
  class EditorComplexBlockPosition {
12087
12072
  constructor(block, childContainerId, custom) {
12088
12073
  __publicField(this, "blockId");
@@ -12091,7 +12076,7 @@ var __publicField = (obj, key, value) => {
12091
12076
  if (block instanceof HTMLElement) {
12092
12077
  this.blockId = getBlockId(block);
12093
12078
  } else {
12094
- assert(logger$4l, typeof block === "string", `not a valid block id: ${block}`);
12079
+ assert(logger$4k, typeof block === "string", `not a valid block id: ${block}`);
12095
12080
  this.blockId = block;
12096
12081
  }
12097
12082
  this.childContainerId = childContainerId;
@@ -12103,7 +12088,7 @@ var __publicField = (obj, key, value) => {
12103
12088
  return false;
12104
12089
  }
12105
12090
  }
12106
- const logger$4k = getLogger("simple-block-position");
12091
+ const logger$4j = getLogger("simple-block-position");
12107
12092
  class EditorSimpleBlockPosition {
12108
12093
  constructor(block, offset, type) {
12109
12094
  __publicField(this, "blockId");
@@ -12112,7 +12097,7 @@ var __publicField = (obj, key, value) => {
12112
12097
  if (block instanceof HTMLElement) {
12113
12098
  this.blockId = getBlockId(block);
12114
12099
  } else {
12115
- assert(logger$4k, typeof block === "string", `not a valid block id: ${block}`);
12100
+ assert(logger$4j, typeof block === "string", `not a valid block id: ${block}`);
12116
12101
  this.blockId = block;
12117
12102
  }
12118
12103
  this.offset = offset;
@@ -12122,7 +12107,7 @@ var __publicField = (obj, key, value) => {
12122
12107
  return true;
12123
12108
  }
12124
12109
  }
12125
- const logger$4j = getLogger("editor-position");
12110
+ const logger$4i = getLogger("editor-position");
12126
12111
  function createSimpleBlockPosition(block, offset, type) {
12127
12112
  return new EditorSimpleBlockPosition(block, offset, type);
12128
12113
  }
@@ -12144,7 +12129,7 @@ var __publicField = (obj, key, value) => {
12144
12129
  }
12145
12130
  const block1 = editor.getBlockById(pos1.blockId);
12146
12131
  const block2 = editor.getBlockById(pos2.blockId);
12147
- assert(logger$4j, block1 !== block2, "comparePosition: blocks are the same");
12132
+ assert(logger$4i, block1 !== block2, "comparePosition: blocks are the same");
12148
12133
  return compareElement(block1, block2);
12149
12134
  }
12150
12135
  if (isComplexBlockPosition(pos1) && isComplexBlockPosition(pos2)) {
@@ -12155,13 +12140,13 @@ var __publicField = (obj, key, value) => {
12155
12140
  }
12156
12141
  const container1 = editor.getContainerById(p1.childContainerId);
12157
12142
  const container2 = editor.getContainerById(p2.childContainerId);
12158
- assert(logger$4j, container1 !== container2, "comparePosition: containers are the same");
12143
+ assert(logger$4i, container1 !== container2, "comparePosition: containers are the same");
12159
12144
  return compareElement(container1, container2);
12160
12145
  }
12161
- assert(logger$4j, false, "invalid ");
12146
+ assert(logger$4i, false, "invalid ");
12162
12147
  return 0;
12163
12148
  }
12164
- const logger$4i = getLogger("simple-range");
12149
+ const logger$4h = getLogger("simple-range");
12165
12150
  class EditorSimpleSelectionRange {
12166
12151
  constructor(editor, options) {
12167
12152
  __publicField(this, "editor");
@@ -12210,11 +12195,11 @@ var __publicField = (obj, key, value) => {
12210
12195
  const { editor } = this;
12211
12196
  const startBlock = editor.getBlockById(this.start.blockId);
12212
12197
  const endBlock = editor.getBlockById(this.end.blockId);
12213
- assert(logger$4i, startBlock, "no start block");
12214
- assert(logger$4i, endBlock, "no end block");
12198
+ assert(logger$4h, startBlock, "no start block");
12199
+ assert(logger$4h, endBlock, "no end block");
12215
12200
  const startContainer = getParentContainer(startBlock);
12216
12201
  const endContainer = getParentContainer(endBlock);
12217
- assert(logger$4i, startContainer === endContainer, "invalid range");
12202
+ assert(logger$4h, startContainer === endContainer, "invalid range");
12218
12203
  const ret = [];
12219
12204
  if (startBlock === endBlock) {
12220
12205
  ret.push({
@@ -12225,7 +12210,7 @@ var __publicField = (obj, key, value) => {
12225
12210
  } else {
12226
12211
  const startIndex = getBlockIndex(startBlock);
12227
12212
  const endIndex = getBlockIndex(endBlock);
12228
- assert(logger$4i, startIndex < endIndex, "invalid range, start > index");
12213
+ assert(logger$4h, startIndex < endIndex, "invalid range, start > index");
12229
12214
  ret.push({
12230
12215
  block: startBlock,
12231
12216
  start: this.start,
@@ -12325,7 +12310,7 @@ var __publicField = (obj, key, value) => {
12325
12310
  clearSelection: clearSelection$6,
12326
12311
  convertTo: convertTo$m
12327
12312
  };
12328
- const logger$4h = getLogger("editor-blocks");
12313
+ const logger$4g = getLogger("editor-blocks");
12329
12314
  class EditorBlocks {
12330
12315
  constructor(editor) {
12331
12316
  __publicField(this, "blocks", /* @__PURE__ */ new Map());
@@ -12334,12 +12319,12 @@ var __publicField = (obj, key, value) => {
12334
12319
  registerBlockClass(blockClass) {
12335
12320
  const type = blockClass.blockType;
12336
12321
  const exists = this.blocks.get(type);
12337
- assert(logger$4h, !exists, `duplicated block type: ${type}`);
12322
+ assert(logger$4g, !exists, `duplicated block type: ${type}`);
12338
12323
  this.blocks.set(type, blockClass);
12339
12324
  }
12340
12325
  getBlockClass(type) {
12341
12326
  const exists = this.blocks.get(type);
12342
- assert(logger$4h, exists, `unknown block type: ${type}`);
12327
+ assert(logger$4g, exists, `unknown block type: ${type}`);
12343
12328
  return exists;
12344
12329
  }
12345
12330
  hasBlock(type) {
@@ -12355,7 +12340,7 @@ var __publicField = (obj, key, value) => {
12355
12340
  }
12356
12341
  const content = blockClass.createBlockContent(this.editor, path, container, blockElement, block);
12357
12342
  if (content.parentElement !== blockElement) {
12358
- logger$4h.warn("content parent is not block");
12343
+ logger$4g.warn("content parent is not block");
12359
12344
  blockElement.appendChild(content);
12360
12345
  }
12361
12346
  this.editor.blockHooks.forEach((hook) => {
@@ -12376,7 +12361,7 @@ var __publicField = (obj, key, value) => {
12376
12361
  return newBlock;
12377
12362
  }
12378
12363
  }
12379
- const logger$4g = getLogger("editor-embeds");
12364
+ const logger$4f = getLogger("editor-embeds");
12380
12365
  class EditorEmbeds {
12381
12366
  constructor(editor) {
12382
12367
  __publicField(this, "objects", /* @__PURE__ */ new Map());
@@ -12385,12 +12370,12 @@ var __publicField = (obj, key, value) => {
12385
12370
  registerEmbedClass(embedClass) {
12386
12371
  const type = embedClass.embedType;
12387
12372
  const exists = this.objects.get(type);
12388
- assert(logger$4g, !exists, `duplicated embed object type: ${type}`);
12373
+ assert(logger$4f, !exists, `duplicated embed object type: ${type}`);
12389
12374
  this.objects.set(type, embedClass);
12390
12375
  }
12391
12376
  getEmbedClass(type) {
12392
12377
  const exists = this.objects.get(type);
12393
- assert(logger$4g, exists, `unknown embed type: ${type}`);
12378
+ assert(logger$4f, exists, `unknown embed type: ${type}`);
12394
12379
  return exists;
12395
12380
  }
12396
12381
  getEmbedClassFromBlock(block) {
@@ -12400,12 +12385,12 @@ var __publicField = (obj, key, value) => {
12400
12385
  this.objects.forEach(callback);
12401
12386
  }
12402
12387
  }
12403
- const logger$4f = getLogger("embed-block");
12388
+ const logger$4e = getLogger("embed-block");
12404
12389
  function createBlockContent$6(editor, path, container, blockElement, blockData) {
12405
12390
  const content = createBlockContentElement(blockElement, "div");
12406
- assert(logger$4f, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
12391
+ assert(logger$4e, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
12407
12392
  const embedBlockData = blockData;
12408
- assert(logger$4f, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
12393
+ assert(logger$4e, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
12409
12394
  const embedClass = editor.editorEmbeds.getEmbedClass(embedBlockData.embedType);
12410
12395
  embedClass.createEmbedContent(editor, content, embedBlockData, path, container, blockElement);
12411
12396
  blockElement.setAttribute("data-embed-type", embedBlockData.embedType);
@@ -12433,7 +12418,7 @@ var __publicField = (obj, key, value) => {
12433
12418
  function getCaretRect$4(block, pos) {
12434
12419
  const content = getBlockContent(block);
12435
12420
  const rect = content.getBoundingClientRect();
12436
- assert(logger$4f, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
12421
+ assert(logger$4e, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
12437
12422
  if (pos.offset === 1) {
12438
12423
  return new DOMRect(rect.right, rect.top, 0, rect.height);
12439
12424
  }
@@ -12573,18 +12558,18 @@ var __publicField = (obj, key, value) => {
12573
12558
  toStandardDoc: toStandardDoc$2,
12574
12559
  getResources: getResources$2
12575
12560
  };
12576
- const logger$4e = getLogger("complex-block-helper");
12561
+ const logger$4d = getLogger("complex-block-helper");
12577
12562
  function complexBlockGetAllChildContainers(editor, block, options) {
12578
12563
  const blockClass = getComplexBlockClass(editor, block);
12579
12564
  return blockClass.getChildContainers(editor, block, options);
12580
12565
  }
12581
12566
  function complexBlockGetSelectedContainers(editor, block, start, end) {
12582
12567
  if (start.isSimple()) {
12583
- assert(logger$4e, end.isSimple(), "invalid start and end position");
12568
+ assert(logger$4d, end.isSimple(), "invalid start and end position");
12584
12569
  return complexBlockGetAllChildContainers(editor, block);
12585
12570
  }
12586
- assert(logger$4e, !start.isSimple(), "invalid start pos");
12587
- assert(logger$4e, !end.isSimple(), "invalid end pos");
12571
+ assert(logger$4d, !start.isSimple(), "invalid start pos");
12572
+ assert(logger$4d, !end.isSimple(), "invalid end pos");
12588
12573
  const blockClass = getComplexBlockClass(editor, block);
12589
12574
  return blockClass.getSelectedContainers(editor, block, start, end);
12590
12575
  }
@@ -12595,11 +12580,11 @@ var __publicField = (obj, key, value) => {
12595
12580
  const parentComplexBlock = getParentBlock(getParentContainer(childBlock));
12596
12581
  if (!parentComplexBlock)
12597
12582
  return false;
12598
- assert(logger$4e, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12583
+ assert(logger$4d, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12599
12584
  const childContainer = getParentContainer(childBlock);
12600
12585
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock);
12601
12586
  const index2 = childContainers.indexOf(childContainer);
12602
- assert(logger$4e, index2 >= 0, "not valid child container");
12587
+ assert(logger$4d, index2 >= 0, "not valid child container");
12603
12588
  return index2 === 0;
12604
12589
  }
12605
12590
  function complexBlockGetFirstSimpleChild(editor, complexBlock, options) {
@@ -12652,13 +12637,13 @@ var __publicField = (obj, key, value) => {
12652
12637
  return block;
12653
12638
  }
12654
12639
  function findPrevSimpleBlockBeforeChildContainer(editor, childContainer, options) {
12655
- assert(logger$4e, isChildContainer(childContainer), "not a child container");
12640
+ assert(logger$4d, isChildContainer(childContainer), "not a child container");
12656
12641
  const parentComplexBlock = getParentBlock(childContainer);
12657
- assert(logger$4e, parentComplexBlock, "no parent block");
12658
- assert(logger$4e, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12642
+ assert(logger$4d, parentComplexBlock, "no parent block");
12643
+ assert(logger$4d, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12659
12644
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock, options);
12660
12645
  const containerIndex = childContainers.indexOf(childContainer);
12661
- assert(logger$4e, containerIndex !== -1, "child container not found");
12646
+ assert(logger$4d, containerIndex !== -1, "child container not found");
12662
12647
  if (containerIndex === 0) {
12663
12648
  const prevBlock = getPrevBlock(parentComplexBlock);
12664
12649
  if (!prevBlock)
@@ -12676,9 +12661,9 @@ var __publicField = (obj, key, value) => {
12676
12661
  return lastBlock2;
12677
12662
  }
12678
12663
  function complexBlockGetTopChildContainers(editor, complexBlock) {
12679
- assert(logger$4e, isComplexKindBlock(editor, complexBlock), "not a complex block");
12664
+ assert(logger$4d, isComplexKindBlock(editor, complexBlock), "not a complex block");
12680
12665
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
12681
- assert(logger$4e, childContainers.length > 0, "no child container");
12666
+ assert(logger$4d, childContainers.length > 0, "no child container");
12682
12667
  if (childContainers.length === 1) {
12683
12668
  return childContainers;
12684
12669
  }
@@ -12703,9 +12688,9 @@ var __publicField = (obj, key, value) => {
12703
12688
  return ret;
12704
12689
  }
12705
12690
  function complexBlockGetBottomChildContainers(editor, complexBlock) {
12706
- assert(logger$4e, isComplexKindBlock(editor, complexBlock), "not a complex block");
12691
+ assert(logger$4d, isComplexKindBlock(editor, complexBlock), "not a complex block");
12707
12692
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
12708
- assert(logger$4e, childContainers.length > 0, "no child container");
12693
+ assert(logger$4d, childContainers.length > 0, "no child container");
12709
12694
  if (childContainers.length === 1) {
12710
12695
  return childContainers;
12711
12696
  }
@@ -12810,11 +12795,11 @@ var __publicField = (obj, key, value) => {
12810
12795
  return result;
12811
12796
  }
12812
12797
  const anchor = "";
12813
- const logger$4d = getLogger("text-range");
12798
+ const logger$4c = getLogger("text-range");
12814
12799
  function getBlockRangeInfo(block, blockOffset) {
12815
12800
  const getChildRange = (child, offset) => {
12816
12801
  if (isTextBlockContentInsertionChild(child)) {
12817
- assert(logger$4d, offset === 0, `invalid offset for insertion child: ${offset}`);
12802
+ assert(logger$4c, offset === 0, `invalid offset for insertion child: ${offset}`);
12818
12803
  const childOffset = 2;
12819
12804
  return {
12820
12805
  child,
@@ -12823,7 +12808,7 @@ var __publicField = (obj, key, value) => {
12823
12808
  };
12824
12809
  }
12825
12810
  if (isTextBlockContentBoxChild(child)) {
12826
- assert(logger$4d, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
12811
+ assert(logger$4c, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
12827
12812
  const childOffset = offset === 0 ? 1 : 2;
12828
12813
  return {
12829
12814
  child,
@@ -12832,17 +12817,17 @@ var __publicField = (obj, key, value) => {
12832
12817
  };
12833
12818
  }
12834
12819
  const textNode = child.firstChild;
12835
- assert(logger$4d, textNode, "no child node for text child");
12836
- assert(logger$4d, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
12820
+ assert(logger$4c, textNode, "no child node for text child");
12821
+ assert(logger$4c, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
12837
12822
  if (textNode instanceof HTMLBRElement) {
12838
- assert(logger$4d, offset >= 0 && offset <= 0, "invalid offset for text child");
12823
+ assert(logger$4c, offset >= 0 && offset <= 0, "invalid offset for text child");
12839
12824
  return {
12840
12825
  child,
12841
12826
  container: textNode,
12842
12827
  offset
12843
12828
  };
12844
12829
  }
12845
- assert(logger$4d, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
12830
+ assert(logger$4c, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
12846
12831
  return {
12847
12832
  child,
12848
12833
  container: textNode,
@@ -12871,38 +12856,38 @@ var __publicField = (obj, key, value) => {
12871
12856
  }
12872
12857
  start += childLength;
12873
12858
  }
12874
- assert(logger$4d, false, "failed to get range info");
12859
+ assert(logger$4c, false, "failed to get range info");
12875
12860
  }
12876
12861
  function createChildRange(child, start, end) {
12877
12862
  if (start === end) {
12878
- assert(logger$4d, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
12863
+ assert(logger$4c, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
12879
12864
  } else {
12880
- assert(logger$4d, start < end, `invalid start & end: ${start}, ${end}`);
12865
+ assert(logger$4c, start < end, `invalid start & end: ${start}, ${end}`);
12881
12866
  }
12882
12867
  if (isTextBlockContentInsertionChild(child)) {
12883
- assert(logger$4d, start === end, `invalid insertion child range offset: ${start}, ${end}`);
12884
- assert(logger$4d, start === 0, `invalid insertion child range start: ${start}`);
12868
+ assert(logger$4c, start === end, `invalid insertion child range offset: ${start}, ${end}`);
12869
+ assert(logger$4c, start === 0, `invalid insertion child range start: ${start}`);
12885
12870
  const insertionElem = child;
12886
- assert(logger$4d, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
12871
+ assert(logger$4c, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
12887
12872
  const range = createExpandedRange(insertionElem, 1, insertionElem, 2);
12888
12873
  return range;
12889
12874
  }
12890
12875
  if (isTextBlockContentBoxChild(child)) {
12891
- assert(logger$4d, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
12892
- assert(logger$4d, start === 0, `invalid box child range start: ${start}`);
12876
+ assert(logger$4c, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
12877
+ assert(logger$4c, start === 0, `invalid box child range start: ${start}`);
12893
12878
  const box = child;
12894
- assert(logger$4d, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
12879
+ assert(logger$4c, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
12895
12880
  const range = createExpandedRange(box, 1, box, 2);
12896
12881
  return range;
12897
12882
  }
12898
12883
  const length = getTextBlockContentChildTextLength(child);
12899
- assert(logger$4d, end <= length, `invalid child end: ${end}, ${length}`);
12884
+ assert(logger$4c, end <= length, `invalid child end: ${end}, ${length}`);
12900
12885
  const textNode = child.firstChild;
12901
- assert(logger$4d, textNode instanceof Text, "invalid block text child");
12902
- assert(logger$4d, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
12886
+ assert(logger$4c, textNode instanceof Text, "invalid block text child");
12887
+ assert(logger$4c, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
12903
12888
  return createExpandedRange(textNode, start, textNode, end);
12904
12889
  }
12905
- const logger$4c = getLogger("caret-rect");
12890
+ const logger$4b = getLogger("caret-rect");
12906
12891
  function getChildClientRects(block, child) {
12907
12892
  if (isBox(child)) {
12908
12893
  const box = child;
@@ -12911,7 +12896,7 @@ var __publicField = (obj, key, value) => {
12911
12896
  const blockContent = getBlockContent(block);
12912
12897
  const lineHeight = Number.parseFloat(window.getComputedStyle(blockContent).lineHeight) || boxContent.getBoundingClientRect().height;
12913
12898
  const rects = Array.from(boxContent.getClientRects());
12914
- assert(logger$4c, rects.length > 0, "no box client rects");
12899
+ assert(logger$4b, rects.length > 0, "no box client rects");
12915
12900
  const blockRect = blockContent.getBoundingClientRect();
12916
12901
  const firstRect = rects[0];
12917
12902
  const lastRect = new DOMRect(blockRect.left, firstRect.bottom, 1, lineHeight);
@@ -12931,22 +12916,22 @@ var __publicField = (obj, key, value) => {
12931
12916
  const rect2 = getLastClientRect(ranges[0].child);
12932
12917
  return new DOMRect(rect2.right, rect2.top, 1, rect2.height);
12933
12918
  }
12934
- assert(logger$4c, ranges[1], "invalid ranges");
12919
+ assert(logger$4b, ranges[1], "invalid ranges");
12935
12920
  const rect = getFirstClientRect(ranges[1].child);
12936
12921
  return new DOMRect(rect.left, rect.top, 1, rect.height);
12937
12922
  }
12938
12923
  let rangeInfo = ranges[0];
12939
- assert(logger$4c, ranges.length >= 1, "failed to get block range");
12924
+ assert(logger$4b, ranges.length >= 1, "failed to get block range");
12940
12925
  if (ranges.length === 1) {
12941
12926
  rangeInfo = ranges[0];
12942
12927
  } else {
12943
- assert(logger$4c, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
12928
+ assert(logger$4b, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
12944
12929
  if (isTextBlockContentInsertionChild(ranges[ranges.length - 1].child)) {
12945
12930
  rangeInfo = ranges[ranges.length - 1];
12946
12931
  const child = rangeInfo.child;
12947
12932
  const content = getInsertionContent(child);
12948
12933
  const rects2 = content.getClientRects();
12949
- assert(logger$4c, rects2.length >= 1, "no client rects for box content");
12934
+ assert(logger$4b, rects2.length >= 1, "no client rects for box content");
12950
12935
  const rect = rects2[rects2.length - 1];
12951
12936
  return new DOMRect(rect.right, rect.y, 1, rect.height);
12952
12937
  }
@@ -12963,9 +12948,9 @@ var __publicField = (obj, key, value) => {
12963
12948
  }
12964
12949
  }
12965
12950
  if (rangeInfo.container instanceof HTMLBRElement) {
12966
- assert(logger$4c, pos.offset === 0, "invalid offset for empty block text");
12951
+ assert(logger$4b, pos.offset === 0, "invalid offset for empty block text");
12967
12952
  const parent = rangeInfo.container.parentElement;
12968
- assert(logger$4c, parent, "invalid br parent");
12953
+ assert(logger$4b, parent, "invalid br parent");
12969
12954
  const rect = parent.getBoundingClientRect();
12970
12955
  const ret = new DOMRect(rect.left, rect.top, 1, rect.height);
12971
12956
  return ret;
@@ -12973,11 +12958,11 @@ var __publicField = (obj, key, value) => {
12973
12958
  const range = createRange(rangeInfo.container, rangeInfo.offset);
12974
12959
  const rects = Array.from(range.getClientRects());
12975
12960
  if (rects.length === 0) {
12976
- assert(logger$4c, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
12977
- assert(logger$4c, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
12961
+ assert(logger$4b, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
12962
+ assert(logger$4b, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
12978
12963
  const child = rangeInfo.child;
12979
12964
  const rects2 = getChildClientRects(block, child);
12980
- assert(logger$4c, rects2.length >= 1, "no client rects for box content");
12965
+ assert(logger$4b, rects2.length >= 1, "no client rects for box content");
12981
12966
  if (rangeInfo.offset === 1) {
12982
12967
  const rect2 = rects2[0];
12983
12968
  return new DOMRect(rect2.x, rect2.y, 1, rect2.height);
@@ -13023,7 +13008,7 @@ var __publicField = (obj, key, value) => {
13023
13008
  });
13024
13009
  }
13025
13010
  }
13026
- assert(logger$4c, rects.length > 0, "no client rects for range");
13011
+ assert(logger$4b, rects.length > 0, "no client rects for range");
13027
13012
  if (pos.type === "home") {
13028
13013
  return rects[rects.length - 1];
13029
13014
  }
@@ -13103,13 +13088,13 @@ var __publicField = (obj, key, value) => {
13103
13088
  };
13104
13089
  }
13105
13090
  }
13106
- const logger$4b = getLogger("selection-range");
13091
+ const logger$4a = getLogger("selection-range");
13107
13092
  function createEditorSelectionRange(editor, options) {
13108
13093
  const { anchor: anchor2, focus } = options;
13109
13094
  if (anchor2 instanceof EditorSimpleBlockPosition && focus instanceof EditorSimpleBlockPosition) {
13110
13095
  return new EditorSimpleSelectionRange(editor, { anchor: anchor2, focus });
13111
13096
  }
13112
- assert(logger$4b, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
13097
+ assert(logger$4a, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
13113
13098
  return new EditorComplexSelectionRange(editor, { anchor: anchor2, focus });
13114
13099
  }
13115
13100
  function createBlockSimpleRange(editor, block, anchor2, focus) {
@@ -13131,7 +13116,7 @@ var __publicField = (obj, key, value) => {
13131
13116
  const focus = createSimpleBlockPosition(range.focus.blockId, range.focus.offset, "normal");
13132
13117
  return createEditorSelectionRange(editor, { anchor: anchor2, focus });
13133
13118
  }
13134
- const logger$4a = getLogger("range-from-point");
13119
+ const logger$49 = getLogger("range-from-point");
13135
13120
  function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
13136
13121
  const yOffsets = [0, -12, 12];
13137
13122
  let x = pointX;
@@ -13163,7 +13148,7 @@ var __publicField = (obj, key, value) => {
13163
13148
  const rect = elem.getBoundingClientRect();
13164
13149
  if (rect.width && rect.top && i === 0) {
13165
13150
  if (rect.left + rect.width < x || rect.top + rect.height < y) {
13166
- logger$4a.debug("click on scrollbar, out of element rect");
13151
+ logger$49.debug("click on scrollbar, out of element rect");
13167
13152
  return null;
13168
13153
  }
13169
13154
  }
@@ -13201,7 +13186,7 @@ var __publicField = (obj, key, value) => {
13201
13186
  let block = getLastChildBlock(container);
13202
13187
  if (!isVisibleBlock(block)) {
13203
13188
  const preBlock = getPrevVisibleBlock(block);
13204
- assert(logger$4a, preBlock, "container must have visible block");
13189
+ assert(logger$49, preBlock, "container must have visible block");
13205
13190
  block = preBlock;
13206
13191
  }
13207
13192
  const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, block.getBoundingClientRect().bottom - 4);
@@ -13220,7 +13205,7 @@ var __publicField = (obj, key, value) => {
13220
13205
  if (range instanceof EditorSimpleSelectionRange) {
13221
13206
  return range;
13222
13207
  }
13223
- assert(logger$4a, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
13208
+ assert(logger$49, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
13224
13209
  const complexRange = range;
13225
13210
  const container2 = editor.getContainerById(complexRange.start.childContainerId);
13226
13211
  return getRangeInContainer(editor, container2, x, y);
@@ -13243,7 +13228,7 @@ var __publicField = (obj, key, value) => {
13243
13228
  });
13244
13229
  return getRangeInContainer(editor, container, x, y);
13245
13230
  }
13246
- const logger$49 = getLogger("adjust-selection-pos");
13231
+ const logger$48 = getLogger("adjust-selection-pos");
13247
13232
  function getParentContainers(block) {
13248
13233
  const containers = [];
13249
13234
  while (block) {
@@ -13253,10 +13238,10 @@ var __publicField = (obj, key, value) => {
13253
13238
  return containers;
13254
13239
  }
13255
13240
  const newBlock = getParentBlock(container);
13256
- assert(logger$49, newBlock, "child container has not parent container");
13241
+ assert(logger$48, newBlock, "child container has not parent container");
13257
13242
  block = newBlock;
13258
13243
  }
13259
- assert(logger$49, false, "should not come here: getParentContainers");
13244
+ assert(logger$48, false, "should not come here: getParentContainers");
13260
13245
  }
13261
13246
  function getParentBlockInContainer(container, block) {
13262
13247
  while (block) {
@@ -13265,16 +13250,16 @@ var __publicField = (obj, key, value) => {
13265
13250
  return block;
13266
13251
  }
13267
13252
  const newBlock = getParentBlock(parent);
13268
- assert(logger$49, newBlock, "could not find parent block for a child container");
13253
+ assert(logger$48, newBlock, "could not find parent block for a child container");
13269
13254
  block = newBlock;
13270
13255
  }
13271
- assert(logger$49, false, "no parent block in specified container");
13256
+ assert(logger$48, false, "no parent block in specified container");
13272
13257
  }
13273
13258
  function getClosestParentBlock(block1, block2) {
13274
13259
  const containers1 = getParentContainers(block1);
13275
13260
  const containers2 = getParentContainers(block2);
13276
- assert(logger$49, containers1.length > 0 && containers2.length > 0, "block has not parent container");
13277
- assert(logger$49, containers1[0] === containers2[0], "root container does not equal");
13261
+ assert(logger$48, containers1.length > 0 && containers2.length > 0, "block has not parent container");
13262
+ assert(logger$48, containers1[0] === containers2[0], "root container does not equal");
13278
13263
  let parentContainer = containers1[0];
13279
13264
  for (let i = 1; i < containers1.length || containers2.length; i++) {
13280
13265
  if (containers1[i] === containers2[i]) {
@@ -13293,23 +13278,23 @@ var __publicField = (obj, key, value) => {
13293
13278
  }
13294
13279
  function getParentContainerInComplexBlock(parentComplexBlock, element) {
13295
13280
  let block = getParentBlock(element);
13296
- assert(logger$49, block, "element is not in a block");
13281
+ assert(logger$48, block, "element is not in a block");
13297
13282
  while (block) {
13298
13283
  const container = getParentContainer(block);
13299
- assert(logger$49, isChildContainer(container), "not a child container");
13284
+ assert(logger$48, isChildContainer(container), "not a child container");
13300
13285
  const parentBlock = getParentBlock(container);
13301
- assert(logger$49, parentBlock, "child container has not parent block");
13286
+ assert(logger$48, parentBlock, "child container has not parent block");
13302
13287
  if (parentBlock === parentComplexBlock) {
13303
13288
  return container;
13304
13289
  }
13305
13290
  block = parentBlock;
13306
13291
  }
13307
- assert(logger$49, false, "failed to find parent container in complex block");
13292
+ assert(logger$48, false, "failed to find parent container in complex block");
13308
13293
  }
13309
13294
  function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
13310
13295
  const blockId = getBlockId(complexBlock);
13311
- assert(logger$49, blockId === anchor2.blockId, "invalid start pos");
13312
- assert(logger$49, blockId === focus.blockId, "invalid end pos");
13296
+ assert(logger$48, blockId === anchor2.blockId, "invalid start pos");
13297
+ assert(logger$48, blockId === focus.blockId, "invalid end pos");
13313
13298
  const blockClass = getComplexBlockClass(editor, complexBlock);
13314
13299
  if (blockClass.adjustSelectionPos) {
13315
13300
  return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
@@ -13343,8 +13328,8 @@ var __publicField = (obj, key, value) => {
13343
13328
  if (focus instanceof EditorComplexBlockPosition) {
13344
13329
  focus = createSimpleBlockPosition(focusBlock, getBlockTextLength$6(editor, focusBlock), "end");
13345
13330
  }
13346
- assert(logger$49, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
13347
- assert(logger$49, focus instanceof EditorSimpleBlockPosition, "not valid position type");
13331
+ assert(logger$48, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
13332
+ assert(logger$48, focus instanceof EditorSimpleBlockPosition, "not valid position type");
13348
13333
  return {
13349
13334
  anchor: anchor2,
13350
13335
  focus
@@ -13379,7 +13364,7 @@ var __publicField = (obj, key, value) => {
13379
13364
  const focusChildContainer = getParentContainerInComplexBlock(parentComplexBlock, focusBlock);
13380
13365
  anchor2 = createComplexBlockPosition(newAnchorBlock, getContainerId(anchorChildContainer));
13381
13366
  focus = createComplexBlockPosition(newAnchorBlock, getContainerId(focusChildContainer));
13382
- logger$49.debug(`select in complex block: ${anchorChildContainer.id}, ${focusChildContainer.id}`);
13367
+ logger$48.debug(`select in complex block: ${anchorChildContainer.id}, ${focusChildContainer.id}`);
13383
13368
  return complexBlockAdjustSelectionPos(editor, parentComplexBlock, anchor2, focus);
13384
13369
  }
13385
13370
  let anchorOffsetNormal = reverse ? getBlockTextLength$6(editor, newAnchorBlock) : 0;
@@ -13399,7 +13384,7 @@ var __publicField = (obj, key, value) => {
13399
13384
  focus
13400
13385
  };
13401
13386
  }
13402
- const logger$48 = getLogger("core");
13387
+ const logger$47 = getLogger("core");
13403
13388
  function createBlockAnchor(editor, block, id, refClientRect) {
13404
13389
  const tools = getBlockTools(block);
13405
13390
  let elem = tools.querySelector(`.block-anchor[data-id=${id}]`);
@@ -13417,7 +13402,7 @@ var __publicField = (obj, key, value) => {
13417
13402
  return elem;
13418
13403
  }
13419
13404
  function createBlockCaretAnchor(editor, block, offset, id) {
13420
- assert(logger$48, isTextKindBlock(editor, block), "not a text kind block");
13405
+ assert(logger$47, isTextKindBlock(editor, block), "not a text kind block");
13421
13406
  const caretRect = getTextCaretRect(block, createSimpleBlockPosition(block, offset, "normal"));
13422
13407
  const blockRect = block.getBoundingClientRect();
13423
13408
  const tools = getBlockTools(block);
@@ -13776,19 +13761,19 @@ var __publicField = (obj, key, value) => {
13776
13761
  return result + (index2 ? "-" : "") + word.toLowerCase();
13777
13762
  });
13778
13763
  const kebabCase$1 = kebabCase;
13779
- const logger$47 = getLogger("box");
13764
+ const logger$46 = getLogger("box");
13780
13765
  function isBoxOp(op) {
13781
13766
  if (!op.attributes)
13782
13767
  return false;
13783
13768
  if (!op.attributes.box)
13784
13769
  return false;
13785
- assert(logger$47, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
13786
- assert(logger$47, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
13770
+ assert(logger$46, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
13771
+ assert(logger$46, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
13787
13772
  return true;
13788
13773
  }
13789
- const logger$46 = getLogger("text-op");
13774
+ const logger$45 = getLogger("text-op");
13790
13775
  function getOpLength(op) {
13791
- assert(logger$46, typeof op.insert === "string", "invalid op, no insert");
13776
+ assert(logger$45, typeof op.insert === "string", "invalid op, no insert");
13792
13777
  return op.insert.length;
13793
13778
  }
13794
13779
  function getOpAt(text2, offset) {
@@ -13796,7 +13781,7 @@ var __publicField = (obj, key, value) => {
13796
13781
  let pos = 0;
13797
13782
  for (let i = 0; i < ops.length; i++) {
13798
13783
  const op = ops[i];
13799
- assert(logger$46, typeof op.insert === "string", "invalid text op, no insert");
13784
+ assert(logger$45, typeof op.insert === "string", "invalid text op, no insert");
13800
13785
  const end = pos + getOpLength(op);
13801
13786
  if (end > offset) {
13802
13787
  return [op];
@@ -13812,22 +13797,22 @@ var __publicField = (obj, key, value) => {
13812
13797
  }
13813
13798
  return [];
13814
13799
  }
13815
- const logger$45 = getLogger("rich-text-length");
13800
+ const logger$44 = getLogger("rich-text-length");
13816
13801
  function getTextOpLength(op) {
13817
- assert(logger$45, typeof op.insert === "string", "op.insert is not string");
13802
+ assert(logger$44, typeof op.insert === "string", "op.insert is not string");
13818
13803
  return op.insert.length;
13819
13804
  }
13820
13805
  function getTextLength(ops) {
13821
13806
  let count = 0;
13822
13807
  ops.forEach((op) => {
13823
13808
  if (op.insert) {
13824
- assert(logger$45, typeof op.insert === "string", "op.insert is not string");
13809
+ assert(logger$44, typeof op.insert === "string", "op.insert is not string");
13825
13810
  count += getTextOpLength(op);
13826
13811
  }
13827
13812
  });
13828
13813
  return count;
13829
13814
  }
13830
- const logger$44 = getLogger("split-text");
13815
+ const logger$43 = getLogger("split-text");
13831
13816
  function splitText(ops, offset, splitResult) {
13832
13817
  ops = cloneDeep__default.default(ops);
13833
13818
  if (offset === 0) {
@@ -13845,8 +13830,8 @@ var __publicField = (obj, key, value) => {
13845
13830
  let counted = 0;
13846
13831
  for (let i = 0; i < ops.length; i++) {
13847
13832
  const op = ops[i];
13848
- assert(logger$44, typeof op === "object", `invalid op type, ${typeof op}`);
13849
- assert(logger$44, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
13833
+ assert(logger$43, typeof op === "object", `invalid op type, ${typeof op}`);
13834
+ assert(logger$43, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
13850
13835
  const subLen = getTextOpLength(op);
13851
13836
  if (counted + subLen < offset) {
13852
13837
  counted += subLen;
@@ -13856,18 +13841,18 @@ var __publicField = (obj, key, value) => {
13856
13841
  right: ops.slice(i + 1)
13857
13842
  };
13858
13843
  } else {
13859
- assert(logger$44, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
13844
+ assert(logger$43, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
13860
13845
  const splitIndex = offset - counted;
13861
13846
  const copied = cloneDeep__default.default(op);
13862
- assert(logger$44, copied.insert, "no copied.insert");
13863
- assert(logger$44, typeof copied.insert === "string", "invalid copied.insert type");
13847
+ assert(logger$43, copied.insert, "no copied.insert");
13848
+ assert(logger$43, typeof copied.insert === "string", "invalid copied.insert type");
13864
13849
  copied.insert = copied.insert.substr(0, splitIndex);
13865
13850
  op.insert = op.insert.substr(splitIndex);
13866
13851
  if (copied.insert === "") {
13867
- assert(logger$44, false, "invalid copied.insert, is empty string");
13852
+ assert(logger$43, false, "invalid copied.insert, is empty string");
13868
13853
  }
13869
13854
  if (op.insert === "") {
13870
- assert(logger$44, false, "invalid op.insert, is empty string");
13855
+ assert(logger$43, false, "invalid op.insert, is empty string");
13871
13856
  }
13872
13857
  const right = [
13873
13858
  op,
@@ -13886,9 +13871,9 @@ var __publicField = (obj, key, value) => {
13886
13871
  throw new Error(`invalid split offset: ${offset}, ${JSON.stringify(ops)}`);
13887
13872
  }
13888
13873
  function splitToThree(text2, offset, length) {
13889
- assert(logger$44, offset >= 0, "invalid offset, < 0");
13890
- assert(logger$44, length > 0, "invalid length, <= 0");
13891
- assert(logger$44, offset + length <= getTextLength(text2), "invalid offset + length < text length");
13874
+ assert(logger$43, offset >= 0, "invalid offset, < 0");
13875
+ assert(logger$43, length > 0, "invalid length, <= 0");
13876
+ assert(logger$43, offset + length <= getTextLength(text2), "invalid offset + length < text length");
13892
13877
  const { left: temp, right } = splitText(text2, offset + length);
13893
13878
  const { left, right: middle } = splitText(temp, offset);
13894
13879
  return { left, middle, right };
@@ -14111,9 +14096,9 @@ var __publicField = (obj, key, value) => {
14111
14096
  }
14112
14097
  return [color, backgroundColor];
14113
14098
  }
14114
- const logger$43 = getLogger("text-block-content");
14099
+ const logger$42 = getLogger("text-block-content");
14115
14100
  function updateBlockContentCore(editor, blockPath, content, blockText, insertions) {
14116
- assert(logger$43, blockText, "no text for block");
14101
+ assert(logger$42, blockText, "no text for block");
14117
14102
  if (blockText.length === 0 && (!insertions || insertions.size === 0)) {
14118
14103
  content.innerHTML = "<span><br></span>";
14119
14104
  return;
@@ -14145,9 +14130,9 @@ var __publicField = (obj, key, value) => {
14145
14130
  for (let i2 = 0; i2 < text2.length; i2++) {
14146
14131
  const op = text2[i2];
14147
14132
  if (isBoxOp(op)) {
14148
- assert(logger$43, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
14133
+ assert(logger$42, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
14149
14134
  const span2 = editor.editorBoxes.createBox(content, op.attributes);
14150
- assert(logger$43, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
14135
+ assert(logger$42, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
14151
14136
  const ret = editor.editorBlockRenders.renderBox(blockPath, op.attributes);
14152
14137
  if (ret.classes) {
14153
14138
  addClass(span2, ...ret.classes);
@@ -14165,7 +14150,7 @@ var __publicField = (obj, key, value) => {
14165
14150
  fragment.appendChild(span2);
14166
14151
  continue;
14167
14152
  }
14168
- assert(logger$43, op.insert, `no insert in op: ${JSON.stringify(op)}`);
14153
+ assert(logger$42, op.insert, `no insert in op: ${JSON.stringify(op)}`);
14169
14154
  const span = createElement("span", ["text"], fragment, op.insert);
14170
14155
  if (op.attributes) {
14171
14156
  const ret = editor.editorBlockRenders.renderText(blockPath, op.attributes);
@@ -14196,7 +14181,7 @@ var __publicField = (obj, key, value) => {
14196
14181
  const compositionText = editor.compositingText;
14197
14182
  if (compositionText) {
14198
14183
  const pos = editor.selection.range.start;
14199
- assert(logger$43, pos.isSimple(), "not an simple position while compositing");
14184
+ assert(logger$42, pos.isSimple(), "not an simple position while compositing");
14200
14185
  if (pos.blockId === blockId) {
14201
14186
  const attributes = getAttributesAt(text2, 0);
14202
14187
  insertions.set(pos.offset, [{
@@ -14212,11 +14197,11 @@ var __publicField = (obj, key, value) => {
14212
14197
  function clearAllTempCompositionText(editor) {
14213
14198
  const children = editor.rootContainer.querySelectorAll('span[data-type="editor-insertion"].inputting-insertion');
14214
14199
  if (children.length) {
14215
- logger$43.debug(`remove ${children.length} temp composition span`);
14200
+ logger$42.debug(`remove ${children.length} temp composition span`);
14216
14201
  }
14217
14202
  Array.from(children).forEach((c) => c.remove());
14218
14203
  }
14219
- const logger$42 = getLogger("client-rects");
14204
+ const logger$41 = getLogger("client-rects");
14220
14205
  function getChildrenOffsets(block) {
14221
14206
  const children = getTextBlockContentChildren(block);
14222
14207
  let start = 0;
@@ -14234,15 +14219,15 @@ var __publicField = (obj, key, value) => {
14234
14219
  return ret;
14235
14220
  }
14236
14221
  function getChildrenInRange(editor, block, from, to) {
14237
- assert(logger$42, from < to, `invalid from & to: ${from}, ${to}`);
14222
+ assert(logger$41, from < to, `invalid from & to: ${from}, ${to}`);
14238
14223
  const blockLength = getBlockTextLength$6(editor, block);
14239
- assert(logger$42, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
14224
+ assert(logger$41, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
14240
14225
  const offsets = getChildrenOffsets(block);
14241
14226
  const startIndex = offsets.findIndex((c) => c.startBlockOffset <= from && from < c.endBlockOffset);
14242
14227
  const endIndex = offsets.findIndex((c) => c.startBlockOffset < to && to <= c.endBlockOffset);
14243
- assert(logger$42, startIndex !== -1, "failed to find start child");
14244
- assert(logger$42, endIndex !== -1, "failed to find end child");
14245
- assert(logger$42, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
14228
+ assert(logger$41, startIndex !== -1, "failed to find start child");
14229
+ assert(logger$41, endIndex !== -1, "failed to find end child");
14230
+ assert(logger$41, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
14246
14231
  if (startIndex === endIndex) {
14247
14232
  const child = offsets[startIndex];
14248
14233
  return [{
@@ -14324,16 +14309,16 @@ var __publicField = (obj, key, value) => {
14324
14309
  return rects;
14325
14310
  }
14326
14311
  function getRangeClientRects(editor, block, range) {
14327
- assert(logger$42, range instanceof EditorSimpleSelectionRange, "invalid range");
14312
+ assert(logger$41, range instanceof EditorSimpleSelectionRange, "invalid range");
14328
14313
  const start = range.start;
14329
14314
  const end = range.end;
14330
- assert(logger$42, start.isSimple(), "text block only allow simple position");
14331
- assert(logger$42, end.isSimple(), "text block only allow simple position");
14332
- assert(logger$42, start.blockId === end.blockId, "only allow update one text block selection");
14333
- assert(logger$42, start.blockId === getBlockId(block), "only allow update one text block selection");
14315
+ assert(logger$41, start.isSimple(), "text block only allow simple position");
14316
+ assert(logger$41, end.isSimple(), "text block only allow simple position");
14317
+ assert(logger$41, start.blockId === end.blockId, "only allow update one text block selection");
14318
+ assert(logger$41, start.blockId === getBlockId(block), "only allow update one text block selection");
14334
14319
  return getClientRects$2(editor, block, start, end);
14335
14320
  }
14336
- const logger$41 = getLogger("selection-background");
14321
+ const logger$40 = getLogger("selection-background");
14337
14322
  function getLineHeight(elem) {
14338
14323
  const style2 = window.getComputedStyle(elem);
14339
14324
  const lineHeightStyle = style2.getPropertyValue("line-height");
@@ -14353,9 +14338,9 @@ var __publicField = (obj, key, value) => {
14353
14338
  return lineHeight;
14354
14339
  }
14355
14340
  function updateSelection$4(editor, block, start, end) {
14356
- assert(logger$41, start.isSimple(), "text block only allow simple position");
14357
- assert(logger$41, end.isSimple(), "text block only allow simple position");
14358
- assert(logger$41, start.blockId === end.blockId, "only allow update one text block selection");
14341
+ assert(logger$40, start.isSimple(), "text block only allow simple position");
14342
+ assert(logger$40, end.isSimple(), "text block only allow simple position");
14343
+ assert(logger$40, start.blockId === end.blockId, "only allow update one text block selection");
14359
14344
  const from = start.offset;
14360
14345
  const to = end.offset;
14361
14346
  if (from === to) {
@@ -14414,7 +14399,7 @@ var __publicField = (obj, key, value) => {
14414
14399
  }
14415
14400
  });
14416
14401
  }
14417
- const logger$40 = getLogger("line-breaker");
14402
+ const logger$3$ = getLogger("line-breaker");
14418
14403
  function mergeTextRects(rects) {
14419
14404
  const result = [];
14420
14405
  let lastRect = null;
@@ -14541,7 +14526,7 @@ var __publicField = (obj, key, value) => {
14541
14526
  }
14542
14527
  const textChild = child;
14543
14528
  const rects = mergeTextRects(textChild.getClientRects());
14544
- assert(logger$40, rects.length > 0, "invalid text child dom");
14529
+ assert(logger$3$, rects.length > 0, "invalid text child dom");
14545
14530
  if (rects.length === 1) {
14546
14531
  const nextChild = children[i + 1];
14547
14532
  if (!nextChild) {
@@ -14566,10 +14551,10 @@ var __publicField = (obj, key, value) => {
14566
14551
  continue;
14567
14552
  }
14568
14553
  const textNode = textChild.firstChild;
14569
- assert(logger$40, textNode, "invalid text child, no text node");
14570
- assert(logger$40, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
14554
+ assert(logger$3$, textNode, "invalid text child, no text node");
14555
+ assert(logger$3$, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
14571
14556
  const textChildLength = getTextBlockContentChildTextLength(textChild);
14572
- assert(logger$40, textNode.data.length === textChildLength, "text node data length not equal child text length");
14557
+ assert(logger$3$, textNode.data.length === textChildLength, "text node data length not equal child text length");
14573
14558
  const textRects = getTextRects(textNode);
14574
14559
  for (let rIndex = 0; rIndex < textRects.length - 1; rIndex++) {
14575
14560
  const rect = textRects[rIndex];
@@ -14611,7 +14596,7 @@ var __publicField = (obj, key, value) => {
14611
14596
  }
14612
14597
  }
14613
14598
  }
14614
- assert(logger$40, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
14599
+ assert(logger$3$, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
14615
14600
  return {
14616
14601
  lineIndex: lineBreaks.length,
14617
14602
  lineBreaks
@@ -23384,7 +23369,7 @@ var __publicField = (obj, key, value) => {
23384
23369
  const Graphemer_1 = __importDefault(Graphemer$1);
23385
23370
  var _default = lib$1.default = Graphemer_1.default;
23386
23371
  const splitter = new _default();
23387
- const logger$3$ = getLogger("text-offset");
23372
+ const logger$3_ = getLogger("text-offset");
23388
23373
  function getChildOffset(block, child) {
23389
23374
  const children = getTextBlockContentChildren(block);
23390
23375
  let start = 0;
@@ -23400,26 +23385,26 @@ var __publicField = (obj, key, value) => {
23400
23385
  }
23401
23386
  start += testLength;
23402
23387
  }
23403
- assert(logger$3$, false, "can not find child in children");
23388
+ assert(logger$3_, false, "can not find child in children");
23404
23389
  }
23405
23390
  function isValidOffset(block, blockOffset) {
23406
- assert(logger$3$, blockOffset >= 0, `invalid offset: ${blockOffset}`);
23391
+ assert(logger$3_, blockOffset >= 0, `invalid offset: ${blockOffset}`);
23407
23392
  const childInfo = getTextBlockChild(block, blockOffset);
23408
23393
  const { prev, next: next2, offset } = childInfo;
23409
23394
  if (!prev && !next2) {
23410
- assert(logger$3$, false, "invalid offset, no prev & next child at offset");
23395
+ assert(logger$3_, false, "invalid offset, no prev & next child at offset");
23411
23396
  }
23412
23397
  if (prev !== next2) {
23413
23398
  return true;
23414
23399
  }
23415
23400
  const child = prev;
23416
- assert(logger$3$, child, "no child");
23401
+ assert(logger$3_, child, "no child");
23417
23402
  if (isTextBlockContentBoxChild(child)) {
23418
- assert(logger$3$, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
23403
+ assert(logger$3_, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
23419
23404
  return true;
23420
23405
  }
23421
23406
  const text2 = child.textContent;
23422
- assert(logger$3$, text2, "no content for text child");
23407
+ assert(logger$3_, text2, "no content for text child");
23423
23408
  const chars = splitter.splitGraphemes(text2);
23424
23409
  const validOffsets = /* @__PURE__ */ new Set();
23425
23410
  let start = 0;
@@ -23449,7 +23434,7 @@ var __publicField = (obj, key, value) => {
23449
23434
  }
23450
23435
  function getNextValidOffset(block, blockOffset) {
23451
23436
  const length = getTextBlockLength(block);
23452
- assert(logger$3$, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
23437
+ assert(logger$3_, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
23453
23438
  if (blockOffset === length) {
23454
23439
  return length;
23455
23440
  }
@@ -23463,7 +23448,7 @@ var __publicField = (obj, key, value) => {
23463
23448
  }
23464
23449
  return ret;
23465
23450
  }
23466
- const logger$3_ = getLogger("line-offset");
23451
+ const logger$3Z = getLogger("line-offset");
23467
23452
  function getLineOffsets(block) {
23468
23453
  const lineBreaks = getLineBreaks(block);
23469
23454
  const ret = [];
@@ -23484,7 +23469,7 @@ var __publicField = (obj, key, value) => {
23484
23469
  }
23485
23470
  function getLineOffset(block, lineIndex) {
23486
23471
  const lines = getLineOffsets(block);
23487
- assert(logger$3_, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
23472
+ assert(logger$3Z, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
23488
23473
  return lines[lineIndex];
23489
23474
  }
23490
23475
  function getLineOffsetByPos(block, pos) {
@@ -23541,7 +23526,7 @@ var __publicField = (obj, key, value) => {
23541
23526
  function getLineCount(block) {
23542
23527
  return getLineOffsets(block).length;
23543
23528
  }
23544
- const logger$3Z = getLogger("find-text-position");
23529
+ const logger$3Y = getLogger("find-text-position");
23545
23530
  function isWrappedLine(block, lineIndex) {
23546
23531
  const { start, end } = getLineOffset(block, lineIndex);
23547
23532
  const blockId = getBlockId(block);
@@ -23552,13 +23537,13 @@ var __publicField = (obj, key, value) => {
23552
23537
  return false;
23553
23538
  }
23554
23539
  const childInfo = getTextBlockChild(block, start);
23555
- assert(logger$3Z, childInfo.next, "no next child at offset");
23556
- assert(logger$3Z, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
23540
+ assert(logger$3Y, childInfo.next, "no next child at offset");
23541
+ assert(logger$3Y, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
23557
23542
  return true;
23558
23543
  }
23559
23544
  function getWrappedLineOffsets(block, lineIndex) {
23560
23545
  const blockId = getBlockId(block);
23561
- assert(logger$3Z, isWrappedLine(block, lineIndex), "line is not wrapped");
23546
+ assert(logger$3Y, isWrappedLine(block, lineIndex), "line is not wrapped");
23562
23547
  const { start, end } = getLineOffset(block, lineIndex);
23563
23548
  const homePos = createSimpleBlockPosition(blockId, start, "home");
23564
23549
  for (let offset = start + 1; offset <= end; offset += 1) {
@@ -23573,11 +23558,11 @@ var __publicField = (obj, key, value) => {
23573
23558
  return offset - 1;
23574
23559
  }
23575
23560
  }
23576
- assert(logger$3Z, false, "failed to find wrapped offset");
23561
+ assert(logger$3Y, false, "failed to find wrapped offset");
23577
23562
  return 0;
23578
23563
  }
23579
23564
  function findTextPositionInLine(editor, block, lineIndex, sourceBlock, pos, findDirection, suggestedX) {
23580
- assert(logger$3Z, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
23565
+ assert(logger$3Y, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
23581
23566
  const { start, end } = getLineOffset(block, lineIndex);
23582
23567
  let from = start;
23583
23568
  const blockId = getBlockId(block);
@@ -23619,11 +23604,11 @@ var __publicField = (obj, key, value) => {
23619
23604
  return retPos;
23620
23605
  }
23621
23606
  function findPrevTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
23622
- assert(logger$3Z, isTextKindBlock(editor, block), "not a text block");
23607
+ assert(logger$3Y, isTextKindBlock(editor, block), "not a text block");
23623
23608
  return findTextPositionInLine(editor, block, getLineCount(block) - 1, sourceBlock, pos, "up", suggestedX);
23624
23609
  }
23625
23610
  function findNextTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
23626
- assert(logger$3Z, isTextKindBlock(editor, block), "not a text block");
23611
+ assert(logger$3Y, isTextKindBlock(editor, block), "not a text block");
23627
23612
  return findTextPositionInLine(editor, block, 0, sourceBlock, pos, "down", suggestedX);
23628
23613
  }
23629
23614
  function moveDown(editor, block, position, suggestedX) {
@@ -23731,7 +23716,7 @@ var __publicField = (obj, key, value) => {
23731
23716
  }
23732
23717
  return pos;
23733
23718
  }
23734
- const logger$3Y = getLogger("move-caret");
23719
+ const logger$3X = getLogger("move-caret");
23735
23720
  function moveTextCaret(editor, block, position, direction) {
23736
23721
  if (direction === "ArrowLeft") {
23737
23722
  const ret = moveLeft(block, position);
@@ -23761,9 +23746,9 @@ var __publicField = (obj, key, value) => {
23761
23746
  }
23762
23747
  return createSimpleBlockPosition(getBlockId(block), ret.offset, ret.type);
23763
23748
  }
23764
- assert(logger$3Y, false, `invalid navigation direction: ${direction}`);
23749
+ assert(logger$3X, false, `invalid navigation direction: ${direction}`);
23765
23750
  }
23766
- const logger$3X = getLogger("text-range");
23751
+ const logger$3W = getLogger("text-range");
23767
23752
  function getBlockRects(block) {
23768
23753
  const ret = [];
23769
23754
  const children = getTextBlockContentChildren(block);
@@ -23821,9 +23806,9 @@ var __publicField = (obj, key, value) => {
23821
23806
  return null;
23822
23807
  }
23823
23808
  const children = getTextBlockContentChildren(block);
23824
- assert(logger$3X, children.indexOf(child) !== -1, "failed to find child in children");
23809
+ assert(logger$3W, children.indexOf(child) !== -1, "failed to find child in children");
23825
23810
  const offsetInfo = getChildOffset(block, child);
23826
- assert(logger$3X, offsetInfo, "failed to get child offset");
23811
+ assert(logger$3W, offsetInfo, "failed to get child offset");
23827
23812
  const { start } = offsetInfo;
23828
23813
  let offset;
23829
23814
  let length;
@@ -23839,7 +23824,7 @@ var __publicField = (obj, key, value) => {
23839
23824
  }
23840
23825
  length = 0;
23841
23826
  } else {
23842
- assert(logger$3X, child.firstChild instanceof Text, "child is not text");
23827
+ assert(logger$3W, child.firstChild instanceof Text, "child is not text");
23843
23828
  offset = start + textNodeOffsetFromPoint(child.firstChild, x, y);
23844
23829
  length = 0;
23845
23830
  }
@@ -23863,9 +23848,9 @@ var __publicField = (obj, key, value) => {
23863
23848
  }
23864
23849
  return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
23865
23850
  }
23866
- const logger$3W = getLogger("create-text-op");
23851
+ const logger$3V = getLogger("create-text-op");
23867
23852
  function createTextOp(text2, attributes) {
23868
- assert(logger$3W, text2, "text is empty");
23853
+ assert(logger$3V, text2, "text is empty");
23869
23854
  const ret = {
23870
23855
  insert: text2
23871
23856
  };
@@ -23888,7 +23873,7 @@ var __publicField = (obj, key, value) => {
23888
23873
  }
23889
23874
  return result;
23890
23875
  }
23891
- const logger$3V = getLogger("merge-ops");
23876
+ const logger$3U = getLogger("merge-ops");
23892
23877
  function mergeOps(text2) {
23893
23878
  if (text2.length <= 1) {
23894
23879
  return text2;
@@ -23910,10 +23895,10 @@ var __publicField = (obj, key, value) => {
23910
23895
  return false;
23911
23896
  }
23912
23897
  if (op1.attributes === void 0) {
23913
- assert(logger$3V, op2.attributes === void 0, "op2.attributes is not undefined");
23898
+ assert(logger$3U, op2.attributes === void 0, "op2.attributes is not undefined");
23914
23899
  return true;
23915
23900
  }
23916
- assert(logger$3V, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
23901
+ assert(logger$3U, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
23917
23902
  return isEqual__default.default(op1.attributes, op2.attributes);
23918
23903
  };
23919
23904
  const newOps = [];
@@ -23922,8 +23907,8 @@ var __publicField = (obj, key, value) => {
23922
23907
  for (let i = 1; i < text2.length; i += 1) {
23923
23908
  const op = text2[i];
23924
23909
  if (isSameTypeOp(before, op)) {
23925
- assert(logger$3V, typeof before.insert === "string", "before.insert is not string");
23926
- assert(logger$3V, typeof op.insert === "string", "op.insert is not string");
23910
+ assert(logger$3U, typeof before.insert === "string", "before.insert is not string");
23911
+ assert(logger$3U, typeof op.insert === "string", "op.insert is not string");
23927
23912
  before.insert += op.insert;
23928
23913
  } else {
23929
23914
  newOps.push(op);
@@ -23951,15 +23936,15 @@ var __publicField = (obj, key, value) => {
23951
23936
  }
23952
23937
  return text2.slice(0, i + 1);
23953
23938
  }
23954
- const logger$3U = getLogger("delete-text");
23939
+ const logger$3T = getLogger("delete-text");
23955
23940
  function deleteText(richText2, offset, count) {
23956
23941
  const { left, right } = splitToThree(richText2, offset, count);
23957
23942
  const result = [...left, ...right];
23958
23943
  return mergeOps(result);
23959
23944
  }
23960
23945
  function createDeleteOps(offset, count) {
23961
- assert(logger$3U, offset >= 0, `invalid offset: ${offset}`);
23962
- assert(logger$3U, count >= 1, `invalid delete count: ${count}`);
23946
+ assert(logger$3T, offset >= 0, `invalid offset: ${offset}`);
23947
+ assert(logger$3T, count >= 1, `invalid delete count: ${count}`);
23963
23948
  const ops = [];
23964
23949
  if (offset !== 0) {
23965
23950
  ops.push({
@@ -23971,7 +23956,7 @@ var __publicField = (obj, key, value) => {
23971
23956
  });
23972
23957
  return ops;
23973
23958
  }
23974
- const logger$3T = getLogger("delta");
23959
+ const logger$3S = getLogger("delta");
23975
23960
  function diffRichText(oldText, newText) {
23976
23961
  const delta1D = new Delta__default.default(oldText);
23977
23962
  const delta2D = new Delta__default.default(newText);
@@ -23981,7 +23966,7 @@ var __publicField = (obj, key, value) => {
23981
23966
  return new Delta__default.default(ops).transformPosition(cursor, !isLocalOp);
23982
23967
  }
23983
23968
  function isValidDocText(text2) {
23984
- assert(logger$3T, text2, "ops is null or undefined");
23969
+ assert(logger$3S, text2, "ops is null or undefined");
23985
23970
  for (let i = 0; i < text2.length; i++) {
23986
23971
  const op = text2[i];
23987
23972
  if (op.insert === null || op.insert === void 0) {
@@ -24001,7 +23986,7 @@ var __publicField = (obj, key, value) => {
24001
23986
  }
24002
23987
  class RichText {
24003
23988
  static ensureValidText(text2) {
24004
- assert(logger$3T, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
23989
+ assert(logger$3S, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
24005
23990
  }
24006
23991
  static diff(oldText, newText) {
24007
23992
  this.ensureValidText(oldText);
@@ -24023,9 +24008,9 @@ var __publicField = (obj, key, value) => {
24023
24008
  return resultText;
24024
24009
  }
24025
24010
  }
24026
- const logger$3S = getLogger("insert-text");
24011
+ const logger$3R = getLogger("insert-text");
24027
24012
  function insertText(richText2, offset, text2, attributes) {
24028
- assert(logger$3S, text2, `invalid text to insert: ${text2}`);
24013
+ assert(logger$3R, text2, `invalid text to insert: ${text2}`);
24029
24014
  const { left, right } = splitText(richText2, offset);
24030
24015
  const insertedText = typeof text2 === "string" ? [createTextOp(text2, attributes)] : text2;
24031
24016
  const result = [...left, ...insertedText, ...right];
@@ -24038,7 +24023,7 @@ var __publicField = (obj, key, value) => {
24038
24023
  };
24039
24024
  }
24040
24025
  function createInsertOps(offset, text2, attributes) {
24041
- assert(logger$3S, offset >= 0, `invalid offset: ${offset}`);
24026
+ assert(logger$3R, offset >= 0, `invalid offset: ${offset}`);
24042
24027
  if (text2.length === 0) {
24043
24028
  return [];
24044
24029
  }
@@ -24068,7 +24053,7 @@ var __publicField = (obj, key, value) => {
24068
24053
  function cloneText(text2) {
24069
24054
  return cloneDeep__default.default(text2);
24070
24055
  }
24071
- const logger$3R = getLogger("update-op-attribute");
24056
+ const logger$3Q = getLogger("update-op-attribute");
24072
24057
  function updateOpAttributes(orgOps, key, value, newAttributes) {
24073
24058
  const ops = cloneText(orgOps);
24074
24059
  const index2 = ops.findIndex((op2) => {
@@ -24076,7 +24061,7 @@ var __publicField = (obj, key, value) => {
24076
24061
  return false;
24077
24062
  return op2.attributes[key] === value;
24078
24063
  });
24079
- assert(logger$3R, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
24064
+ assert(logger$3Q, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
24080
24065
  const op = ops[index2];
24081
24066
  op.attributes = {
24082
24067
  ...op.attributes,
@@ -24158,11 +24143,11 @@ var __publicField = (obj, key, value) => {
24158
24143
  ]);
24159
24144
  }
24160
24145
  const FILL_CHAR = "\u200B";
24161
- const logger$3Q = getLogger("to-plain-text");
24146
+ const logger$3P = getLogger("to-plain-text");
24162
24147
  function toPlainText(ops, options) {
24163
24148
  let text2 = "";
24164
24149
  ops.forEach((op) => {
24165
- assert(logger$3Q, typeof op.insert === "string", "invalid op");
24150
+ assert(logger$3P, typeof op.insert === "string", "invalid op");
24166
24151
  if (op.attributes && op.attributes.box === true) {
24167
24152
  if (options == null ? void 0 : options.boxReplacement) {
24168
24153
  text2 += options.boxReplacement;
@@ -24217,11 +24202,11 @@ var __publicField = (obj, key, value) => {
24217
24202
  focus: pos
24218
24203
  };
24219
24204
  }
24220
- const logger$3P = getLogger("block-to-text");
24205
+ const logger$3O = getLogger("block-to-text");
24221
24206
  function textBlockToText$1(editor, ops, doc2) {
24222
24207
  let text2 = "";
24223
24208
  ops.forEach((op) => {
24224
- assert(logger$3P, typeof op.insert === "string", "invalid op");
24209
+ assert(logger$3O, typeof op.insert === "string", "invalid op");
24225
24210
  if (op.attributes && op.attributes.box === true) {
24226
24211
  const box = op.attributes;
24227
24212
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24239,11 +24224,11 @@ var __publicField = (obj, key, value) => {
24239
24224
  });
24240
24225
  return text2;
24241
24226
  }
24242
- const logger$3O = getLogger("block-to-text");
24227
+ const logger$3N = getLogger("block-to-text");
24243
24228
  function textToMarkdownText(editor, ops, doc2) {
24244
24229
  let text2 = "";
24245
24230
  ops.forEach((op) => {
24246
- assert(logger$3O, typeof op.insert === "string", "invalid op");
24231
+ assert(logger$3N, typeof op.insert === "string", "invalid op");
24247
24232
  if (op.attributes && op.attributes.box === true) {
24248
24233
  const box = op.attributes;
24249
24234
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24366,11 +24351,11 @@ var __publicField = (obj, key, value) => {
24366
24351
  return void 0;
24367
24352
  }
24368
24353
  }
24369
- const logger$3N = getLogger("block-to-text");
24354
+ const logger$3M = getLogger("block-to-text");
24370
24355
  function textBlockToHtml(editor, ops, doc2) {
24371
24356
  let html = "";
24372
24357
  ops.forEach((op) => {
24373
- assert(logger$3N, typeof op.insert === "string", "invalid op");
24358
+ assert(logger$3M, typeof op.insert === "string", "invalid op");
24374
24359
  if (op.attributes && op.attributes.box === true) {
24375
24360
  const box = op.attributes;
24376
24361
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24439,16 +24424,16 @@ var __publicField = (obj, key, value) => {
24439
24424
  }
24440
24425
  return `<p>${html}</p>`;
24441
24426
  }
24442
- const logger$3M = getLogger("text-block");
24427
+ const logger$3L = getLogger("text-block");
24443
24428
  function createBlockContent$5(editor, path, container, blockElement, blockData) {
24444
24429
  const { text: text2 } = blockData;
24445
- assert(logger$3M, text2, "no text for text block");
24430
+ assert(logger$3L, text2, "no text for text block");
24446
24431
  const content = createBlockContentElement(blockElement, "div");
24447
24432
  updateBlockContent$1(editor, path, blockData.id, content, text2);
24448
24433
  return content;
24449
24434
  }
24450
24435
  function updateBlockText$1(editor, block, text2) {
24451
- assert(logger$3M, text2, "no text to update");
24436
+ assert(logger$3L, text2, "no text to update");
24452
24437
  const newContent = createBlockContentElement(null, "div");
24453
24438
  updateBlockContent$1(editor, getBlockPath(block), getBlockId(block), newContent, text2);
24454
24439
  const oldContent = getBlockContent(block);
@@ -24458,7 +24443,7 @@ var __publicField = (obj, key, value) => {
24458
24443
  return getRangeClientRects(editor, block, range);
24459
24444
  }
24460
24445
  function convertTo$k(editor, blockData, doc2, type) {
24461
- assert(logger$3M, blockData.text, "no text for text block");
24446
+ assert(logger$3L, blockData.text, "no text for text block");
24462
24447
  if (type === "text") {
24463
24448
  return textBlockToText$1(editor, blockData.text, doc2);
24464
24449
  }
@@ -24472,7 +24457,7 @@ var __publicField = (obj, key, value) => {
24472
24457
  blockData.id = genId();
24473
24458
  info == null ? void 0 : info.blockIdMap.set(srcBlockData.id, blockData.id);
24474
24459
  const { text: text2 } = blockData;
24475
- assert(logger$3M, text2, "no text for text block");
24460
+ assert(logger$3L, text2, "no text for text block");
24476
24461
  text2.forEach((op) => {
24477
24462
  if (op.insert && op.attributes && op.attributes.box === true) {
24478
24463
  const boxId = genId();
@@ -24504,7 +24489,7 @@ var __publicField = (obj, key, value) => {
24504
24489
  blockToDoc: blockToDoc$1
24505
24490
  };
24506
24491
  const updateTextBlockContent = updateBlockContent$1;
24507
- const logger$3L = getLogger("action-helper");
24492
+ const logger$3K = getLogger("action-helper");
24508
24493
  function editorGetBlockData(editor, block) {
24509
24494
  const container = getParentContainer(block);
24510
24495
  const containerId = getContainerId(container);
@@ -24512,10 +24497,10 @@ var __publicField = (obj, key, value) => {
24512
24497
  return editor.doc.getBlockData(containerId, blockIndex);
24513
24498
  }
24514
24499
  function editorGetBlockText(editor, block) {
24515
- assert(logger$3L, isTextKindBlock(editor, block), "not a text kind block");
24500
+ assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
24516
24501
  const data2 = editorGetBlockData(editor, block);
24517
24502
  const text2 = data2.text;
24518
- assert(logger$3L, text2, "no text in block");
24503
+ assert(logger$3K, text2, "no text in block");
24519
24504
  return text2;
24520
24505
  }
24521
24506
  function editorGetBlockTextEx(editor, block, length) {
@@ -24523,7 +24508,7 @@ var __publicField = (obj, key, value) => {
24523
24508
  }
24524
24509
  function editorGetBoxData(editor, box) {
24525
24510
  const block = getParentBlock(box);
24526
- assert(logger$3L, block, "no parent block");
24511
+ assert(logger$3K, block, "no parent block");
24527
24512
  const text2 = editorGetBlockText(editor, block);
24528
24513
  const id = getBoxId(box);
24529
24514
  const op = text2.find((op2) => {
@@ -24533,60 +24518,60 @@ var __publicField = (obj, key, value) => {
24533
24518
  }
24534
24519
  return false;
24535
24520
  });
24536
- assert(logger$3L, op, "failed to find box");
24521
+ assert(logger$3K, op, "failed to find box");
24537
24522
  return op.attributes;
24538
24523
  }
24539
- const logger$3K = getLogger("block-text");
24524
+ const logger$3J = getLogger("block-text");
24540
24525
  function getTextAfterOffset(editor, block, offset) {
24541
- assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
24542
- assert(logger$3K, isValidOffset(block, offset), "not a valid offset");
24543
- assert(logger$3K, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24526
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24527
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24528
+ assert(logger$3J, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24544
24529
  const newOffset = getNextValidOffset(block, offset);
24545
24530
  const length = newOffset - offset;
24546
24531
  if (length === 0) {
24547
- assert(logger$3K, false, `no text after offset: ${offset}`);
24532
+ assert(logger$3J, false, `no text after offset: ${offset}`);
24548
24533
  }
24549
24534
  const text2 = editorGetBlockText(editor, block);
24550
24535
  const { middle } = splitToThree(text2, offset, length);
24551
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24536
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24552
24537
  const op = middle[0];
24553
24538
  if (isBoxOp(op)) {
24554
24539
  return " ";
24555
24540
  }
24556
- assert(logger$3K, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24541
+ assert(logger$3J, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24557
24542
  return op.insert;
24558
24543
  }
24559
24544
  function getTextBeforeOffset(editor, block, offset) {
24560
- assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
24561
- assert(logger$3K, isValidOffset(block, offset), "not a valid offset");
24562
- assert(logger$3K, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24545
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24546
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24547
+ assert(logger$3J, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24563
24548
  const newOffset = getPrevValidOffset(block, offset);
24564
24549
  const length = offset - newOffset;
24565
24550
  if (length === 0) {
24566
- assert(logger$3K, false, `no text before offset: ${offset}`);
24551
+ assert(logger$3J, false, `no text before offset: ${offset}`);
24567
24552
  }
24568
24553
  const text2 = editorGetBlockText(editor, block);
24569
24554
  const { middle } = splitToThree(text2, newOffset, length);
24570
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24555
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24571
24556
  const op = middle[0];
24572
24557
  if (isBoxOp(op)) {
24573
24558
  return " ";
24574
24559
  }
24575
- assert(logger$3K, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24560
+ assert(logger$3J, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24576
24561
  return op.insert;
24577
24562
  }
24578
24563
  function getOffsetInfoBefore(editor, block, offset) {
24579
- assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
24580
- assert(logger$3K, isValidOffset(block, offset), "not a valid offset");
24581
- assert(logger$3K, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24564
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24565
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24566
+ assert(logger$3J, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24582
24567
  const newOffset = getPrevValidOffset(block, offset);
24583
24568
  const length = offset - newOffset;
24584
24569
  if (length === 0) {
24585
- assert(logger$3K, false, `no text before offset: ${offset}`);
24570
+ assert(logger$3J, false, `no text before offset: ${offset}`);
24586
24571
  }
24587
24572
  const text2 = editorGetBlockText(editor, block);
24588
24573
  const { middle } = splitToThree(text2, newOffset, length);
24589
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24574
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24590
24575
  const op = middle[0];
24591
24576
  if (isBoxOp(op)) {
24592
24577
  return {
@@ -24604,17 +24589,17 @@ var __publicField = (obj, key, value) => {
24604
24589
  };
24605
24590
  }
24606
24591
  function getOffsetInfoAfter(editor, block, offset) {
24607
- assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
24608
- assert(logger$3K, isValidOffset(block, offset), "not a valid offset");
24609
- assert(logger$3K, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24592
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24593
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24594
+ assert(logger$3J, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24610
24595
  const newOffset = getNextValidOffset(block, offset);
24611
24596
  const length = newOffset - offset;
24612
24597
  if (length === 0) {
24613
- assert(logger$3K, false, `no text after offset: ${offset}`);
24598
+ assert(logger$3J, false, `no text after offset: ${offset}`);
24614
24599
  }
24615
24600
  const text2 = editorGetBlockText(editor, block);
24616
24601
  const { middle } = splitToThree(text2, offset, length);
24617
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24602
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24618
24603
  const op = middle[0];
24619
24604
  if (isBoxOp(op)) {
24620
24605
  return {
@@ -24678,7 +24663,7 @@ var __publicField = (obj, key, value) => {
24678
24663
  return null;
24679
24664
  }
24680
24665
  function findWordLeft(editor, block, offset) {
24681
- assert(logger$3K, isTextKindBlock(editor, block), "invalid blok type");
24666
+ assert(logger$3J, isTextKindBlock(editor, block), "invalid blok type");
24682
24667
  if (isEmptyTextBlock(editor, block)) {
24683
24668
  return 0;
24684
24669
  }
@@ -24706,7 +24691,7 @@ var __publicField = (obj, key, value) => {
24706
24691
  return startInfo.offset + startInfo.length;
24707
24692
  }
24708
24693
  function findWordEnd(editor, block, offset) {
24709
- assert(logger$3K, isTextKindBlock(editor, block), "invalid blok type");
24694
+ assert(logger$3J, isTextKindBlock(editor, block), "invalid blok type");
24710
24695
  if (isEmptyTextBlock(editor, block)) {
24711
24696
  return 0;
24712
24697
  }
@@ -24733,10 +24718,10 @@ var __publicField = (obj, key, value) => {
24733
24718
  return getBlockTextLength$6(editor, block);
24734
24719
  return startInfo.offset;
24735
24720
  }
24736
- const logger$3J = getLogger("text-box");
24721
+ const logger$3I = getLogger("text-box");
24737
24722
  function updateBoxContent$8(editor, boxElement, boxContent, boxData) {
24738
- assert(logger$3J, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
24739
- assert(logger$3J, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
24723
+ assert(logger$3I, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
24724
+ assert(logger$3I, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
24740
24725
  createElement("span", [], boxContent, boxData.text);
24741
24726
  }
24742
24727
  function convertTo$j(editor, boxData, doc2, type) {
@@ -24770,7 +24755,7 @@ var __publicField = (obj, key, value) => {
24770
24755
  updateBoxContent: updateBoxContent$7,
24771
24756
  convertTo: convertTo$i
24772
24757
  };
24773
- const logger$3I = getLogger("editor-boxes");
24758
+ const logger$3H = getLogger("editor-boxes");
24774
24759
  class EditorBoxes {
24775
24760
  constructor(editor) {
24776
24761
  __publicField(this, "boxes", /* @__PURE__ */ new Map());
@@ -24779,12 +24764,12 @@ var __publicField = (obj, key, value) => {
24779
24764
  registerBoxClass(boxClass) {
24780
24765
  const type = boxClass.boxType;
24781
24766
  const exists = this.boxes.get(type);
24782
- assert(logger$3I, !exists, `duplicated box type: ${type}`);
24767
+ assert(logger$3H, !exists, `duplicated box type: ${type}`);
24783
24768
  this.boxes.set(type, boxClass);
24784
24769
  }
24785
24770
  getBoxClass(type) {
24786
24771
  const exists = this.boxes.get(type);
24787
- assert(logger$3I, exists, `unknown box type: ${type}`);
24772
+ assert(logger$3H, exists, `unknown box type: ${type}`);
24788
24773
  return exists;
24789
24774
  }
24790
24775
  createBox(blockContent, box) {
@@ -25146,7 +25131,7 @@ var __publicField = (obj, key, value) => {
25146
25131
  return { classes, attributes: newAttributes, styles: newStyles };
25147
25132
  }
25148
25133
  }
25149
- const logger$3H = getLogger("editor-insertion");
25134
+ const logger$3G = getLogger("editor-insertion");
25150
25135
  class EditorInsertions {
25151
25136
  constructor(editor) {
25152
25137
  __publicField(this, "insertions", /* @__PURE__ */ new Map());
@@ -25155,12 +25140,12 @@ var __publicField = (obj, key, value) => {
25155
25140
  registerInsertionClass(insertionClass) {
25156
25141
  const type = insertionClass.insertionType;
25157
25142
  const exists = this.insertions.get(type);
25158
- assert(logger$3H, !exists, `duplicated insertion type: ${type}`);
25143
+ assert(logger$3G, !exists, `duplicated insertion type: ${type}`);
25159
25144
  this.insertions.set(type, insertionClass);
25160
25145
  }
25161
25146
  getInsertionClass(type) {
25162
25147
  const exists = this.insertions.get(type);
25163
- assert(logger$3H, exists, `unknown insertion type: ${type}`);
25148
+ assert(logger$3G, exists, `unknown insertion type: ${type}`);
25164
25149
  return exists;
25165
25150
  }
25166
25151
  createInsertionElement(type, id, attributes) {
@@ -25280,7 +25265,7 @@ var __publicField = (obj, key, value) => {
25280
25265
  };
25281
25266
  }
25282
25267
  }
25283
- const logger$3G = getLogger("editor-input");
25268
+ const logger$3F = getLogger("editor-input");
25284
25269
  class EditorInput$1 {
25285
25270
  constructor(editor, callbacks) {
25286
25271
  __publicField(this, "editor");
@@ -25402,7 +25387,7 @@ var __publicField = (obj, key, value) => {
25402
25387
  return;
25403
25388
  }
25404
25389
  this.callbacks.onCut(event);
25405
- logger$3G.debug("on cut");
25390
+ logger$3F.debug("on cut");
25406
25391
  });
25407
25392
  __publicField(this, "handlePaste", (event) => {
25408
25393
  if (event.isTrusted) {
@@ -25517,11 +25502,11 @@ var __publicField = (obj, key, value) => {
25517
25502
  this.callbacks.removeHandler(handler);
25518
25503
  }
25519
25504
  defaultInsertText(editor, containerId, blockIndex, offset, text2) {
25520
- assert(logger$3G, editor === this.editor, "invalid editor");
25505
+ assert(logger$3F, editor === this.editor, "invalid editor");
25521
25506
  this.callbacks.defaultInsertText(editor, containerId, blockIndex, offset, text2);
25522
25507
  }
25523
25508
  defaultHandleKeydown(editor, event) {
25524
- assert(logger$3G, editor === this.editor, "invalid editor");
25509
+ assert(logger$3F, editor === this.editor, "invalid editor");
25525
25510
  return this.callbacks.defaultHandleKeydown(editor, event);
25526
25511
  }
25527
25512
  forEach(callback) {
@@ -25546,7 +25531,7 @@ var __publicField = (obj, key, value) => {
25546
25531
  input2.style.left = `${x / scale}px`;
25547
25532
  input2.style.top = `${y / scale}px`;
25548
25533
  }
25549
- const logger$3F = getLogger("editor-caret");
25534
+ const logger$3E = getLogger("editor-caret");
25550
25535
  function getFirefoxVersion() {
25551
25536
  const userAgent = window.navigator.userAgent;
25552
25537
  const match = userAgent.match(/Firefox\/(\d+)\./);
@@ -25609,11 +25594,11 @@ var __publicField = (obj, key, value) => {
25609
25594
  return;
25610
25595
  }
25611
25596
  const { range } = this.editor.selection;
25612
- assert(logger$3F, range.isCollapsed, "range is not collapsed");
25597
+ assert(logger$3E, range.isCollapsed, "range is not collapsed");
25613
25598
  const pos = range.start;
25614
- assert(logger$3F, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
25599
+ assert(logger$3E, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
25615
25600
  const block = this.editor.getBlockById(pos.blockId);
25616
- assert(logger$3F, isTextKindBlock(this.editor, block), "only text kind block can has caret");
25601
+ assert(logger$3E, isTextKindBlock(this.editor, block), "only text kind block can has caret");
25617
25602
  let rect;
25618
25603
  const compositionSpan = block.querySelector("span.inputting-insertion");
25619
25604
  if (compositionSpan) {
@@ -25651,7 +25636,7 @@ var __publicField = (obj, key, value) => {
25651
25636
  clearAllSelection(editor);
25652
25637
  editor.selection.range.getSelectedBlocks().forEach((s) => updateBlockSelection(editor, s.block, s.start, s.end));
25653
25638
  }
25654
- const logger$3E = getLogger("editor-dom");
25639
+ const logger$3D = getLogger("editor-dom");
25655
25640
  function editorGetClientHeight(editor) {
25656
25641
  const scrollContainer = getScrollContainer$1(editor.rootContainer);
25657
25642
  return scrollContainer.clientHeight;
@@ -25739,7 +25724,7 @@ var __publicField = (obj, key, value) => {
25739
25724
  }
25740
25725
  function editorScrollIntoView(editor) {
25741
25726
  if (!isElementVisible(editor.rootContainer)) {
25742
- logger$3E.warn("editorScrollIntoView: editor is not visible");
25727
+ logger$3D.warn("editorScrollIntoView: editor is not visible");
25743
25728
  return;
25744
25729
  }
25745
25730
  const rootClientRect = editor.rootContainer.getBoundingClientRect();
@@ -25804,7 +25789,7 @@ var __publicField = (obj, key, value) => {
25804
25789
  const { start, end } = range;
25805
25790
  return start.blockId === getBlockId(firstChildBlock) && start.offset === 0 && end.blockId === getBlockId(lastChildBlock) && end.offset === getBlockTextLength$6(editor, lastChildBlock);
25806
25791
  }
25807
- const logger$3D = getLogger("range-in-block");
25792
+ const logger$3C = getLogger("range-in-block");
25808
25793
  function rangeInBlock(block, range) {
25809
25794
  const editor = range.getEditor();
25810
25795
  const start = editor.getBlockById(range.start.blockId);
@@ -25825,16 +25810,16 @@ var __publicField = (obj, key, value) => {
25825
25810
  while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
25826
25811
  prevBlock = getPrevVisibleBlock(prevBlock);
25827
25812
  }
25828
- assert(logger$3D, prevBlock, "no prev block while deleting a block");
25813
+ assert(logger$3C, prevBlock, "no prev block while deleting a block");
25829
25814
  newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
25830
25815
  } else {
25831
25816
  const nextBlock = getNextVisibleBlock(block);
25832
- assert(logger$3D, nextBlock, "no prev and next block while deleting a block");
25817
+ assert(logger$3C, nextBlock, "no prev and next block while deleting a block");
25833
25818
  newRange = createBlockSimpleRange(editor, nextBlock, 0);
25834
25819
  }
25835
25820
  return newRange;
25836
25821
  }
25837
- const logger$3C = getLogger("block-to-html");
25822
+ const logger$3B = getLogger("block-to-html");
25838
25823
  function blockToHtml(editor, blockData, doc2, path) {
25839
25824
  const blockClass = getBlockClassByType(editor, blockData.type);
25840
25825
  if (blockClass.convertTo) {
@@ -25843,15 +25828,15 @@ var __publicField = (obj, key, value) => {
25843
25828
  if (blockClass.blockKind !== "text") {
25844
25829
  return `[${blockData.type}]`;
25845
25830
  }
25846
- assert(logger$3C, blockData.text, "no text");
25831
+ assert(logger$3B, blockData.text, "no text");
25847
25832
  const plainText = toPlainText(blockData.text);
25848
25833
  return `<div>${escapeHtmlText(plainText)}</div>`;
25849
25834
  }
25850
- const logger$3B = getLogger("block-to-text");
25835
+ const logger$3A = getLogger("block-to-text");
25851
25836
  function textBlockToText(editor, ops, doc2) {
25852
25837
  let text2 = "";
25853
25838
  ops.forEach((op) => {
25854
- assert(logger$3B, typeof op.insert === "string", "invalid op");
25839
+ assert(logger$3A, typeof op.insert === "string", "invalid op");
25855
25840
  if (op.attributes && op.attributes.box === true) {
25856
25841
  const box = op.attributes;
25857
25842
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -25877,7 +25862,7 @@ var __publicField = (obj, key, value) => {
25877
25862
  if (blockClass.blockKind !== "text") {
25878
25863
  return `[${blockData.type}]`;
25879
25864
  }
25880
- assert(logger$3B, blockData.text, "no text");
25865
+ assert(logger$3A, blockData.text, "no text");
25881
25866
  const plainText = textBlockToText(editor, blockData.text, doc2);
25882
25867
  return plainText;
25883
25868
  }
@@ -25910,11 +25895,11 @@ var __publicField = (obj, key, value) => {
25910
25895
  const markdown = lines.join("\n");
25911
25896
  return markdown;
25912
25897
  }
25913
- const logger$3A = getLogger("get-text-position");
25898
+ const logger$3z = getLogger("get-text-position");
25914
25899
  function editorGetTextPosition(editor, insertPos) {
25915
25900
  const pos = insertPos != null ? insertPos : editor.selection.range.start;
25916
25901
  if (!(pos instanceof EditorSimpleBlockPosition)) {
25917
- assert(logger$3A, false, `invalid insert pos type: ${typeof pos}`);
25902
+ assert(logger$3z, false, `invalid insert pos type: ${typeof pos}`);
25918
25903
  }
25919
25904
  const { blockId } = pos;
25920
25905
  const block = editor.getBlockById(blockId);
@@ -26002,14 +25987,14 @@ var __publicField = (obj, key, value) => {
26002
25987
  return attributes;
26003
25988
  }
26004
25989
  }
26005
- const logger$3z = getLogger("insert-text");
25990
+ const logger$3y = getLogger("insert-text");
26006
25991
  function getTextAttributes(editor, containerId, blockIndex, offset) {
26007
25992
  var _a, _b;
26008
25993
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26009
- assert(logger$3z, blockData, "no block data");
26010
- assert(logger$3z, blockData.text, "no block text");
25994
+ assert(logger$3y, blockData, "no block data");
25995
+ assert(logger$3y, blockData.text, "no block text");
26011
25996
  if (getTextLength(blockData.text) === 0) {
26012
- assert(logger$3z, offset === 0, "invalid text offset");
25997
+ assert(logger$3y, offset === 0, "invalid text offset");
26013
25998
  return BlockAttributesHandler.get(editor).getEmptyBlockTextAttributes(blockData.id);
26014
25999
  }
26015
26000
  if (offset === 0) {
@@ -26056,7 +26041,7 @@ var __publicField = (obj, key, value) => {
26056
26041
  }
26057
26042
  for (let i = 0; i < text2.length; i++) {
26058
26043
  const op = text2[i];
26059
- assert(logger$3z, typeof op.insert === "string", "invalid text op, no insert");
26044
+ assert(logger$3y, typeof op.insert === "string", "invalid text op, no insert");
26060
26045
  const endPos = pos + getOpLength(op);
26061
26046
  if (endPos === start) {
26062
26047
  return false;
@@ -26070,8 +26055,8 @@ var __publicField = (obj, key, value) => {
26070
26055
  }
26071
26056
  function editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset) {
26072
26057
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26073
- assert(logger$3z, blockData, "no block data");
26074
- assert(logger$3z, blockData.text, "no block text");
26058
+ assert(logger$3y, blockData, "no block data");
26059
+ assert(logger$3y, blockData.text, "no block text");
26075
26060
  const attributes = getTextAttributes(editor, containerId, blockIndex, offset);
26076
26061
  if (attributes && Object.keys(attributes).includes("link")) {
26077
26062
  const inOp = checkRangeInOp(blockData.text, offset);
@@ -26090,21 +26075,21 @@ var __publicField = (obj, key, value) => {
26090
26075
  const { containerId, blockIndex, offset } = editorGetTextPosition(editor);
26091
26076
  editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset);
26092
26077
  }
26093
- const logger$3y = getLogger("update-composition-text");
26078
+ const logger$3x = getLogger("update-composition-text");
26094
26079
  function editorUpdateCompositionText(editor) {
26095
26080
  const pos = editor.selection.range.start;
26096
26081
  if (!(pos instanceof EditorSimpleBlockPosition)) {
26097
- assert(logger$3y, false, `invalid insert pos type: ${typeof pos}`);
26082
+ assert(logger$3x, false, `invalid insert pos type: ${typeof pos}`);
26098
26083
  }
26099
26084
  const { blockId } = pos;
26100
26085
  const block = editor.getBlockById(blockId);
26101
- assert(logger$3y, isTextKindBlock(editor, block), "not a text kind block");
26086
+ assert(logger$3x, isTextKindBlock(editor, block), "not a text kind block");
26102
26087
  const container = getParentContainer(block);
26103
26088
  const containerId = getContainerId(container);
26104
26089
  const blockIndex = getBlockIndex(block);
26105
26090
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26106
- assert(logger$3y, blockData, "no block data in doc");
26107
- assert(logger$3y, blockData.text, "no text data in text block");
26091
+ assert(logger$3x, blockData, "no block data in doc");
26092
+ assert(logger$3x, blockData.text, "no text data in text block");
26108
26093
  const blockContent = getBlockContent(block);
26109
26094
  updateBlockContent$1(editor, getBlockPath(block), blockId, blockContent, blockData.text);
26110
26095
  }
@@ -26116,25 +26101,25 @@ var __publicField = (obj, key, value) => {
26116
26101
  const block = editor.getBlockById(blockData.id);
26117
26102
  return block;
26118
26103
  }
26119
- const logger$3x = getLogger("delete-block-text");
26104
+ const logger$3w = getLogger("delete-block-text");
26120
26105
  function editorDeleteBlockText(editor, block, offset, count, options) {
26121
26106
  if (!editor.isBlockWritable(block)) {
26122
- logger$3x.error("block is not writable");
26107
+ logger$3w.error("block is not writable");
26123
26108
  return 0;
26124
26109
  }
26125
- assert(logger$3x, isTextKindBlock(editor, block), "block is not a text kind block");
26110
+ assert(logger$3w, isTextKindBlock(editor, block), "block is not a text kind block");
26126
26111
  const container = getParentContainer(block);
26127
26112
  const containerId = getContainerId(container);
26128
26113
  const blockIndex = getBlockIndex(block);
26129
26114
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26130
- assert(logger$3x, blockData, "no block data in doc");
26131
- assert(logger$3x, blockData.text, "no text data in text block");
26115
+ assert(logger$3w, blockData, "no block data in doc");
26116
+ assert(logger$3w, blockData.text, "no text data in text block");
26132
26117
  let from = offset;
26133
26118
  if (!isValidOffset(block, offset)) {
26134
26119
  from = getPrevValidOffset(block, from);
26135
26120
  }
26136
26121
  let to = offset + count;
26137
- assert(logger$3x, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
26122
+ assert(logger$3w, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
26138
26123
  if (!isValidOffset(block, to)) {
26139
26124
  to = getNextValidOffset(block, to);
26140
26125
  }
@@ -26143,7 +26128,7 @@ var __publicField = (obj, key, value) => {
26143
26128
  editor.doc.localUpdateBlockText(containerId, blockIndex, actions2, options);
26144
26129
  return deleteCount;
26145
26130
  }
26146
- const logger$3w = getLogger("break-text-block");
26131
+ const logger$3v = getLogger("break-text-block");
26147
26132
  function copyBlockAttributes(editor, block) {
26148
26133
  const blockData = editor.getBlockData(block);
26149
26134
  const quoted = blockData.quoted;
@@ -26155,8 +26140,8 @@ var __publicField = (obj, key, value) => {
26155
26140
  return {};
26156
26141
  }
26157
26142
  function editorBreakTextBlock(editor, block, offset, options) {
26158
- assert(logger$3w, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
26159
- assert(logger$3w, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
26143
+ assert(logger$3v, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
26144
+ assert(logger$3v, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
26160
26145
  const container = getParentContainer(block);
26161
26146
  const containerId = getContainerId(container);
26162
26147
  const blockIndex = getBlockIndex(block);
@@ -26186,7 +26171,7 @@ var __publicField = (obj, key, value) => {
26186
26171
  };
26187
26172
  }
26188
26173
  }
26189
- assert(logger$3w, isValidOffset(block, offset), "not a valid offset");
26174
+ assert(logger$3v, isValidOffset(block, offset), "not a valid offset");
26190
26175
  const text2 = editorGetBlockText(editor, block);
26191
26176
  const { right } = splitText(text2, offset);
26192
26177
  const rightLength = getTextLength(right);
@@ -26212,12 +26197,12 @@ var __publicField = (obj, key, value) => {
26212
26197
  newBlock
26213
26198
  };
26214
26199
  }
26215
- const logger$3v = getLogger("prepare-insert-new-block");
26200
+ const logger$3u = getLogger("prepare-insert-new-block");
26216
26201
  function editorPrepareInsertNewBlock(editor, containerId, blockIndex) {
26217
26202
  if (containerId && blockIndex !== void 0 && blockIndex !== null) {
26218
26203
  const container = editor.getContainerById(containerId);
26219
26204
  const blocks = getChildBlocks(container);
26220
- assert(logger$3v, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
26205
+ assert(logger$3u, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
26221
26206
  return {
26222
26207
  containerId,
26223
26208
  blockIndex
@@ -26251,15 +26236,15 @@ var __publicField = (obj, key, value) => {
26251
26236
  blockIndex: getBlockIndex(newBlock)
26252
26237
  };
26253
26238
  }
26254
- const logger$3u = getLogger("auto-insert-block");
26239
+ const logger$3t = getLogger("auto-insert-block");
26255
26240
  function editorAutoInsertBlock(editor, blockData, containerId, blockIndex, newRange, insertBlockOptions) {
26256
26241
  const result = editorPrepareInsertNewBlock(editor, containerId, blockIndex);
26257
- assert(logger$3u, result, `not an valid insert position: ${editor.selection.range}`);
26242
+ assert(logger$3t, result, `not an valid insert position: ${editor.selection.range}`);
26258
26243
  const defaultPos = { blockId: blockData.id, offset: 0 };
26259
26244
  const defaultRange = { anchor: defaultPos, focus: defaultPos };
26260
26245
  return editorInsertBlock(editor, result.containerId, result.blockIndex, blockData, newRange != null ? newRange : defaultRange, insertBlockOptions);
26261
26246
  }
26262
- const logger$3t = getLogger("delete-block");
26247
+ const logger$3s = getLogger("delete-block");
26263
26248
  function getAllChildContainers(editor, blockData, containerIds) {
26264
26249
  if (blockData.children) {
26265
26250
  containerIds.push(...blockData.children);
@@ -26276,7 +26261,7 @@ var __publicField = (obj, key, value) => {
26276
26261
  const containerId = getContainerId(container);
26277
26262
  const blockIndex = getBlockIndex(block);
26278
26263
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26279
- assert(logger$3t, blockData, "no block data in doc");
26264
+ assert(logger$3s, blockData, "no block data in doc");
26280
26265
  editor.doc.localDeleteBlock(containerId, blockIndex, createEditorSelectionRange(editor, { anchor: newRange.start, focus: newRange.end }));
26281
26266
  return blockData;
26282
26267
  }
@@ -26322,15 +26307,15 @@ var __publicField = (obj, key, value) => {
26322
26307
  });
26323
26308
  editor.doc.localDeleteChildContainers(containerIds);
26324
26309
  }
26325
- const logger$3s = getLogger("merge-text-block");
26310
+ const logger$3r = getLogger("merge-text-block");
26326
26311
  function editorMergeTextBlock(editor, block1, block2) {
26327
- assert(logger$3s, isTextKindBlock(editor, block1), "only text block can be merged");
26328
- assert(logger$3s, isTextKindBlock(editor, block2), "only text block can be merged");
26312
+ assert(logger$3r, isTextKindBlock(editor, block1), "only text block can be merged");
26313
+ assert(logger$3r, isTextKindBlock(editor, block2), "only text block can be merged");
26329
26314
  const data1 = editorGetBlockData(editor, block1);
26330
26315
  const data2 = editorGetBlockData(editor, block2);
26331
26316
  const text1 = data1.text;
26332
26317
  const text2 = data2.text;
26333
- assert(logger$3s, text1 && text2, "block data has no text");
26318
+ assert(logger$3r, text1 && text2, "block data has no text");
26334
26319
  const container = getParentContainer(block1);
26335
26320
  const containerId = getContainerId(container);
26336
26321
  const blockIndex = getBlockIndex(block1);
@@ -26340,15 +26325,15 @@ var __publicField = (obj, key, value) => {
26340
26325
  editorDeleteBlock(editor, block2, newRange);
26341
26326
  return block;
26342
26327
  }
26343
- const logger$3r = getLogger("clear-selected-contents");
26328
+ const logger$3q = getLogger("clear-selected-contents");
26344
26329
  function deleteTextBlockSelection(editor, selectedBlock) {
26345
- assert(logger$3r, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
26330
+ assert(logger$3q, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
26346
26331
  const { start, end } = selectedBlock;
26347
- assert(logger$3r, start.isSimple(), "not a simple block position");
26348
- assert(logger$3r, end.isSimple(), "not a simple block position");
26332
+ assert(logger$3q, start.isSimple(), "not a simple block position");
26333
+ assert(logger$3q, end.isSimple(), "not a simple block position");
26349
26334
  const startOffset = start.offset;
26350
26335
  const endOffset = end.offset;
26351
- assert(logger$3r, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
26336
+ assert(logger$3q, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
26352
26337
  if (startOffset === endOffset) {
26353
26338
  return;
26354
26339
  }
@@ -26373,7 +26358,7 @@ var __publicField = (obj, key, value) => {
26373
26358
  return;
26374
26359
  }
26375
26360
  if (isEmbedBlock(block) || start.isSimple()) {
26376
- assert(logger$3r, end.isSimple(), "invalid range");
26361
+ assert(logger$3q, end.isSimple(), "invalid range");
26377
26362
  const container = getParentContainer(block);
26378
26363
  const blockIndex = getBlockIndex(block);
26379
26364
  const newBlock = editor.insertTextBlock("", getContainerId(container), blockIndex);
@@ -26381,8 +26366,8 @@ var __publicField = (obj, key, value) => {
26381
26366
  editor.deleteBlock(block);
26382
26367
  return;
26383
26368
  }
26384
- assert(logger$3r, isComplexKindBlock(editor, block), "invalid block kind");
26385
- assert(logger$3r, !start.isSimple() && !end.isSimple(), "invalid range");
26369
+ assert(logger$3q, isComplexKindBlock(editor, block), "invalid block kind");
26370
+ assert(logger$3q, !start.isSimple() && !end.isSimple(), "invalid range");
26386
26371
  complexBlockGetSelectedContainers(editor, block, start, end);
26387
26372
  const containers = editor.selection.range.getSelectedContainers();
26388
26373
  containers.forEach((container, index2) => {
@@ -26399,7 +26384,7 @@ var __publicField = (obj, key, value) => {
26399
26384
  return;
26400
26385
  }
26401
26386
  const selectedBlocks = range.getSelectedBlocks();
26402
- assert(logger$3r, selectedBlocks.length > 0, "no selected block");
26387
+ assert(logger$3q, selectedBlocks.length > 0, "no selected block");
26403
26388
  if (selectedBlocks.length === 1) {
26404
26389
  clearOneBlock(editor, selectedBlocks[0]);
26405
26390
  return;
@@ -26407,7 +26392,7 @@ var __publicField = (obj, key, value) => {
26407
26392
  const firstSelectedBlock = selectedBlocks[0];
26408
26393
  const firstBlock = firstSelectedBlock.block;
26409
26394
  const container = getParentContainer(firstBlock);
26410
- assert(logger$3r, selectedBlocks.length > 1, "no selected block");
26395
+ assert(logger$3q, selectedBlocks.length > 1, "no selected block");
26411
26396
  const lastSelectedBlock = selectedBlocks[selectedBlocks.length - 1];
26412
26397
  const lastBlock2 = lastSelectedBlock.block;
26413
26398
  if (isTextKindBlock(editor, firstBlock)) {
@@ -26437,7 +26422,7 @@ var __publicField = (obj, key, value) => {
26437
26422
  }
26438
26423
  const prevBlock = getPrevBlock(firstBlock);
26439
26424
  const nextBlock = getNextBlock(lastBlock2);
26440
- assert(logger$3r, prevBlock || nextBlock, "no prev or next block");
26425
+ assert(logger$3q, prevBlock || nextBlock, "no prev or next block");
26441
26426
  selectedBlocks.forEach((selectedBlock) => editor.deleteBlock(selectedBlock.block));
26442
26427
  }
26443
26428
  function editorClearSelectedContents(editor, selectionRange) {
@@ -26456,7 +26441,7 @@ var __publicField = (obj, key, value) => {
26456
26441
  editor.emit("afterClearSelection", editor);
26457
26442
  });
26458
26443
  }
26459
- const logger$3q = getLogger("core");
26444
+ const logger$3p = getLogger("core");
26460
26445
  function editorUpdateBlockText(editor, block, ops, options) {
26461
26446
  const container = getParentContainer(block);
26462
26447
  const containerId = getContainerId(container);
@@ -26469,7 +26454,7 @@ var __publicField = (obj, key, value) => {
26469
26454
  }
26470
26455
  function editorSetBlockText(editor, block, newText, options) {
26471
26456
  if (!editor.isBlockWritable(block)) {
26472
- logger$3q.error("block is not writable");
26457
+ logger$3p.error("block is not writable");
26473
26458
  return;
26474
26459
  }
26475
26460
  const oldText = editor.getBlockText(block);
@@ -26482,7 +26467,7 @@ var __publicField = (obj, key, value) => {
26482
26467
  const ops = RichText.diff(oldText, newText);
26483
26468
  return editorUpdateBlockText(editor, block, ops);
26484
26469
  }
26485
- const logger$3p = getLogger("update-block-data");
26470
+ const logger$3o = getLogger("update-block-data");
26486
26471
  function editorUpdateBlockData(editor, block, data2, newRange, options) {
26487
26472
  const container = getParentContainer(block);
26488
26473
  const containerId = getContainerId(container);
@@ -26499,17 +26484,17 @@ var __publicField = (obj, key, value) => {
26499
26484
  if (oldKey === "id" || oldKey === "type" || oldKey === "text") {
26500
26485
  return;
26501
26486
  }
26502
- logger$3p.debug(`delete key: ${oldKey}`);
26487
+ logger$3o.debug(`delete key: ${oldKey}`);
26503
26488
  delta.delete.push(oldKey);
26504
26489
  }
26505
26490
  });
26506
26491
  const entries = Object.entries(data2);
26507
26492
  entries.forEach(([key, value]) => {
26508
- assert(logger$3p, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
26493
+ assert(logger$3o, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
26509
26494
  const oldValue = oldData[key];
26510
26495
  if (value === null || value === void 0) {
26511
26496
  if (oldValue !== null && oldValue !== void 0) {
26512
- logger$3p.debug(`delete key: ${key}`);
26497
+ logger$3o.debug(`delete key: ${key}`);
26513
26498
  delta.delete.push(key);
26514
26499
  }
26515
26500
  return;
@@ -26527,10 +26512,10 @@ var __publicField = (obj, key, value) => {
26527
26512
  }
26528
26513
  }
26529
26514
  if (oldKeys.has(key)) {
26530
- logger$3p.debug(`replace key: ${key}`);
26515
+ logger$3o.debug(`replace key: ${key}`);
26531
26516
  delta.delete.push(key);
26532
26517
  } else {
26533
- logger$3p.debug(`insert key: ${key}`);
26518
+ logger$3o.debug(`insert key: ${key}`);
26534
26519
  }
26535
26520
  delta.insert[key] = value;
26536
26521
  });
@@ -26575,13 +26560,13 @@ var __publicField = (obj, key, value) => {
26575
26560
  comments: {}
26576
26561
  };
26577
26562
  }
26578
- const logger$3o = getLogger("clone-block");
26563
+ const logger$3n = getLogger("clone-block");
26579
26564
  function cloneBlock(editorBlocks, oldDoc, data2, info) {
26580
26565
  var _a;
26581
26566
  const blockClass = editorBlocks.getBlockClass(data2.type);
26582
26567
  if (blockClass.blockToDoc) {
26583
26568
  return blockClass.blockToDoc(oldDoc, data2, (oldDoc2, childBlock) => {
26584
- assert(logger$3o, data2 !== childBlock, "invalid child block");
26569
+ assert(logger$3n, data2 !== childBlock, "invalid child block");
26585
26570
  return cloneBlock(editorBlocks, oldDoc2, data2, info);
26586
26571
  }, info);
26587
26572
  }
@@ -26594,7 +26579,7 @@ var __publicField = (obj, key, value) => {
26594
26579
  }
26595
26580
  const newChildContainerId = genId();
26596
26581
  const childBlocks = oldDoc.blocks[oldChildContainerId];
26597
- assert(logger$3o, Array.isArray(childBlocks), "invalid child blocks");
26582
+ assert(logger$3n, Array.isArray(childBlocks), "invalid child blocks");
26598
26583
  const newDocs = childBlocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
26599
26584
  const newDoc = mergeDocs(newDocs);
26600
26585
  const { root: root2, ...childContainersData } = newDoc.blocks;
@@ -26623,7 +26608,7 @@ var __publicField = (obj, key, value) => {
26623
26608
  if (key.startsWith(prefix1)) {
26624
26609
  const keyContent = key.substring(prefix1.length);
26625
26610
  const newKey = `${newContainerId}/${keyContent}`;
26626
- logger$3o.debug(`replace key: ${key} -> ${newKey}`);
26611
+ logger$3n.debug(`replace key: ${key} -> ${newKey}`);
26627
26612
  return newKey;
26628
26613
  }
26629
26614
  }
@@ -26632,7 +26617,7 @@ var __publicField = (obj, key, value) => {
26632
26617
  if (key.startsWith(prefix2)) {
26633
26618
  const keyContent = key.substring(prefix2.length);
26634
26619
  const newKey = `${newContainerId}_${keyContent}`;
26635
- logger$3o.debug(`replace key: ${key} -> ${newKey}`);
26620
+ logger$3n.debug(`replace key: ${key} -> ${newKey}`);
26636
26621
  return newKey;
26637
26622
  }
26638
26623
  }
@@ -26662,7 +26647,7 @@ var __publicField = (obj, key, value) => {
26662
26647
  }
26663
26648
  function cloneChildContainer(editorBlocks, oldDoc, containerId, info) {
26664
26649
  const blocks = oldDoc.blocks[containerId];
26665
- assert(logger$3o, Array.isArray(blocks), "invalid child blocks");
26650
+ assert(logger$3n, Array.isArray(blocks), "invalid child blocks");
26666
26651
  const newDocs = blocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
26667
26652
  const newDoc = mergeDocs(newDocs);
26668
26653
  return newDoc;
@@ -26671,19 +26656,24 @@ var __publicField = (obj, key, value) => {
26671
26656
  const docs = doc2.blocks.root.map((b) => cloneBlock(editor.editorBlocks, doc2, b, info));
26672
26657
  return cloneDeep__default.default(mergeDocs(docs));
26673
26658
  }
26674
- const logger$3n = getLogger("insert-doc");
26659
+ const logger$3m = getLogger("insert-doc");
26675
26660
  function editorInsertDoc(editor, block, offset, insertedDoc, cloneDocResult) {
26661
+ var _a;
26676
26662
  if (isComplexKindBlock(editor, block)) {
26677
- logger$3n.warn("failed to insert doc into a complex block");
26663
+ logger$3m.warn("failed to insert doc into a complex block");
26678
26664
  return;
26679
26665
  }
26680
26666
  const doc2 = cloneDoc(editor, insertedDoc, cloneDocResult);
26681
26667
  const container = getParentContainer(block);
26682
26668
  const blockIndex = getBlockIndex(block);
26683
26669
  const containerId = getContainerId(container);
26670
+ if (doc2.blocks.root.length === 1 && isTextKindBlockType(editor, doc2.blocks.root[0].type)) {
26671
+ editor.insertTextToBlock(block, offset, (_a = doc2.blocks.root[0].text) != null ? _a : []);
26672
+ return;
26673
+ }
26684
26674
  editor.doc.beginBatchUpdate();
26685
26675
  editor.undoManager.runInGroup(() => {
26686
- var _a, _b, _c;
26676
+ var _a2, _b, _c;
26687
26677
  const childContainers = [];
26688
26678
  Object.entries(doc2.blocks).forEach(([containerId2, blocks2]) => {
26689
26679
  if (containerId2 === "root")
@@ -26708,7 +26698,7 @@ var __publicField = (obj, key, value) => {
26708
26698
  }
26709
26699
  return;
26710
26700
  }
26711
- assert(logger$3n, isTextKindBlock(editor, block), "not a text block");
26701
+ assert(logger$3m, isTextKindBlock(editor, block), "not a text block");
26712
26702
  if (isEmptyTextBlock(editor, block)) {
26713
26703
  const blockIndex2 = getBlockIndex(block);
26714
26704
  let lastBlock22;
@@ -26748,7 +26738,7 @@ var __publicField = (obj, key, value) => {
26748
26738
  if (blocks.length === 1) {
26749
26739
  const newBlock2 = blocks[0];
26750
26740
  if (isTextKindBlockType(editor, newBlock2.type)) {
26751
- editor.insertTextToBlock(block, offset, (_a = newBlock2.text) != null ? _a : []);
26741
+ editor.insertTextToBlock(block, offset, (_a2 = newBlock2.text) != null ? _a2 : []);
26752
26742
  return;
26753
26743
  }
26754
26744
  editor.breakTextBlock(block, offset);
@@ -26840,11 +26830,11 @@ var __publicField = (obj, key, value) => {
26840
26830
  editor.deleteBlock(block);
26841
26831
  }
26842
26832
  }
26843
- const logger$3m = getLogger("add-text-attribute");
26833
+ const logger$3l = getLogger("add-text-attribute");
26844
26834
  function editorRemoveTextAttribute(editor, block, range, attributeName) {
26845
26835
  const { start, end } = range;
26846
- assert(logger$3m, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26847
- assert(logger$3m, attributeName, "invalid attribute name");
26836
+ assert(logger$3l, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26837
+ assert(logger$3l, attributeName, "invalid attribute name");
26848
26838
  const oldText = editor.getBlockText(block);
26849
26839
  const newText = rangeRemoveAttribute(start.offset, end.offset - start.offset, oldText, attributeName, void 0, { ignoreValue: true });
26850
26840
  editor.setBlockText(block, newText);
@@ -26852,8 +26842,8 @@ var __publicField = (obj, key, value) => {
26852
26842
  }
26853
26843
  function editorAddTextAttribute(editor, block, range, attributeName, value) {
26854
26844
  const { start, end } = range;
26855
- assert(logger$3m, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26856
- assert(logger$3m, attributeName, "invalid attribute name");
26845
+ assert(logger$3l, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26846
+ assert(logger$3l, attributeName, "invalid attribute name");
26857
26847
  const oldText = editor.getBlockText(block);
26858
26848
  const newText = rangeAddAttribute(start.offset, end.offset - start.offset, oldText, attributeName, value);
26859
26849
  editor.setBlockText(block, newText);
@@ -26861,7 +26851,7 @@ var __publicField = (obj, key, value) => {
26861
26851
  }
26862
26852
  function editorSetTextColor(editor, block, range, type, value) {
26863
26853
  const { start, end } = range;
26864
- assert(logger$3m, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26854
+ assert(logger$3l, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26865
26855
  const oldText = editor.getBlockText(block);
26866
26856
  const newText = rangeSetTextColor(start.offset, end.offset - start.offset, oldText, type, value);
26867
26857
  editor.setBlockText(block, newText);
@@ -26950,10 +26940,10 @@ var __publicField = (obj, key, value) => {
26950
26940
  });
26951
26941
  return [color, backgroundColor];
26952
26942
  }
26953
- const logger$3l = getLogger("move-complex-block-position");
26943
+ const logger$3k = getLogger("move-complex-block-position");
26954
26944
  function moveComplexBlockPosition(editor, old, type) {
26955
26945
  const block = editor.getBlockById(old.blockId);
26956
- assert(logger$3l, isComplexKindBlock(editor, block), "is not a complex block");
26946
+ assert(logger$3k, isComplexKindBlock(editor, block), "is not a complex block");
26957
26947
  const blockClass = getComplexBlockClass(editor, block);
26958
26948
  const focusedContainer = editor.getContainerById(old.childContainerId);
26959
26949
  const nextContainer = blockClass.getNextContainer(editor, block, focusedContainer, type, { noWrap: true });
@@ -26962,24 +26952,24 @@ var __publicField = (obj, key, value) => {
26962
26952
  }
26963
26953
  return createComplexBlockPosition(block, getContainerId(nextContainer));
26964
26954
  }
26965
- const logger$3k = getLogger("move-simple-block-position");
26955
+ const logger$3j = getLogger("move-simple-block-position");
26966
26956
  function getFirstChildBlockInComplexBlock(editor, complexBlock) {
26967
26957
  const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
26968
26958
  if (containers.length === 0) {
26969
- logger$3k.warn("complex block has not any child container, not loaded?");
26959
+ logger$3j.warn("complex block has not any child container, not loaded?");
26970
26960
  return null;
26971
26961
  }
26972
- assert(logger$3k, containers.length > 0, "complex block has not any child container");
26962
+ assert(logger$3j, containers.length > 0, "complex block has not any child container");
26973
26963
  const container = containers[0];
26974
26964
  return getFirstChildBlock(container);
26975
26965
  }
26976
26966
  function getLastChildBlockInComplexBlock(editor, complexBlock) {
26977
26967
  const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
26978
26968
  if (containers.length === 0) {
26979
- logger$3k.warn("complex block has not any child container, not loaded?");
26969
+ logger$3j.warn("complex block has not any child container, not loaded?");
26980
26970
  return null;
26981
26971
  }
26982
- assert(logger$3k, containers.length > 0, "complex block has not any child container");
26972
+ assert(logger$3j, containers.length > 0, "complex block has not any child container");
26983
26973
  const container = containers[containers.length - 1];
26984
26974
  return getLastChildBlock(container);
26985
26975
  }
@@ -27024,8 +27014,8 @@ var __publicField = (obj, key, value) => {
27024
27014
  return null;
27025
27015
  }
27026
27016
  const parentComplexBlock = getParentBlock(container);
27027
- assert(logger$3k, parentComplexBlock, "child container has not parent block");
27028
- assert(logger$3k, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
27017
+ assert(logger$3j, parentComplexBlock, "child container has not parent block");
27018
+ assert(logger$3j, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
27029
27019
  const nextContainer = getComplexBlockClass(editor, parentComplexBlock).getNextContainer(editor, parentComplexBlock, container, type);
27030
27020
  if (nextContainer) {
27031
27021
  if (isFindPrev(type)) {
@@ -27047,7 +27037,7 @@ var __publicField = (obj, key, value) => {
27047
27037
  return null;
27048
27038
  }
27049
27039
  const parentBlock = getParentBlock(container);
27050
- assert(logger$3k, parentBlock, "child container has not parent block");
27040
+ assert(logger$3j, parentBlock, "child container has not parent block");
27051
27041
  if (isFindPrev(type)) {
27052
27042
  const prev = getPrevBlock(parentBlock);
27053
27043
  if (prev) {
@@ -27102,7 +27092,7 @@ var __publicField = (obj, key, value) => {
27102
27092
  }
27103
27093
  if (!targetBlock) {
27104
27094
  if (isComplexKindBlock(editor, block) && complexBlockGetAllChildContainers(editor, block).length === 0) {
27105
- logger$3k.warn("complex block has not any child container, not loaded?");
27095
+ logger$3j.warn("complex block has not any child container, not loaded?");
27106
27096
  targetBlock = direction === "ArrowDown" || direction === "ArrowRight" ? getNextVisibleBlock(block) : getPrevVisibleBlock(block);
27107
27097
  }
27108
27098
  }
@@ -27249,10 +27239,10 @@ var __publicField = (obj, key, value) => {
27249
27239
  editorAdjustSelection(editor, "ArrowUp", "select");
27250
27240
  return true;
27251
27241
  }
27252
- const logger$3j = getLogger("word-offset");
27242
+ const logger$3i = getLogger("word-offset");
27253
27243
  function editorGetWordLeftPos(editor, type) {
27254
27244
  const old = editor.selection.range.focus;
27255
- assert(logger$3j, old.isSimple(), "invalid range type");
27245
+ assert(logger$3i, old.isSimple(), "invalid range type");
27256
27246
  const block = editor.getBlockById(old.blockId);
27257
27247
  if (isEmptyTextBlock(editor, block)) {
27258
27248
  return createSimpleBlockPosition(block, 0, "home");
@@ -27277,7 +27267,7 @@ var __publicField = (obj, key, value) => {
27277
27267
  }
27278
27268
  function editorGetWordRightPos(editor, type) {
27279
27269
  const old = editor.selection.range.focus;
27280
- assert(logger$3j, old.isSimple(), "invalid range type");
27270
+ assert(logger$3i, old.isSimple(), "invalid range type");
27281
27271
  const block = editor.getBlockById(old.blockId);
27282
27272
  if (isEmptyTextBlock(editor, block)) {
27283
27273
  return createSimpleBlockPosition(block, 0, "end");
@@ -27389,10 +27379,10 @@ var __publicField = (obj, key, value) => {
27389
27379
  editor.selection.setSelection(editor.selection.getAnchorPos(), pos);
27390
27380
  return true;
27391
27381
  }
27392
- const logger$3i = getLogger("line-offset");
27382
+ const logger$3h = getLogger("line-offset");
27393
27383
  function editorGetLineHomePos(editor) {
27394
27384
  const old = editor.selection.range.focus;
27395
- assert(logger$3i, old.isSimple(), "invalid range type");
27385
+ assert(logger$3h, old.isSimple(), "invalid range type");
27396
27386
  const block = editor.getBlockById(old.blockId);
27397
27387
  if (old.offset === 0 || !isTextKindBlock(editor, block)) {
27398
27388
  const newPos2 = createSimpleBlockPosition(block, 0, "home");
@@ -27409,7 +27399,7 @@ var __publicField = (obj, key, value) => {
27409
27399
  }
27410
27400
  function editorGetLineEndPos(editor) {
27411
27401
  const old = editor.selection.range.focus;
27412
- assert(logger$3i, old.isSimple(), "invalid range type");
27402
+ assert(logger$3h, old.isSimple(), "invalid range type");
27413
27403
  const block = editor.getBlockById(old.blockId);
27414
27404
  if (old.offset === getBlockTextLength$6(editor, block) || !isTextKindBlock(editor, block)) {
27415
27405
  const newPos2 = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
@@ -27509,7 +27499,7 @@ var __publicField = (obj, key, value) => {
27509
27499
  editorPageDownScroll(editor);
27510
27500
  return true;
27511
27501
  }
27512
- const logger$3h = getLogger("table-scroll");
27502
+ const logger$3g = getLogger("table-scroll");
27513
27503
  class DomEventHandler {
27514
27504
  constructor(editor, dom, name, handler, data2, options) {
27515
27505
  __publicField(this, "handleEvent", (event) => {
@@ -27541,7 +27531,7 @@ var __publicField = (obj, key, value) => {
27541
27531
  const existsHandlers = this.handlers.get(element);
27542
27532
  if (existsHandlers) {
27543
27533
  if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
27544
- logger$3h.warn(`event has already registered: ${eventName}`);
27534
+ logger$3g.warn(`event has already registered: ${eventName}`);
27545
27535
  return;
27546
27536
  }
27547
27537
  existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
@@ -27651,7 +27641,7 @@ var __publicField = (obj, key, value) => {
27651
27641
  });
27652
27642
  return true;
27653
27643
  }
27654
- const logger$3g = getLogger("select-all");
27644
+ const logger$3f = getLogger("select-all");
27655
27645
  function isContainerSelectedAllChildBlocks(container, range) {
27656
27646
  const firstBlock = getFirstChildBlock(container);
27657
27647
  const lastBlock2 = getLastChildBlock(container);
@@ -27666,8 +27656,8 @@ var __publicField = (obj, key, value) => {
27666
27656
  return range.start.blockId === blockId && range.start.childContainerId === getContainerId(first) && range.end.blockId === blockId && range.end.childContainerId === getContainerId(last);
27667
27657
  }
27668
27658
  function selectComplexBlock(editor, block) {
27669
- assert(logger$3g, block, "no parent block");
27670
- assert(logger$3g, isComplexKindBlock(editor, block), "not a complex block");
27659
+ assert(logger$3f, block, "no parent block");
27660
+ assert(logger$3f, isComplexKindBlock(editor, block), "not a complex block");
27671
27661
  const containers = getComplexBlockClass(editor, block).getChildContainers(editor, block);
27672
27662
  const first = containers[0];
27673
27663
  const last = containers[containers.length - 1];
@@ -27703,13 +27693,13 @@ var __publicField = (obj, key, value) => {
27703
27693
  selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
27704
27694
  return false;
27705
27695
  }
27706
- assert(logger$3g, !range.isSimple(), "invalid range type");
27696
+ assert(logger$3f, !range.isSimple(), "invalid range type");
27707
27697
  if (isComplexBlockSelectedAllChildContainer(focusedBlock, range)) {
27708
27698
  selectParentContainer(editor, focusedBlock);
27709
27699
  return false;
27710
27700
  }
27711
- assert(logger$3g, focusedBlock, "no parent block");
27712
- assert(logger$3g, isComplexKindBlock(editor, focusedBlock), "not a complex block");
27701
+ assert(logger$3f, focusedBlock, "no parent block");
27702
+ assert(logger$3f, isComplexKindBlock(editor, focusedBlock), "not a complex block");
27713
27703
  selectComplexBlock(editor, focusedBlock);
27714
27704
  return true;
27715
27705
  }
@@ -27824,7 +27814,7 @@ var __publicField = (obj, key, value) => {
27824
27814
  }
27825
27815
  return cloned;
27826
27816
  }
27827
- const logger$3f = getLogger("selected-block-to-doc");
27817
+ const logger$3e = getLogger("selected-block-to-doc");
27828
27818
  function appendBlockChildren(editor, data2, doc2) {
27829
27819
  if (!data2.children)
27830
27820
  return;
@@ -27845,7 +27835,7 @@ var __publicField = (obj, key, value) => {
27845
27835
  if (isTextKindBlock(editor, selectedBlock.block)) {
27846
27836
  const start = selectedBlock.start;
27847
27837
  const end = selectedBlock.end;
27848
- assert(logger$3f, data2.text, "no block text");
27838
+ assert(logger$3e, data2.text, "no block text");
27849
27839
  if (start.offset === end.offset) {
27850
27840
  return {
27851
27841
  blocks: {
@@ -27879,8 +27869,8 @@ var __publicField = (obj, key, value) => {
27879
27869
  comments: {}
27880
27870
  };
27881
27871
  }
27882
- assert(logger$3f, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
27883
- assert(logger$3f, data2.children, "no children");
27872
+ assert(logger$3e, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
27873
+ assert(logger$3e, data2.children, "no children");
27884
27874
  const ret = {
27885
27875
  blocks: {
27886
27876
  root: [
@@ -27898,9 +27888,9 @@ var __publicField = (obj, key, value) => {
27898
27888
  const end = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
27899
27889
  return selectedBlockToDoc(editor, { block, start, end });
27900
27890
  }
27901
- const logger$3e = getLogger("block-to-doc");
27891
+ const logger$3d = getLogger("block-to-doc");
27902
27892
  function blocksToDoc(editor, blocks) {
27903
- assert(logger$3e, blocks.length > 0, "invalid params, no blocks");
27893
+ assert(logger$3d, blocks.length > 0, "invalid params, no blocks");
27904
27894
  const docs = blocks.map((b) => blockToDoc(editor, b));
27905
27895
  return mergeDocs(docs);
27906
27896
  }
@@ -27920,7 +27910,7 @@ var __publicField = (obj, key, value) => {
27920
27910
  const newDocs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
27921
27911
  return mergeDocs(newDocs);
27922
27912
  }
27923
- const logger$3d = getLogger("ensure-block-visible");
27913
+ const logger$3c = getLogger("ensure-block-visible");
27924
27914
  function ensureBlockVisible(editor, block) {
27925
27915
  var _a;
27926
27916
  while (block) {
@@ -27930,16 +27920,16 @@ var __publicField = (obj, key, value) => {
27930
27920
  return;
27931
27921
  }
27932
27922
  const parentComplexBlock = getParentBlock(container);
27933
- assert(logger$3d, parentComplexBlock, "no parent block");
27923
+ assert(logger$3c, parentComplexBlock, "no parent block");
27934
27924
  const parentComplexBlockClass = getBlockClass(editor, parentComplexBlock);
27935
27925
  if (parentComplexBlockClass.isChildContainerVisible && !((_a = parentComplexBlockClass.isChildContainerVisible) == null ? void 0 : _a.call(parentComplexBlockClass, editor, parentComplexBlock, container))) {
27936
- assert(logger$3d, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
27926
+ assert(logger$3c, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
27937
27927
  parentComplexBlockClass.showChildContainer(editor, parentComplexBlock, container);
27938
27928
  }
27939
27929
  block = parentComplexBlock;
27940
27930
  }
27941
27931
  }
27942
- const logger$3c = getLogger("editor-selection");
27932
+ const logger$3b = getLogger("editor-selection");
27943
27933
  class EditorSelection {
27944
27934
  constructor(editor) {
27945
27935
  __publicField(this, "editor");
@@ -27952,7 +27942,7 @@ var __publicField = (obj, key, value) => {
27952
27942
  }
27953
27943
  const range = this.range;
27954
27944
  if (rangeInBlock(deletedBlock, range)) {
27955
- logger$3c.debug("adjust selection because remote deleted current block");
27945
+ logger$3b.debug("adjust selection because remote deleted current block");
27956
27946
  const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
27957
27947
  this.setRange(newRange, { noScroll: true });
27958
27948
  }
@@ -28077,14 +28067,14 @@ var __publicField = (obj, key, value) => {
28077
28067
  if (pos.isSimple()) {
28078
28068
  const ok = pos.offset >= 0 && pos.offset <= getBlockTextLength$6(this.editor, block);
28079
28069
  if (!ok) {
28080
- assert(logger$3c, false, "invalid block position, out of range");
28070
+ assert(logger$3b, false, "invalid block position, out of range");
28081
28071
  }
28082
28072
  } else {
28083
28073
  const childContainerId = pos.childContainerId;
28084
28074
  const container = this.editor.getContainerById(childContainerId);
28085
28075
  const ok = !!container;
28086
28076
  if (!ok) {
28087
- assert(logger$3c, false, "invalid complex block position, no container found");
28077
+ assert(logger$3b, false, "invalid complex block position, no container found");
28088
28078
  }
28089
28079
  }
28090
28080
  }
@@ -28145,7 +28135,7 @@ var __publicField = (obj, key, value) => {
28145
28135
  let container = getParentContainer(block);
28146
28136
  while (isChildContainer(container)) {
28147
28137
  const parentBlock = getParentBlock(container);
28148
- assert(logger$3c, parentBlock, "parent block not found");
28138
+ assert(logger$3b, parentBlock, "parent block not found");
28149
28139
  addClass(parentBlock, "child-focused");
28150
28140
  container = getParentContainer(parentBlock);
28151
28141
  }
@@ -28255,15 +28245,15 @@ var __publicField = (obj, key, value) => {
28255
28245
  editor.undoManager.redo();
28256
28246
  return true;
28257
28247
  }
28258
- const logger$3b = getLogger("delete-text");
28248
+ const logger$3a = getLogger("delete-text");
28259
28249
  function editorDeleteText(editor, type, count, insertPos) {
28260
28250
  const pos = insertPos != null ? insertPos : editor.selection.range.start;
28261
28251
  if (!(pos instanceof EditorSimpleBlockPosition)) {
28262
- assert(logger$3b, false, `invalid insert pos type: ${typeof pos}`);
28252
+ assert(logger$3a, false, `invalid insert pos type: ${typeof pos}`);
28263
28253
  }
28264
28254
  const { blockId } = pos;
28265
28255
  const block = editor.getBlockById(blockId);
28266
- assert(logger$3b, isTextKindBlock(editor, block), "block is not a text kind block");
28256
+ assert(logger$3a, isTextKindBlock(editor, block), "block is not a text kind block");
28267
28257
  let { offset } = pos;
28268
28258
  if (type === "backward") {
28269
28259
  if (offset - count < 0) {
@@ -28293,7 +28283,7 @@ var __publicField = (obj, key, value) => {
28293
28283
  }
28294
28284
  return false;
28295
28285
  }
28296
- const logger$3a = getLogger("handle-backspace");
28286
+ const logger$39 = getLogger("handle-backspace");
28297
28287
  function tryDeleteEmptyBlock(editor, block) {
28298
28288
  if (!isEmptyTextBlock(editor, block)) {
28299
28289
  return;
@@ -28333,7 +28323,7 @@ var __publicField = (obj, key, value) => {
28333
28323
  }
28334
28324
  } else {
28335
28325
  tryDeleteEmptyBlock(editor, block);
28336
- assert(logger$3a, isEmbedBlock(prevBlock), "prev block is not embed block");
28326
+ assert(logger$39, isEmbedBlock(prevBlock), "prev block is not embed block");
28337
28327
  editor.selection.selectBlock(prevBlock, 1);
28338
28328
  }
28339
28329
  } else {
@@ -28360,7 +28350,6 @@ var __publicField = (obj, key, value) => {
28360
28350
  editor.deleteBlock(block);
28361
28351
  }
28362
28352
  }
28363
- const logger$39 = getLogger("word-offset");
28364
28353
  function handleEditorDelete(editor, event) {
28365
28354
  if (!editor.selection.range.isCollapsed()) {
28366
28355
  editor.clearSelectedContents();
@@ -28395,130 +28384,6 @@ var __publicField = (obj, key, value) => {
28395
28384
  editor.deleteBlock(block);
28396
28385
  }
28397
28386
  }
28398
- function handleEditorDeleteLeftWord(editor, event) {
28399
- const old = editor.selection.range.focus;
28400
- assert(logger$39, old.isSimple(), "invalid range type");
28401
- const block = editor.getBlockById(old.blockId);
28402
- if (!isTextKindBlock(editor, block)) {
28403
- editor.deleteBlock(block);
28404
- return true;
28405
- }
28406
- if (old.offset === 0) {
28407
- const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
28408
- if (!isTextKindBlock(editor, block2))
28409
- return true;
28410
- return !isEmptyTextBlock(editor, block2);
28411
- };
28412
- const prevBlock = getPrevVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
28413
- if (!prevBlock)
28414
- return false;
28415
- const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
28416
- const emptyTextBlocks = getBlocksBetween(prevBlock, block, matchEmptyTextBlock);
28417
- emptyTextBlocks.forEach((b) => {
28418
- editor.deleteBlock(b);
28419
- });
28420
- if (!isTextKindBlock(editor, prevBlock)) {
28421
- editor.deleteBlock(prevBlock);
28422
- return true;
28423
- }
28424
- const textBlockLen = getBlockTextLength$6(editor, prevBlock);
28425
- const newOffset2 = findWordLeft(editor, prevBlock, textBlockLen);
28426
- editor.deleteTextFromBlock(prevBlock, newOffset2, textBlockLen - newOffset2);
28427
- const currentBlockText = editor.getBlockText(block);
28428
- editor.insertTextToBlock(prevBlock, newOffset2, currentBlockText);
28429
- editor.deleteBlock(block);
28430
- const pos = createSimpleBlockPosition(prevBlock, newOffset2, "normal");
28431
- editor.selection.setSelection(pos);
28432
- editor.selection.updateLastCaretRect();
28433
- return true;
28434
- }
28435
- const newOffset = findWordLeft(editor, block, old.offset);
28436
- const deletedCount = old.offset - newOffset;
28437
- editor.deleteTextFromBlock(block, newOffset, deletedCount);
28438
- return true;
28439
- }
28440
- function handleEditorDeleteRightWord(editor, event) {
28441
- const old = editor.selection.range.focus;
28442
- assert(logger$39, old.isSimple(), "invalid range type");
28443
- const block = editor.getBlockById(old.blockId);
28444
- if (!isTextKindBlock(editor, block)) {
28445
- editor.deleteBlock(block);
28446
- return true;
28447
- }
28448
- if (old.offset === getTextBlockLength(block)) {
28449
- const matchNonEmptyTextBlockOrOtherBlock = (block2) => {
28450
- if (!isTextKindBlock(editor, block2))
28451
- return true;
28452
- return !isEmptyTextBlock(editor, block2);
28453
- };
28454
- const nextBlock = getNextVisibleBlock(block, matchNonEmptyTextBlockOrOtherBlock);
28455
- if (!nextBlock)
28456
- return false;
28457
- const matchEmptyTextBlock = (block2) => isEmptyTextBlock(editor, block2);
28458
- const emptyTextBlocks = getBlocksBetween(block, nextBlock, matchEmptyTextBlock);
28459
- emptyTextBlocks.forEach((b) => {
28460
- editor.deleteBlock(b);
28461
- });
28462
- if (!isTextKindBlock(editor, nextBlock)) {
28463
- editor.deleteBlock(nextBlock);
28464
- return true;
28465
- }
28466
- const newOffset = findWordEnd(editor, nextBlock, 0);
28467
- editor.deleteTextFromBlock(nextBlock, 0, newOffset);
28468
- const nextBlockText = editor.getBlockText(nextBlock);
28469
- editor.insertTextToBlock(block, old.offset, nextBlockText);
28470
- editor.deleteBlock(nextBlock);
28471
- const pos = createSimpleBlockPosition(block, old.offset, "normal");
28472
- editor.selection.setSelection(pos);
28473
- editor.selection.updateLastCaretRect();
28474
- return true;
28475
- }
28476
- const endOffset = findWordEnd(editor, block, old.offset);
28477
- const deletedCount = endOffset - old.offset;
28478
- editor.deleteTextFromBlock(block, old.offset, deletedCount);
28479
- return true;
28480
- }
28481
- function handleEditorDeleteAfterWords(editor) {
28482
- const old = editor.selection.range.focus;
28483
- assert(logger$39, old.isSimple(), "invalid range type");
28484
- const block = editor.getBlockById(old.blockId);
28485
- if (!isTextKindBlock(editor, block)) {
28486
- editor.deleteBlock(block);
28487
- return;
28488
- }
28489
- const needDeleteCount = getTextBlockLength(block) - old.offset;
28490
- if (needDeleteCount === 0)
28491
- return;
28492
- editor.deleteTextFromBlock(block, old.offset, needDeleteCount);
28493
- }
28494
- function handleEditorDeleteRightChar(editor) {
28495
- const old = editor.selection.range.focus;
28496
- assert(logger$39, old.isSimple(), "invalid range type");
28497
- const block = editor.getBlockById(old.blockId);
28498
- if (!isTextKindBlock(editor, block)) {
28499
- editor.deleteBlock(block);
28500
- return;
28501
- }
28502
- if (old.offset === getBlockTextLength$6(editor, block)) {
28503
- const nextVisibleBlock = getNextVisibleBlock(block);
28504
- if (!nextVisibleBlock)
28505
- return;
28506
- if (!isTextKindBlock(editor, nextVisibleBlock))
28507
- return;
28508
- if (isEmptyTextBlock(editor, nextVisibleBlock)) {
28509
- editor.deleteBlock(nextVisibleBlock);
28510
- return;
28511
- }
28512
- const nextBlockText = editor.getBlockText(nextVisibleBlock);
28513
- editor.deleteBlock(nextVisibleBlock);
28514
- editor.insertTextToBlock(block, old.offset, nextBlockText);
28515
- const pos = createSimpleBlockPosition(block, old.offset, "normal");
28516
- editor.selection.setSelection(pos);
28517
- editor.selection.updateLastCaretRect();
28518
- return;
28519
- }
28520
- editorDeleteText(editor, "forward", 1, null);
28521
- }
28522
28387
  function handleEditorEnterEvent$1(editor, event) {
28523
28388
  if (isFullSelectedOneComplexBlock(editor)) {
28524
28389
  const focusedBlock2 = editor.getFocusedBlock();
@@ -28740,42 +28605,6 @@ var __publicField = (obj, key, value) => {
28740
28605
  return true;
28741
28606
  });
28742
28607
  }
28743
- function editorHandleDeleteLeftWord(editor, event) {
28744
- if (editor.readonly || !editor.isWritable()) {
28745
- return false;
28746
- }
28747
- return editor.undoManager.runInGroup(() => {
28748
- handleEditorDeleteLeftWord(editor);
28749
- return true;
28750
- });
28751
- }
28752
- function editorHandleDeleteRightWord(editor, event) {
28753
- if (editor.readonly || !editor.isWritable()) {
28754
- return false;
28755
- }
28756
- return editor.undoManager.runInGroup(() => {
28757
- handleEditorDeleteRightWord(editor);
28758
- return true;
28759
- });
28760
- }
28761
- function editorHandleDeleteAfterWords(editor, event) {
28762
- if (editor.readonly || !editor.isWritable()) {
28763
- return false;
28764
- }
28765
- return editor.undoManager.runInGroup(() => {
28766
- handleEditorDeleteAfterWords(editor);
28767
- return true;
28768
- });
28769
- }
28770
- function editorHandleDeleteRightChar(editor, event) {
28771
- if (editor.readonly || !editor.isWritable()) {
28772
- return false;
28773
- }
28774
- return editor.undoManager.runInGroup(() => {
28775
- handleEditorDeleteRightChar(editor);
28776
- return true;
28777
- });
28778
- }
28779
28608
  function editorHandleBackspace(editor, event) {
28780
28609
  if (editor.readonly || !editor.isWritable()) {
28781
28610
  return false;
@@ -28866,10 +28695,6 @@ ${codeText}
28866
28695
  __proto__: null,
28867
28696
  editorHandleEnter,
28868
28697
  editorHandleDelete,
28869
- editorHandleDeleteLeftWord,
28870
- editorHandleDeleteRightWord,
28871
- editorHandleDeleteAfterWords,
28872
- editorHandleDeleteRightChar,
28873
28698
  editorHandleBackspace,
28874
28699
  editorHandleInsertBr,
28875
28700
  editorHandlePastePlainText,
@@ -28879,35 +28704,23 @@ ${codeText}
28879
28704
  }, Symbol.toStringTag, { value: "Module" }));
28880
28705
  const DefaultShortcuts = {
28881
28706
  "ArrowDown": editorMoveDown,
28882
- "Ctrl+N": editorMoveDown,
28883
28707
  "ArrowUp": editorMoveUp,
28884
- "Ctrl+P": editorMoveUp,
28885
28708
  "ArrowLeft": editorMoveLeft,
28886
- "Ctrl+B": editorMoveLeft,
28887
28709
  "ArrowRight": editorMoveRight,
28888
- "Ctrl+F": editorMoveRight,
28889
28710
  "Shift+ArrowDown": editorSelectDown,
28890
28711
  "Shift+ArrowUp": editorSelectUp,
28891
28712
  "Shift+ArrowLeft": editorSelectLeft,
28892
28713
  "Shift+ArrowRight": editorSelectRight,
28893
- "Cmd+ArrowLeft": editorMoveLineHome,
28894
- "Cmd+ArrowRight": editorMoveLineEnd,
28895
- "Ctrl+ArrowLeft": editorMoveWordLeft,
28896
- "Ctrl+ArrowRight": editorMoveWordEnd,
28897
- "Option+ArrowLeft": editorMoveWordLeft,
28898
- "Option+ArrowRight": editorMoveWordEnd,
28899
- "Ctrl+Shift+ArrowLeft": editorSelectWordLeft,
28900
- "Ctrl+Shift+ArrowRight": editorSelectWordEnd,
28901
- "Cmd+Shift+ArrowLeft": editorSelectLineHome,
28902
- "Cmd+Shift+ArrowRight": editorSelectLineEnd,
28714
+ "CtrlOrCmd+ArrowLeft": editorMoveWordLeft,
28715
+ "CtrlOrCmd+ArrowRight": editorMoveWordEnd,
28716
+ "CtrlOrCmd+Shift+ArrowLeft": editorSelectWordLeft,
28717
+ "CtrlOrCmd+Shift+ArrowRight": editorSelectWordEnd,
28903
28718
  "CtrlOrCmd+ArrowUp": editorMoveHome,
28904
28719
  "CtrlOrCmd+ArrowDown": editorMoveEnd,
28905
28720
  "CtrlOrCmd+Shift+ArrowUp": editorSelectHome,
28906
28721
  "CtrlOrCmd+Shift+ArrowDown": editorSelectEnd,
28907
28722
  "CtrlOrCmd+A": editorSelectAll,
28908
- "Ctrl+A": editorMoveLineHome,
28909
28723
  "Home": editorMoveLineHome,
28910
- "Ctrl+E": editorMoveLineEnd,
28911
28724
  "End": editorMoveLineEnd,
28912
28725
  "Shift+Home": editorSelectLineHome,
28913
28726
  "Shift+End": editorSelectLineEnd,
@@ -28915,13 +28728,6 @@ ${codeText}
28915
28728
  "PageDown": editorMovePageDown,
28916
28729
  "Shift+PageUp": editorSelectPageUp,
28917
28730
  "Shift+PageDown": editorSelectPageDown,
28918
- "OPTION+Delete": editorHandleDeleteRightWord,
28919
- "OPTION+Backspace": editorHandleDeleteLeftWord,
28920
- "Ctrl+Delete": editorHandleDeleteRightWord,
28921
- "Ctrl+Backspace": editorHandleDeleteLeftWord,
28922
- "Ctrl+K": editorHandleDeleteAfterWords,
28923
- "Ctrl+H": editorHandleBackspace,
28924
- "Ctrl+D": editorHandleDeleteRightChar,
28925
28731
  "CtrlOrCmd+Z": editorUndo,
28926
28732
  "CtrlOrCmd+Shift+Z": editorRedo,
28927
28733
  "Enter": editorHandleEnter,
@@ -41581,6 +41387,7 @@ ${codeText}
41581
41387
  this.options.onClickItem(this, item);
41582
41388
  }, 300, { leading: true, trailing: false }));
41583
41389
  __publicField(this, "handleShow", (menu) => {
41390
+ this.menu.content.classList.add("auto-suggest-menu");
41584
41391
  });
41585
41392
  __publicField(this, "handleShown", () => {
41586
41393
  var _a, _b;
@@ -42115,21 +41922,8 @@ ${codeText}
42115
41922
  }
42116
41923
  const textColorItem = "";
42117
41924
  const DEFAULT_BG_COLOR = 2;
42118
- const STORAGE_NAME = "color-item";
42119
- function getColorsFromLocalStorage(editor) {
42120
- const colors = [null, null];
42121
- const color = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-color`) || "", 10);
42122
- const backgroundColor = Number.parseInt(editor.settingsProvider.getItem(`${STORAGE_NAME}-backgroundColor`) || `${DEFAULT_BG_COLOR}`, 10);
42123
- if (!Number.isNaN(color)) {
42124
- colors[0] = color;
42125
- }
42126
- if (!Number.isNaN(backgroundColor)) {
42127
- colors[1] = backgroundColor;
42128
- }
42129
- return colors;
42130
- }
42131
41925
  class TextColorItem extends tinyTypedEmitter.TypedEmitter {
42132
- constructor(editor, storageName = STORAGE_NAME) {
41926
+ constructor(editor, storageName = "color-item") {
42133
41927
  super();
42134
41928
  __publicField(this, "id", "text-color-item");
42135
41929
  __publicField(this, "name", i18n$1.t("colorPalette.name"));
@@ -42207,7 +42001,7 @@ ${codeText}
42207
42001
  this.children.push(this.colorPaletteItem);
42208
42002
  this.element = createColorButton();
42209
42003
  this.bindColorButtonEvents();
42210
- const existColors = getColorsFromLocalStorage(editor);
42004
+ const existColors = this.getColorsFromLocalStorage();
42211
42005
  this.latestColors = existColors;
42212
42006
  this.setCurrentButtonColor(this.latestColors);
42213
42007
  this.element.setAttribute(`data-editor-tooltip-${editor.clientId}`, this.name);
@@ -42219,6 +42013,18 @@ ${codeText}
42219
42013
  this.element.addEventListener("click", this.handleButtonClick);
42220
42014
  }
42221
42015
  }
42016
+ getColorsFromLocalStorage() {
42017
+ const colors = [null, null];
42018
+ const color = Number.parseInt(this.editor.settingsProvider.getItem(`${this.storageName}-color`) || "", 10);
42019
+ const backgroundColor = Number.parseInt(this.editor.settingsProvider.getItem(`${this.storageName}-backgroundColor`) || `${DEFAULT_BG_COLOR}`, 10);
42020
+ if (!Number.isNaN(color)) {
42021
+ colors[0] = color;
42022
+ }
42023
+ if (!Number.isNaN(backgroundColor)) {
42024
+ colors[1] = backgroundColor;
42025
+ }
42026
+ return colors;
42027
+ }
42222
42028
  destroy() {
42223
42029
  this.colorPaletteItem.destroy();
42224
42030
  this.element.removeEventListener("click", this.handleButtonClick);
@@ -42601,6 +42407,32 @@ ${codeText}
42601
42407
  }
42602
42408
  return this.menu.handleKeydown(event);
42603
42409
  }
42410
+ async handleBeforePasteDoc(editor, doc2) {
42411
+ var _a;
42412
+ if (!((_a = this.menu) == null ? void 0 : _a.isVisible)) {
42413
+ return false;
42414
+ }
42415
+ const shouldCancelAutoSuggest = () => {
42416
+ var _a2;
42417
+ const blocks = doc2.blocks.root;
42418
+ if (blocks.length !== 1) {
42419
+ return true;
42420
+ }
42421
+ const block = blocks[0];
42422
+ if (((_a2 = editor.editorBlocks.getBlockClass(block.type)) == null ? void 0 : _a2.blockKind) !== "text") {
42423
+ return true;
42424
+ }
42425
+ const text2 = toPlainText(block.text || []);
42426
+ if (text2.length > 50) {
42427
+ return true;
42428
+ }
42429
+ return false;
42430
+ };
42431
+ if (shouldCancelAutoSuggest()) {
42432
+ this.menu.close();
42433
+ }
42434
+ return false;
42435
+ }
42604
42436
  popup(block, offset, leftText, trigger) {
42605
42437
  this.anchor = {
42606
42438
  blockId: getBlockId(block),
@@ -42656,6 +42488,13 @@ ${codeText}
42656
42488
  }
42657
42489
  return this.triggerPopup(editor, containerId, blockIndex, insertOffset, text2);
42658
42490
  }
42491
+ async handleAfterPasteDoc(editor, doc2, cloneDocResult) {
42492
+ var _a;
42493
+ if ((_a = this.menu) == null ? void 0 : _a.isVisible) {
42494
+ this.resetItems();
42495
+ }
42496
+ return false;
42497
+ }
42659
42498
  handleUpdateCompositionText(editor, containerId, blockIndex, offset, end) {
42660
42499
  var _a;
42661
42500
  const start = editor.selection.range.start;
@@ -49669,7 +49508,7 @@ ${codeText}
49669
49508
  }
49670
49509
  return handleDragList(editor, draggedBlock, targetBlock, insertPos);
49671
49510
  }
49672
- function executeShortcut$3(editor, type) {
49511
+ function executeShortcut$1(editor, type) {
49673
49512
  if (!editor.isWritable()) {
49674
49513
  return false;
49675
49514
  }
@@ -49683,8 +49522,8 @@ ${codeText}
49683
49522
  return true;
49684
49523
  }
49685
49524
  const ListBlockShortcuts = {
49686
- "Shift+CtrlOrCmd+L": (editor) => executeShortcut$3(editor, "ordered-list"),
49687
- "Shift+CtrlOrCmd+U": (editor) => executeShortcut$3(editor, "unordered-list")
49525
+ "Shift+CtrlOrCmd+L": (editor) => executeShortcut$1(editor, "ordered-list"),
49526
+ "Shift+CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "unordered-list")
49688
49527
  };
49689
49528
  function getBlockPadding$1(block) {
49690
49529
  const padding = block.getAttribute("block-padding-level");
@@ -60007,31 +59846,6 @@ $$${mathData.mathjaxText}$$
60007
59846
  return editor.addCustom("overflow-tooltip-helper", () => new OverflowTooltipHelper(editor));
60008
59847
  }
60009
59848
  }
60010
- function executeShortcut$2(editor, style2) {
60011
- if (!editor.isWritable()) {
60012
- return false;
60013
- }
60014
- const range = editor.selection.range;
60015
- const allCommands = editor.editorCommandProviders.getCommands(range);
60016
- const alignCommands = allCommands.flatMap((command2) => {
60017
- if (command2.id === "align") {
60018
- return command2.children;
60019
- }
60020
- return [];
60021
- });
60022
- const command = alignCommands.find((c) => c.id === `align-${style2}`);
60023
- if (!command) {
60024
- return false;
60025
- }
60026
- editor.editorCommandProviders.executeCommand(range, command, {});
60027
- OnesEditorToolbar.get(editor).update("selectionChange");
60028
- return true;
60029
- }
60030
- const AlignShortcuts = {
60031
- "CtrlOrCmd+Shift+E": (editor) => executeShortcut$2(editor, "center"),
60032
- "CtrlOrCmd+Shift+O": (editor) => executeShortcut$2(editor, "left"),
60033
- "CtrlOrCmd+Shift+R": (editor) => executeShortcut$2(editor, "right")
60034
- };
60035
59849
  const TextCommands = {
60036
59850
  "text/style-bold": "bold",
60037
59851
  "text/style-italic": "italic",
@@ -60047,7 +59861,7 @@ $$${mathData.mathjaxText}$$
60047
59861
  const styleCommands = blockCommands.filter((command) => styleCommandsSet.has(command.id));
60048
59862
  return styleCommands;
60049
59863
  }
60050
- function executeShortcut$1(editor, style2) {
59864
+ function executeShortcut(editor, style2) {
60051
59865
  if (!editor.isWritable()) {
60052
59866
  return false;
60053
59867
  }
@@ -60092,37 +59906,13 @@ $$${mathData.mathjaxText}$$
60092
59906
  return shortcuts2;
60093
59907
  };
60094
59908
  const TextStyleShortcuts = {
60095
- "CtrlOrCmd+B": (editor) => executeShortcut$1(editor, "style-bold"),
60096
- "CtrlOrCmd+I": (editor) => executeShortcut$1(editor, "style-italic"),
60097
- "CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "style-underline"),
60098
- "CtrlOrCmd+D": (editor) => executeShortcut$1(editor, "style-strikethrough"),
60099
- "CtrlOrCmd+K": (editor) => executeShortcut$1(editor, "link"),
59909
+ "CtrlOrCmd+B": (editor) => executeShortcut(editor, "style-bold"),
59910
+ "CtrlOrCmd+I": (editor) => executeShortcut(editor, "style-italic"),
59911
+ "CtrlOrCmd+U": (editor) => executeShortcut(editor, "style-underline"),
59912
+ "CtrlOrCmd+D": (editor) => executeShortcut(editor, "style-strikethrough"),
59913
+ "CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
60100
59914
  ...headingShortcut()
60101
59915
  };
60102
- function executeShortcut(editor) {
60103
- if (!editor.isWritable()) {
60104
- return false;
60105
- }
60106
- const range = editor.selection.range;
60107
- if (range.isCollapsed()) {
60108
- return false;
60109
- }
60110
- editor.undoManager.runInGroup(() => {
60111
- const colors = getColorsFromLocalStorage(editor);
60112
- colors.forEach((color, idx) => {
60113
- if (color === null) {
60114
- return;
60115
- }
60116
- const type = idx === 0 ? "color" : "backgroundColor";
60117
- editorRangeSetColor(editor, type, color, () => {
60118
- });
60119
- });
60120
- });
60121
- return true;
60122
- }
60123
- const TextColorShortcuts = {
60124
- "CtrlOrCmd+Alt+KeyH": (editor) => executeShortcut(editor)
60125
- };
60126
59916
  const zhCN$p = {
60127
59917
  quickMenu: {
60128
59918
  basic: {
@@ -60878,7 +60668,7 @@ $$${mathData.mathjaxText}$$
60878
60668
  __publicField(this, "updateButtonColor", (range) => {
60879
60669
  const currentTextColor = editorRangeGetColor(this.editor, range, this.getEmptyTextBlockColor);
60880
60670
  this.colorItem.setCurrentTextColors(currentTextColor);
60881
- const lastButtonColor = getColorsFromLocalStorage(this.editor);
60671
+ const lastButtonColor = this.colorItem.getColorsFromLocalStorage();
60882
60672
  this.colorItem.setCurrentButtonColor(lastButtonColor);
60883
60673
  });
60884
60674
  __publicField(this, "setActiveAttribute", (type, value) => {
@@ -72290,6 +72080,16 @@ ${codeText}
72290
72080
  return false;
72291
72081
  }
72292
72082
  }
72083
+ const existsAutoSuggest = document.querySelector(".auto-suggest-menu");
72084
+ if (existsAutoSuggest) {
72085
+ const root2 = existsAutoSuggest.closest("[data-tippy-root]");
72086
+ if (root2) {
72087
+ const visibility = window.getComputedStyle(root2).visibility;
72088
+ if (visibility === "visible") {
72089
+ return false;
72090
+ }
72091
+ }
72092
+ }
72293
72093
  this.button.clearCheckedState();
72294
72094
  this.button.show(docs);
72295
72095
  this.event = event;
@@ -74871,19 +74671,7 @@ ${content}
74871
74671
  const containerId = getContainerId(container);
74872
74672
  for (let i = 0; i < images.length; i++) {
74873
74673
  const image = images[i];
74874
- const block = await insertEmptyEmbedBlock(editor, "image", containerId, insertIndex + i, { file: image });
74875
- if (block) {
74876
- const commandData = {
74877
- block,
74878
- image
74879
- };
74880
- const item = {
74881
- id: "replace-image",
74882
- name: "Replace image",
74883
- data: commandData
74884
- };
74885
- executeEmbedBlockCommand(editor, block, "image", item);
74886
- }
74674
+ await insertEmptyEmbedBlock(editor, "image", containerId, insertIndex + i, { file: image });
74887
74675
  }
74888
74676
  }
74889
74677
  }
@@ -88621,11 +88409,9 @@ ${data2.flowchartText}
88621
88409
  FindReplaceShortcuts,
88622
88410
  BlockPaddingShortcuts,
88623
88411
  TextStyleShortcuts,
88624
- AlignShortcuts,
88625
88412
  AutoLinkShortcuts,
88626
88413
  DefaultShortcuts,
88627
88414
  ListBlockShortcuts,
88628
- TextColorShortcuts,
88629
88415
  ...options.shortcuts || []
88630
88416
  ],
88631
88417
  colors: [
@@ -88744,7 +88530,7 @@ ${data2.flowchartText}
88744
88530
  }
88745
88531
  }
88746
88532
  });
88747
- editor.version = "2.2.23-beta.1";
88533
+ editor.version = "2.2.24";
88748
88534
  return editor;
88749
88535
  }
88750
88536
  function isDoc(doc2) {
@@ -88839,7 +88625,7 @@ ${data2.flowchartText}
88839
88625
  });
88840
88626
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88841
88627
  OnesEditorToolbar.register(editor);
88842
- editor.version = "2.2.23-beta.1";
88628
+ editor.version = "2.2.24";
88843
88629
  return editor;
88844
88630
  }
88845
88631
  async function showDocVersions(editor, options, serverUrl) {
@@ -134577,7 +134363,6 @@ ${data2.flowchartText}
134577
134363
  exports2.AbstractProvider = AbstractProvider;
134578
134364
  exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
134579
134365
  exports2.AlignProvider = AlignProvider;
134580
- exports2.AlignShortcuts = AlignShortcuts;
134581
134366
  exports2.AnchorBox = AnchorBox;
134582
134367
  exports2.AuthError = AuthError;
134583
134368
  exports2.AuthHeader = AuthHeader;
@@ -134696,7 +134481,6 @@ ${data2.flowchartText}
134696
134481
  exports2.TextBlock = TextBlock;
134697
134482
  exports2.TextBox = TextBox;
134698
134483
  exports2.TextColorItem = TextColorItem;
134699
- exports2.TextColorShortcuts = TextColorShortcuts;
134700
134484
  exports2.TextCommandProvider = TextCommandProvider;
134701
134485
  exports2.TextScriptProvider = TextScriptProvider;
134702
134486
  exports2.TextStyleShortcuts = TextStyleShortcuts;
@@ -134940,7 +134724,6 @@ ${data2.flowchartText}
134940
134724
  exports2.getBlockTextLength = getBlockTextLength$6;
134941
134725
  exports2.getBlockTools = getBlockTools;
134942
134726
  exports2.getBlockType = getBlockType;
134943
- exports2.getBlocksBetween = getBlocksBetween;
134944
134727
  exports2.getBlocksWidth = getBlocksWidth;
134945
134728
  exports2.getBoxContent = getBoxContent;
134946
134729
  exports2.getBoxId = getBoxId;
@@ -135120,7 +134903,7 @@ ${data2.flowchartText}
135120
134903
  exports2.loadJs = loadJs;
135121
134904
  exports2.loadJsPromise = loadJsPromise;
135122
134905
  exports2.lockers = lockers;
135123
- exports2.logger = logger$4e;
134906
+ exports2.logger = logger$4d;
135124
134907
  exports2.markdownToDoc = markdownToDoc;
135125
134908
  exports2.mergeCommands = mergeCommands;
135126
134909
  exports2.mergeDocs = mergeDocs;