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

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) {
@@ -10687,7 +10687,7 @@ var __publicField = (obj, key, value) => {
10687
10687
  if (this.scrolling) {
10688
10688
  return;
10689
10689
  }
10690
- logger$4A.debug(`scroll direction: ${direction}`);
10690
+ logger$4z.debug(`scroll direction: ${direction}`);
10691
10691
  this.cancelScroll = continuousScroll(scrollElement, {
10692
10692
  direction,
10693
10693
  step
@@ -10938,7 +10938,7 @@ var __publicField = (obj, key, value) => {
10938
10938
  const colorIndex = Math.abs(typeof content === "string" && content.trim() ? hashCode(content.trim()) : 0) % ColorNames.length;
10939
10939
  return ColorNames[colorIndex];
10940
10940
  }
10941
- const logger$4z = getLogger("container");
10941
+ const logger$4y = getLogger("container");
10942
10942
  function isContainer(elem) {
10943
10943
  return elem.getAttribute("data-type") === "editor-container";
10944
10944
  }
@@ -10950,9 +10950,9 @@ var __publicField = (obj, key, value) => {
10950
10950
  }
10951
10951
  function getContainerId(container) {
10952
10952
  const id = container.getAttribute("data-container-id");
10953
- assert(logger$4z, id, "no id for container");
10953
+ assert(logger$4y, id, "no id for container");
10954
10954
  if (isRootContainer(container)) {
10955
- assert(logger$4z, id === "root", `invalid root container id, : ${id}`);
10955
+ assert(logger$4y, id === "root", `invalid root container id, : ${id}`);
10956
10956
  }
10957
10957
  return id;
10958
10958
  }
@@ -10963,7 +10963,7 @@ var __publicField = (obj, key, value) => {
10963
10963
  function generateEditorContainerId(containerId) {
10964
10964
  return `ones-editor-container-${containerId}`;
10965
10965
  }
10966
- const logger$4y = getLogger("element");
10966
+ const logger$4x = getLogger("element");
10967
10967
  function createContainerElement(parent, type, containerId) {
10968
10968
  const container = createElement("div", [type], parent);
10969
10969
  container.setAttribute("data-type", "editor-container");
@@ -10974,7 +10974,7 @@ var __publicField = (obj, key, value) => {
10974
10974
  }
10975
10975
  function getContainerById(editor, containerId) {
10976
10976
  const container = editor.rootElement.querySelector(`[data-container-id=${containerId}]`);
10977
- assert(logger$4y, container, `no container: ${containerId}`);
10977
+ assert(logger$4x, container, `no container: ${containerId}`);
10978
10978
  return container;
10979
10979
  }
10980
10980
  function getExistsContainerById(editor, containerId) {
@@ -10983,7 +10983,7 @@ var __publicField = (obj, key, value) => {
10983
10983
  }
10984
10984
  function getContainerBlocksElement(container) {
10985
10985
  const blocks = container.querySelector(":scope > .container-blocks");
10986
- assert(logger$4y, blocks, "no container blocks element");
10986
+ assert(logger$4x, blocks, "no container blocks element");
10987
10987
  return blocks;
10988
10988
  }
10989
10989
  function getContainerToolsElement(container) {
@@ -10996,11 +10996,11 @@ var __publicField = (obj, key, value) => {
10996
10996
  function isContainerBlocksElement(element) {
10997
10997
  return element.classList.contains("container-blocks");
10998
10998
  }
10999
- const logger$4x = getLogger("container-children");
10999
+ const logger$4w = getLogger("container-children");
11000
11000
  function getChildBlocks(container, traverseChild) {
11001
11001
  const content = getContainerBlocksElement(container);
11002
11002
  const blocks = Array.from(content.children);
11003
- assert(logger$4x, blocks.length > 0, "container have not any child block");
11003
+ assert(logger$4w, blocks.length > 0, "container have not any child block");
11004
11004
  if (traverseChild) {
11005
11005
  const { condition, editor } = traverseChild;
11006
11006
  return blocks.reduce((result, block) => {
@@ -11023,7 +11023,7 @@ var __publicField = (obj, key, value) => {
11023
11023
  }
11024
11024
  function getFirstChildBlock(container) {
11025
11025
  const block = container.querySelector(":scope > .container-blocks > div[data-type=editor-block]");
11026
- assert(logger$4x, block, "container have not any child block");
11026
+ assert(logger$4w, block, "container have not any child block");
11027
11027
  return block;
11028
11028
  }
11029
11029
  function getLastChildBlock(container) {
@@ -11035,14 +11035,14 @@ var __publicField = (obj, key, value) => {
11035
11035
  }
11036
11036
  function getBlockByIndex(container, blockIndex) {
11037
11037
  const block = getChildBlocks(container)[blockIndex];
11038
- assert(logger$4x, block, `container have not block at index ${blockIndex}`);
11038
+ assert(logger$4w, block, `container have not block at index ${blockIndex}`);
11039
11039
  return block;
11040
11040
  }
11041
11041
  function findBlockByIndex(container, blockIndex) {
11042
11042
  var _a;
11043
11043
  return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
11044
11044
  }
11045
- const logger$4w = getLogger("block-dom");
11045
+ const logger$4v = getLogger("block-dom");
11046
11046
  function isBlock$1(node) {
11047
11047
  if (!(node instanceof HTMLDivElement)) {
11048
11048
  return false;
@@ -11063,12 +11063,12 @@ var __publicField = (obj, key, value) => {
11063
11063
  }
11064
11064
  function getBlockId(block) {
11065
11065
  const { id } = block;
11066
- assert(logger$4w, id, "no block id");
11066
+ assert(logger$4v, id, "no block id");
11067
11067
  return id;
11068
11068
  }
11069
11069
  function getBlockType(block) {
11070
11070
  const type = block.getAttribute("data-block-type");
11071
- assert(logger$4w, type, "invalid block dom, no data-type");
11071
+ assert(logger$4v, type, "invalid block dom, no data-type");
11072
11072
  return type;
11073
11073
  }
11074
11074
  function getParentBlock(node) {
@@ -11091,12 +11091,12 @@ var __publicField = (obj, key, value) => {
11091
11091
  }
11092
11092
  function getParentContainer(block) {
11093
11093
  const container = block.closest("div[data-type=editor-container]");
11094
- assert(logger$4w, container, "failed to get block container");
11094
+ assert(logger$4v, container, "failed to get block container");
11095
11095
  return container;
11096
11096
  }
11097
11097
  function getBlockContent(block) {
11098
11098
  const content = block.querySelector(":scope >div[data-type=block-content]");
11099
- assert(logger$4w, content, "no block content");
11099
+ assert(logger$4v, content, "no block content");
11100
11100
  return content;
11101
11101
  }
11102
11102
  function getBlockTools(block) {
@@ -11105,7 +11105,7 @@ var __publicField = (obj, key, value) => {
11105
11105
  tools = createElement("div", [], block);
11106
11106
  tools.setAttribute("data-type", "block-tools");
11107
11107
  }
11108
- assert(logger$4w, tools, "no block tools");
11108
+ assert(logger$4v, tools, "no block tools");
11109
11109
  return tools;
11110
11110
  }
11111
11111
  function getExistsBlockTools(block) {
@@ -11126,7 +11126,7 @@ var __publicField = (obj, key, value) => {
11126
11126
  function createBlockElement(editor, path, data2) {
11127
11127
  const blockData = editor.editorDecorators.decorateBlock(path, data2);
11128
11128
  const { id, type } = blockData;
11129
- assert(logger$4w, id, "no block id");
11129
+ assert(logger$4v, id, "no block id");
11130
11130
  const elem = createElement("div", [`${type}-block`], null);
11131
11131
  elem.id = id;
11132
11132
  elem.setAttribute("data-type", "editor-block");
@@ -11164,7 +11164,7 @@ var __publicField = (obj, key, value) => {
11164
11164
  }
11165
11165
  function getBoxTypeFromElement(box) {
11166
11166
  const type = box.getAttribute("data-box-type");
11167
- assert(logger$4w, type, "not a valid box element, no type");
11167
+ assert(logger$4v, type, "not a valid box element, no type");
11168
11168
  return type;
11169
11169
  }
11170
11170
  function isBox(node) {
@@ -11175,7 +11175,7 @@ var __publicField = (obj, key, value) => {
11175
11175
  }
11176
11176
  function getBoxId(box) {
11177
11177
  const { id } = box;
11178
- assert(logger$4w, id, "no box id");
11178
+ assert(logger$4v, id, "no box id");
11179
11179
  return id;
11180
11180
  }
11181
11181
  function getParentBox(node) {
@@ -11197,7 +11197,7 @@ var __publicField = (obj, key, value) => {
11197
11197
  }
11198
11198
  function getBoxContent(box) {
11199
11199
  const content = box.querySelector("span[data-type=box-content]");
11200
- assert(logger$4w, content, "invalid box dom, no content");
11200
+ assert(logger$4v, content, "invalid box dom, no content");
11201
11201
  return content;
11202
11202
  }
11203
11203
  function createInsertionElement(type, id, attributes) {
@@ -11219,7 +11219,7 @@ var __publicField = (obj, key, value) => {
11219
11219
  }
11220
11220
  function getInsertionContent(insertion) {
11221
11221
  const content = insertion.querySelector("span[data-type=insertion-content]");
11222
- assert(logger$4w, content, "invalid insertion-child dom, no content");
11222
+ assert(logger$4v, content, "invalid insertion-child dom, no content");
11223
11223
  return content;
11224
11224
  }
11225
11225
  function getPrevBlock(block) {
@@ -11242,44 +11242,31 @@ var __publicField = (obj, key, value) => {
11242
11242
  }
11243
11243
  return null;
11244
11244
  }
11245
- function getPrevVisibleBlock(block, matcher) {
11246
- const mergedMatcher = matcher || (() => true);
11245
+ function getPrevVisibleBlock(block) {
11247
11246
  let prev = block.previousElementSibling;
11248
11247
  while (prev) {
11249
- if (isBlock$1(prev) && isVisibleBlock(prev) && mergedMatcher(prev)) {
11248
+ if (isBlock$1(prev) && isVisibleBlock(prev)) {
11250
11249
  return prev;
11251
11250
  }
11252
11251
  prev = prev.previousElementSibling;
11253
11252
  }
11254
11253
  return null;
11255
11254
  }
11256
- function getNextVisibleBlock(block, matcher) {
11257
- const mergedMatcher = matcher || (() => true);
11255
+ function getNextVisibleBlock(block) {
11258
11256
  let next2 = block.nextElementSibling;
11259
11257
  while (next2) {
11260
- if (isBlock$1(next2) && isVisibleBlock(next2) && mergedMatcher(next2)) {
11258
+ if (isBlock$1(next2) && isVisibleBlock(next2)) {
11261
11259
  return next2;
11262
11260
  }
11263
11261
  next2 = next2.nextElementSibling;
11264
11262
  }
11265
11263
  return null;
11266
11264
  }
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
11265
  function getBlockIndex(block) {
11279
11266
  const container = getParentContainer(block);
11280
11267
  const children = getChildBlocks(container);
11281
11268
  const index2 = children.indexOf(block);
11282
- assert(logger$4w, index2 !== -1, "invalid block & container dom, failed to get block index");
11269
+ assert(logger$4v, index2 !== -1, "invalid block & container dom, failed to get block index");
11283
11270
  return index2;
11284
11271
  }
11285
11272
  function isInBlock(target) {
@@ -11304,18 +11291,18 @@ var __publicField = (obj, key, value) => {
11304
11291
  function isTitleBlock$2(block) {
11305
11292
  return block.hasAttribute("data-document-title");
11306
11293
  }
11307
- const logger$4v = getLogger("block-class");
11294
+ const logger$4u = getLogger("block-class");
11308
11295
  function getBlockClass(editor, block) {
11309
11296
  return editor.editorBlocks.getBlockClass(getBlockType(block));
11310
11297
  }
11311
11298
  function getTextBlockClass(editor, block) {
11312
11299
  const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
11313
- assert(logger$4v, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
11300
+ assert(logger$4u, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
11314
11301
  return text2;
11315
11302
  }
11316
11303
  function getComplexBlockClass(editor, block) {
11317
11304
  const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
11318
- assert(logger$4v, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
11305
+ assert(logger$4u, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
11319
11306
  return complex;
11320
11307
  }
11321
11308
  function getBlockClassByType(editor, type) {
@@ -11336,7 +11323,7 @@ var __publicField = (obj, key, value) => {
11336
11323
  function getBlockKind(editor, block) {
11337
11324
  return getBlockClass(editor, block).blockKind;
11338
11325
  }
11339
- const logger$4u = getLogger("text-block-child");
11326
+ const logger$4t = getLogger("text-block-child");
11340
11327
  function isTextBlockContentChild(elem) {
11341
11328
  if (elem.tagName !== "SPAN") {
11342
11329
  return false;
@@ -11344,14 +11331,14 @@ var __publicField = (obj, key, value) => {
11344
11331
  return true;
11345
11332
  }
11346
11333
  function isTextBlockContentBoxChild(elem) {
11347
- assert(logger$4u, isTextBlockContentChild(elem), "not a valid text child");
11334
+ assert(logger$4t, isTextBlockContentChild(elem), "not a valid text child");
11348
11335
  if (elem.getAttribute("data-type") === "editor-box") {
11349
11336
  return true;
11350
11337
  }
11351
11338
  return false;
11352
11339
  }
11353
11340
  function isTextBlockContentInsertionChild(elem) {
11354
- assert(logger$4u, isTextBlockContentChild(elem), "not a valid text child");
11341
+ assert(logger$4t, isTextBlockContentChild(elem), "not a valid text child");
11355
11342
  if (elem.getAttribute("data-type") === "editor-insertion") {
11356
11343
  return true;
11357
11344
  }
@@ -11361,7 +11348,7 @@ var __publicField = (obj, key, value) => {
11361
11348
  return !isTextBlockContentBoxChild(elem) && !isTextBlockContentInsertionChild(elem);
11362
11349
  }
11363
11350
  function getTextBlockContentChildType(child) {
11364
- assert(logger$4u, isTextBlockContentChild(child), "not a valid text child");
11351
+ assert(logger$4t, isTextBlockContentChild(child), "not a valid text child");
11365
11352
  if (isTextBlockContentBoxChild(child)) {
11366
11353
  return "box";
11367
11354
  }
@@ -11376,15 +11363,15 @@ var __publicField = (obj, key, value) => {
11376
11363
  return 0;
11377
11364
  if (type === "box")
11378
11365
  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");
11366
+ assert(logger$4t, child.textContent !== null, "text block content is undefined");
11367
+ assert(logger$4t, child.textContent.length >= 0, "text block content length is negative");
11381
11368
  return child.textContent.length;
11382
11369
  }
11383
11370
  function getTextBlockContentChildren(block) {
11384
11371
  const content = getBlockContent(block);
11385
11372
  const children = Array.from(content.children);
11386
11373
  children.forEach((child) => {
11387
- assert(logger$4u, isTextBlockContentChild(child), "not a valid text child");
11374
+ assert(logger$4t, isTextBlockContentChild(child), "not a valid text child");
11388
11375
  });
11389
11376
  return children;
11390
11377
  }
@@ -11413,17 +11400,17 @@ var __publicField = (obj, key, value) => {
11413
11400
  };
11414
11401
  }
11415
11402
  const offset = blockOffset - start;
11416
- assert(logger$4u, offset > 0, "invalid offset value");
11417
- assert(logger$4u, !isTextBlockContentBoxChild(child), "invalid box child");
11403
+ assert(logger$4t, offset > 0, "invalid offset value");
11404
+ assert(logger$4t, !isTextBlockContentBoxChild(child), "invalid box child");
11418
11405
  return {
11419
11406
  prev: child,
11420
11407
  next: child,
11421
11408
  offset
11422
11409
  };
11423
11410
  }
11424
- assert(logger$4u, false, `invalid block child at position: ${blockOffset}`);
11411
+ assert(logger$4t, false, `invalid block child at position: ${blockOffset}`);
11425
11412
  }
11426
- const logger$4t = getLogger("block-path");
11413
+ const logger$4s = getLogger("block-path");
11427
11414
  function getBlockPath(block) {
11428
11415
  const ret = [];
11429
11416
  let current = block;
@@ -11437,26 +11424,26 @@ var __publicField = (obj, key, value) => {
11437
11424
  return ret;
11438
11425
  }
11439
11426
  const parentBlock = getParentBlock(container);
11440
- assert(logger$4t, parentBlock, "no parent block");
11427
+ assert(logger$4s, parentBlock, "no parent block");
11441
11428
  current = parentBlock;
11442
11429
  }
11443
- assert(logger$4t, false, "no parent block");
11430
+ assert(logger$4s, false, "no parent block");
11444
11431
  return [];
11445
11432
  }
11446
- const logger$4s = getLogger("child-container-path");
11433
+ const logger$4r = getLogger("child-container-path");
11447
11434
  function getContainerBlockPath(container) {
11448
11435
  if (isRootContainer(container)) {
11449
11436
  return [];
11450
11437
  }
11451
11438
  const parentBlock = getParentBlock(container);
11452
- assert(logger$4s, parentBlock, "no parent block");
11439
+ assert(logger$4r, parentBlock, "no parent block");
11453
11440
  return getBlockPath(parentBlock);
11454
11441
  }
11455
- const logger$4r = getLogger("load-blocks");
11442
+ const logger$4q = getLogger("load-blocks");
11456
11443
  function loadBlocks(editor, container, path) {
11457
11444
  const containerId = getContainerId(container);
11458
11445
  const blocks = getContainerBlocks$1(container, editor.doc);
11459
- assert(logger$4r, blocks.length > 0, "no blocks in container");
11446
+ assert(logger$4q, blocks.length > 0, "no blocks in container");
11460
11447
  const fragment = document.createDocumentFragment();
11461
11448
  blocks.forEach((b, index2) => {
11462
11449
  const block = editor.editorBlocks.createBlock([...path, { containerId, blockIndex: index2 }], container, b);
@@ -11472,7 +11459,7 @@ var __publicField = (obj, key, value) => {
11472
11459
  return block;
11473
11460
  }
11474
11461
  const blocks = getChildBlocks(container);
11475
- assert(logger$4r, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
11462
+ assert(logger$4q, blockIndex >= 0 && blockIndex <= blocks.length, "invalid block index");
11476
11463
  if (blockIndex === blocks.length) {
11477
11464
  containerBlocksElement.appendChild(block);
11478
11465
  } else {
@@ -11490,7 +11477,7 @@ var __publicField = (obj, key, value) => {
11490
11477
  insertBlockAt(container, blockIndex, block);
11491
11478
  return block;
11492
11479
  }
11493
- const logger$4q = getLogger("root-container");
11480
+ const logger$4p = getLogger("root-container");
11494
11481
  const MIN_DISTANCE_THRESHOLD$2 = 3;
11495
11482
  class RootContainer {
11496
11483
  constructor(editor, rootContainer) {
@@ -11518,7 +11505,7 @@ var __publicField = (obj, key, value) => {
11518
11505
  this.editor.selection.updateSelection(null);
11519
11506
  this.editor.emit("resize", this.editor);
11520
11507
  } catch (err) {
11521
- logger$4q.warn(`failed to update selection while container resizing: ${err.message}`);
11508
+ logger$4p.warn(`failed to update selection while container resizing: ${err.message}`);
11522
11509
  }
11523
11510
  });
11524
11511
  __publicField(this, "handleClick", (event) => {
@@ -11551,7 +11538,7 @@ var __publicField = (obj, key, value) => {
11551
11538
  const box = getParentBox(elem);
11552
11539
  if (box) {
11553
11540
  const block2 = getParentBlock(box);
11554
- assert(logger$4q, block2, "no parent block");
11541
+ assert(logger$4p, block2, "no parent block");
11555
11542
  (_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
11556
11543
  return;
11557
11544
  }
@@ -11606,7 +11593,7 @@ var __publicField = (obj, key, value) => {
11606
11593
  this.editor.input.focus({ preventScroll: true });
11607
11594
  });
11608
11595
  __publicField(this, "handleMouseMove", (event) => {
11609
- assert(logger$4q, this.mouseDownEvent, "no mouse down event");
11596
+ assert(logger$4p, this.mouseDownEvent, "no mouse down event");
11610
11597
  if (ensureIsMobileEvent(this.mouseDownEvent))
11611
11598
  return;
11612
11599
  const deltaX = event.x - this.mouseDownEvent.x;
@@ -11722,7 +11709,7 @@ var __publicField = (obj, key, value) => {
11722
11709
  loadBlocks(editor, container, path);
11723
11710
  return container;
11724
11711
  }
11725
- const logger$4p = getLogger("block");
11712
+ const logger$4o = getLogger("block");
11726
11713
  function getBlockTextLength$6(editor, block) {
11727
11714
  return getBlockClass(editor, block).getBlockTextLength(block);
11728
11715
  }
@@ -11741,7 +11728,7 @@ var __publicField = (obj, key, value) => {
11741
11728
  return block;
11742
11729
  }
11743
11730
  const parent = getParentBlock(container);
11744
- assert(logger$4p, parent, "no parent block exists for child container");
11731
+ assert(logger$4o, parent, "no parent block exists for child container");
11745
11732
  block = parent;
11746
11733
  }
11747
11734
  }
@@ -11777,7 +11764,7 @@ var __publicField = (obj, key, value) => {
11777
11764
  }
11778
11765
  return fun(editor, block, options);
11779
11766
  } catch (err) {
11780
- logger$4p.debug(`unsupported block type: ${type}`);
11767
+ logger$4o.debug(`unsupported block type: ${type}`);
11781
11768
  return null;
11782
11769
  }
11783
11770
  }
@@ -11797,7 +11784,7 @@ var __publicField = (obj, key, value) => {
11797
11784
  const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
11798
11785
  Object.entries(styles).forEach(([, value]) => {
11799
11786
  const type = typeof value;
11800
- assert(logger$4p, type === "string" || type === "number" || type === "boolean", "invalid style value");
11787
+ assert(logger$4o, type === "string" || type === "number" || type === "boolean", "invalid style value");
11801
11788
  });
11802
11789
  return styles;
11803
11790
  }
@@ -11922,7 +11909,7 @@ var __publicField = (obj, key, value) => {
11922
11909
  }
11923
11910
  return { element: null, blockCommands: [], boxCommands: [] };
11924
11911
  }
11925
- const logger$4o = getLogger("embed-block-common");
11912
+ const logger$4n = getLogger("embed-block-common");
11926
11913
  function isColumnsBlock(block) {
11927
11914
  return getBlockType(block) === "layout";
11928
11915
  }
@@ -11930,9 +11917,9 @@ var __publicField = (obj, key, value) => {
11930
11917
  return getBlockType(block) === "embed";
11931
11918
  }
11932
11919
  function getEmbedType(block) {
11933
- assert(logger$4o, isEmbedBlock(block), "not an embed block");
11920
+ assert(logger$4n, isEmbedBlock(block), "not an embed block");
11934
11921
  const type = block.getAttribute("data-embed-type");
11935
- assert(logger$4o, type, "no embed data type");
11922
+ assert(logger$4n, type, "no embed data type");
11936
11923
  return type;
11937
11924
  }
11938
11925
  function getEmbedClassFromBlock(editor, block) {
@@ -11998,10 +11985,10 @@ var __publicField = (obj, key, value) => {
11998
11985
  data: (_c = overrideOptions == null ? void 0 : overrideOptions.data) != null ? _c : data2
11999
11986
  });
12000
11987
  }
12001
- const logger$4n = getLogger("execute-block-command");
11988
+ const logger$4m = getLogger("execute-block-command");
12002
11989
  function executeEmbedBlockCommand(editor, block, commandGroup, item) {
12003
11990
  var _a;
12004
- assert(logger$4n, isEmbedBlock(block), "not a embed block");
11991
+ assert(logger$4m, isEmbedBlock(block), "not a embed block");
12005
11992
  const embedType = getEmbedType(block);
12006
11993
  const embed = getEmbedClassByType(editor, embedType);
12007
11994
  if (!embed.getOptions) {
@@ -12034,14 +12021,14 @@ var __publicField = (obj, key, value) => {
12034
12021
  }
12035
12022
  return void 0;
12036
12023
  }
12037
- const logger$4m = getLogger("block-class");
12024
+ const logger$4l = getLogger("block-class");
12038
12025
  function isHeadingBlock$1(block) {
12039
12026
  return !!block.getAttribute("data-style-heading");
12040
12027
  }
12041
12028
  function getBlockHeading(block) {
12042
12029
  var _a;
12043
12030
  const heading = Number.parseInt((_a = block.getAttribute("data-style-heading")) != null ? _a : "", 10);
12044
- assert(logger$4m, heading, "not a heading block");
12031
+ assert(logger$4l, heading, "not a heading block");
12045
12032
  return heading;
12046
12033
  }
12047
12034
  function isExpandedHeadingBlock(block) {
@@ -12052,7 +12039,7 @@ var __publicField = (obj, key, value) => {
12052
12039
  }
12053
12040
  function getHeadingBlockChildren(block, oldHeading) {
12054
12041
  if (!oldHeading) {
12055
- assert(logger$4m, isHeadingBlock$1(block), "not a heading block");
12042
+ assert(logger$4l, isHeadingBlock$1(block), "not a heading block");
12056
12043
  }
12057
12044
  const children = [];
12058
12045
  const heading = oldHeading != null ? oldHeading : getBlockHeading(block);
@@ -12082,7 +12069,7 @@ var __publicField = (obj, key, value) => {
12082
12069
  }
12083
12070
  return children;
12084
12071
  }
12085
- const logger$4l = getLogger("complex-block-position");
12072
+ const logger$4k = getLogger("complex-block-position");
12086
12073
  class EditorComplexBlockPosition {
12087
12074
  constructor(block, childContainerId, custom) {
12088
12075
  __publicField(this, "blockId");
@@ -12091,7 +12078,7 @@ var __publicField = (obj, key, value) => {
12091
12078
  if (block instanceof HTMLElement) {
12092
12079
  this.blockId = getBlockId(block);
12093
12080
  } else {
12094
- assert(logger$4l, typeof block === "string", `not a valid block id: ${block}`);
12081
+ assert(logger$4k, typeof block === "string", `not a valid block id: ${block}`);
12095
12082
  this.blockId = block;
12096
12083
  }
12097
12084
  this.childContainerId = childContainerId;
@@ -12103,7 +12090,7 @@ var __publicField = (obj, key, value) => {
12103
12090
  return false;
12104
12091
  }
12105
12092
  }
12106
- const logger$4k = getLogger("simple-block-position");
12093
+ const logger$4j = getLogger("simple-block-position");
12107
12094
  class EditorSimpleBlockPosition {
12108
12095
  constructor(block, offset, type) {
12109
12096
  __publicField(this, "blockId");
@@ -12112,7 +12099,7 @@ var __publicField = (obj, key, value) => {
12112
12099
  if (block instanceof HTMLElement) {
12113
12100
  this.blockId = getBlockId(block);
12114
12101
  } else {
12115
- assert(logger$4k, typeof block === "string", `not a valid block id: ${block}`);
12102
+ assert(logger$4j, typeof block === "string", `not a valid block id: ${block}`);
12116
12103
  this.blockId = block;
12117
12104
  }
12118
12105
  this.offset = offset;
@@ -12122,7 +12109,7 @@ var __publicField = (obj, key, value) => {
12122
12109
  return true;
12123
12110
  }
12124
12111
  }
12125
- const logger$4j = getLogger("editor-position");
12112
+ const logger$4i = getLogger("editor-position");
12126
12113
  function createSimpleBlockPosition(block, offset, type) {
12127
12114
  return new EditorSimpleBlockPosition(block, offset, type);
12128
12115
  }
@@ -12144,7 +12131,7 @@ var __publicField = (obj, key, value) => {
12144
12131
  }
12145
12132
  const block1 = editor.getBlockById(pos1.blockId);
12146
12133
  const block2 = editor.getBlockById(pos2.blockId);
12147
- assert(logger$4j, block1 !== block2, "comparePosition: blocks are the same");
12134
+ assert(logger$4i, block1 !== block2, "comparePosition: blocks are the same");
12148
12135
  return compareElement(block1, block2);
12149
12136
  }
12150
12137
  if (isComplexBlockPosition(pos1) && isComplexBlockPosition(pos2)) {
@@ -12155,13 +12142,13 @@ var __publicField = (obj, key, value) => {
12155
12142
  }
12156
12143
  const container1 = editor.getContainerById(p1.childContainerId);
12157
12144
  const container2 = editor.getContainerById(p2.childContainerId);
12158
- assert(logger$4j, container1 !== container2, "comparePosition: containers are the same");
12145
+ assert(logger$4i, container1 !== container2, "comparePosition: containers are the same");
12159
12146
  return compareElement(container1, container2);
12160
12147
  }
12161
- assert(logger$4j, false, "invalid ");
12148
+ assert(logger$4i, false, "invalid ");
12162
12149
  return 0;
12163
12150
  }
12164
- const logger$4i = getLogger("simple-range");
12151
+ const logger$4h = getLogger("simple-range");
12165
12152
  class EditorSimpleSelectionRange {
12166
12153
  constructor(editor, options) {
12167
12154
  __publicField(this, "editor");
@@ -12210,11 +12197,11 @@ var __publicField = (obj, key, value) => {
12210
12197
  const { editor } = this;
12211
12198
  const startBlock = editor.getBlockById(this.start.blockId);
12212
12199
  const endBlock = editor.getBlockById(this.end.blockId);
12213
- assert(logger$4i, startBlock, "no start block");
12214
- assert(logger$4i, endBlock, "no end block");
12200
+ assert(logger$4h, startBlock, "no start block");
12201
+ assert(logger$4h, endBlock, "no end block");
12215
12202
  const startContainer = getParentContainer(startBlock);
12216
12203
  const endContainer = getParentContainer(endBlock);
12217
- assert(logger$4i, startContainer === endContainer, "invalid range");
12204
+ assert(logger$4h, startContainer === endContainer, "invalid range");
12218
12205
  const ret = [];
12219
12206
  if (startBlock === endBlock) {
12220
12207
  ret.push({
@@ -12225,7 +12212,7 @@ var __publicField = (obj, key, value) => {
12225
12212
  } else {
12226
12213
  const startIndex = getBlockIndex(startBlock);
12227
12214
  const endIndex = getBlockIndex(endBlock);
12228
- assert(logger$4i, startIndex < endIndex, "invalid range, start > index");
12215
+ assert(logger$4h, startIndex < endIndex, "invalid range, start > index");
12229
12216
  ret.push({
12230
12217
  block: startBlock,
12231
12218
  start: this.start,
@@ -12325,7 +12312,7 @@ var __publicField = (obj, key, value) => {
12325
12312
  clearSelection: clearSelection$6,
12326
12313
  convertTo: convertTo$m
12327
12314
  };
12328
- const logger$4h = getLogger("editor-blocks");
12315
+ const logger$4g = getLogger("editor-blocks");
12329
12316
  class EditorBlocks {
12330
12317
  constructor(editor) {
12331
12318
  __publicField(this, "blocks", /* @__PURE__ */ new Map());
@@ -12334,12 +12321,12 @@ var __publicField = (obj, key, value) => {
12334
12321
  registerBlockClass(blockClass) {
12335
12322
  const type = blockClass.blockType;
12336
12323
  const exists = this.blocks.get(type);
12337
- assert(logger$4h, !exists, `duplicated block type: ${type}`);
12324
+ assert(logger$4g, !exists, `duplicated block type: ${type}`);
12338
12325
  this.blocks.set(type, blockClass);
12339
12326
  }
12340
12327
  getBlockClass(type) {
12341
12328
  const exists = this.blocks.get(type);
12342
- assert(logger$4h, exists, `unknown block type: ${type}`);
12329
+ assert(logger$4g, exists, `unknown block type: ${type}`);
12343
12330
  return exists;
12344
12331
  }
12345
12332
  hasBlock(type) {
@@ -12355,7 +12342,7 @@ var __publicField = (obj, key, value) => {
12355
12342
  }
12356
12343
  const content = blockClass.createBlockContent(this.editor, path, container, blockElement, block);
12357
12344
  if (content.parentElement !== blockElement) {
12358
- logger$4h.warn("content parent is not block");
12345
+ logger$4g.warn("content parent is not block");
12359
12346
  blockElement.appendChild(content);
12360
12347
  }
12361
12348
  this.editor.blockHooks.forEach((hook) => {
@@ -12376,7 +12363,7 @@ var __publicField = (obj, key, value) => {
12376
12363
  return newBlock;
12377
12364
  }
12378
12365
  }
12379
- const logger$4g = getLogger("editor-embeds");
12366
+ const logger$4f = getLogger("editor-embeds");
12380
12367
  class EditorEmbeds {
12381
12368
  constructor(editor) {
12382
12369
  __publicField(this, "objects", /* @__PURE__ */ new Map());
@@ -12385,12 +12372,12 @@ var __publicField = (obj, key, value) => {
12385
12372
  registerEmbedClass(embedClass) {
12386
12373
  const type = embedClass.embedType;
12387
12374
  const exists = this.objects.get(type);
12388
- assert(logger$4g, !exists, `duplicated embed object type: ${type}`);
12375
+ assert(logger$4f, !exists, `duplicated embed object type: ${type}`);
12389
12376
  this.objects.set(type, embedClass);
12390
12377
  }
12391
12378
  getEmbedClass(type) {
12392
12379
  const exists = this.objects.get(type);
12393
- assert(logger$4g, exists, `unknown embed type: ${type}`);
12380
+ assert(logger$4f, exists, `unknown embed type: ${type}`);
12394
12381
  return exists;
12395
12382
  }
12396
12383
  getEmbedClassFromBlock(block) {
@@ -12400,12 +12387,12 @@ var __publicField = (obj, key, value) => {
12400
12387
  this.objects.forEach(callback);
12401
12388
  }
12402
12389
  }
12403
- const logger$4f = getLogger("embed-block");
12390
+ const logger$4e = getLogger("embed-block");
12404
12391
  function createBlockContent$6(editor, path, container, blockElement, blockData) {
12405
12392
  const content = createBlockContentElement(blockElement, "div");
12406
- assert(logger$4f, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
12393
+ assert(logger$4e, blockData.type === "embed", `not an embed data: ${JSON.stringify(blockData)}`);
12407
12394
  const embedBlockData = blockData;
12408
- assert(logger$4f, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
12395
+ assert(logger$4e, embedBlockData.embedType && embedBlockData.embedData, `not an embed data: ${JSON.stringify(embedBlockData)}`);
12409
12396
  const embedClass = editor.editorEmbeds.getEmbedClass(embedBlockData.embedType);
12410
12397
  embedClass.createEmbedContent(editor, content, embedBlockData, path, container, blockElement);
12411
12398
  blockElement.setAttribute("data-embed-type", embedBlockData.embedType);
@@ -12433,7 +12420,7 @@ var __publicField = (obj, key, value) => {
12433
12420
  function getCaretRect$4(block, pos) {
12434
12421
  const content = getBlockContent(block);
12435
12422
  const rect = content.getBoundingClientRect();
12436
- assert(logger$4f, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
12423
+ assert(logger$4e, pos.offset === 0 || pos.offset === 1, `invalid offset: ${pos.offset}`);
12437
12424
  if (pos.offset === 1) {
12438
12425
  return new DOMRect(rect.right, rect.top, 0, rect.height);
12439
12426
  }
@@ -12573,18 +12560,18 @@ var __publicField = (obj, key, value) => {
12573
12560
  toStandardDoc: toStandardDoc$2,
12574
12561
  getResources: getResources$2
12575
12562
  };
12576
- const logger$4e = getLogger("complex-block-helper");
12563
+ const logger$4d = getLogger("complex-block-helper");
12577
12564
  function complexBlockGetAllChildContainers(editor, block, options) {
12578
12565
  const blockClass = getComplexBlockClass(editor, block);
12579
12566
  return blockClass.getChildContainers(editor, block, options);
12580
12567
  }
12581
12568
  function complexBlockGetSelectedContainers(editor, block, start, end) {
12582
12569
  if (start.isSimple()) {
12583
- assert(logger$4e, end.isSimple(), "invalid start and end position");
12570
+ assert(logger$4d, end.isSimple(), "invalid start and end position");
12584
12571
  return complexBlockGetAllChildContainers(editor, block);
12585
12572
  }
12586
- assert(logger$4e, !start.isSimple(), "invalid start pos");
12587
- assert(logger$4e, !end.isSimple(), "invalid end pos");
12573
+ assert(logger$4d, !start.isSimple(), "invalid start pos");
12574
+ assert(logger$4d, !end.isSimple(), "invalid end pos");
12588
12575
  const blockClass = getComplexBlockClass(editor, block);
12589
12576
  return blockClass.getSelectedContainers(editor, block, start, end);
12590
12577
  }
@@ -12595,11 +12582,11 @@ var __publicField = (obj, key, value) => {
12595
12582
  const parentComplexBlock = getParentBlock(getParentContainer(childBlock));
12596
12583
  if (!parentComplexBlock)
12597
12584
  return false;
12598
- assert(logger$4e, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12585
+ assert(logger$4d, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12599
12586
  const childContainer = getParentContainer(childBlock);
12600
12587
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock);
12601
12588
  const index2 = childContainers.indexOf(childContainer);
12602
- assert(logger$4e, index2 >= 0, "not valid child container");
12589
+ assert(logger$4d, index2 >= 0, "not valid child container");
12603
12590
  return index2 === 0;
12604
12591
  }
12605
12592
  function complexBlockGetFirstSimpleChild(editor, complexBlock, options) {
@@ -12652,13 +12639,13 @@ var __publicField = (obj, key, value) => {
12652
12639
  return block;
12653
12640
  }
12654
12641
  function findPrevSimpleBlockBeforeChildContainer(editor, childContainer, options) {
12655
- assert(logger$4e, isChildContainer(childContainer), "not a child container");
12642
+ assert(logger$4d, isChildContainer(childContainer), "not a child container");
12656
12643
  const parentComplexBlock = getParentBlock(childContainer);
12657
- assert(logger$4e, parentComplexBlock, "no parent block");
12658
- assert(logger$4e, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12644
+ assert(logger$4d, parentComplexBlock, "no parent block");
12645
+ assert(logger$4d, isComplexKindBlock(editor, parentComplexBlock), "not a complex block");
12659
12646
  const childContainers = complexBlockGetAllChildContainers(editor, parentComplexBlock, options);
12660
12647
  const containerIndex = childContainers.indexOf(childContainer);
12661
- assert(logger$4e, containerIndex !== -1, "child container not found");
12648
+ assert(logger$4d, containerIndex !== -1, "child container not found");
12662
12649
  if (containerIndex === 0) {
12663
12650
  const prevBlock = getPrevBlock(parentComplexBlock);
12664
12651
  if (!prevBlock)
@@ -12676,9 +12663,9 @@ var __publicField = (obj, key, value) => {
12676
12663
  return lastBlock2;
12677
12664
  }
12678
12665
  function complexBlockGetTopChildContainers(editor, complexBlock) {
12679
- assert(logger$4e, isComplexKindBlock(editor, complexBlock), "not a complex block");
12666
+ assert(logger$4d, isComplexKindBlock(editor, complexBlock), "not a complex block");
12680
12667
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
12681
- assert(logger$4e, childContainers.length > 0, "no child container");
12668
+ assert(logger$4d, childContainers.length > 0, "no child container");
12682
12669
  if (childContainers.length === 1) {
12683
12670
  return childContainers;
12684
12671
  }
@@ -12703,9 +12690,9 @@ var __publicField = (obj, key, value) => {
12703
12690
  return ret;
12704
12691
  }
12705
12692
  function complexBlockGetBottomChildContainers(editor, complexBlock) {
12706
- assert(logger$4e, isComplexKindBlock(editor, complexBlock), "not a complex block");
12693
+ assert(logger$4d, isComplexKindBlock(editor, complexBlock), "not a complex block");
12707
12694
  const childContainers = complexBlockGetAllChildContainers(editor, complexBlock);
12708
- assert(logger$4e, childContainers.length > 0, "no child container");
12695
+ assert(logger$4d, childContainers.length > 0, "no child container");
12709
12696
  if (childContainers.length === 1) {
12710
12697
  return childContainers;
12711
12698
  }
@@ -12810,11 +12797,11 @@ var __publicField = (obj, key, value) => {
12810
12797
  return result;
12811
12798
  }
12812
12799
  const anchor = "";
12813
- const logger$4d = getLogger("text-range");
12800
+ const logger$4c = getLogger("text-range");
12814
12801
  function getBlockRangeInfo(block, blockOffset) {
12815
12802
  const getChildRange = (child, offset) => {
12816
12803
  if (isTextBlockContentInsertionChild(child)) {
12817
- assert(logger$4d, offset === 0, `invalid offset for insertion child: ${offset}`);
12804
+ assert(logger$4c, offset === 0, `invalid offset for insertion child: ${offset}`);
12818
12805
  const childOffset = 2;
12819
12806
  return {
12820
12807
  child,
@@ -12823,7 +12810,7 @@ var __publicField = (obj, key, value) => {
12823
12810
  };
12824
12811
  }
12825
12812
  if (isTextBlockContentBoxChild(child)) {
12826
- assert(logger$4d, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
12813
+ assert(logger$4c, offset === 0 || offset === 1, `invalid offset for box: ${offset}`);
12827
12814
  const childOffset = offset === 0 ? 1 : 2;
12828
12815
  return {
12829
12816
  child,
@@ -12832,17 +12819,17 @@ var __publicField = (obj, key, value) => {
12832
12819
  };
12833
12820
  }
12834
12821
  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}`);
12822
+ assert(logger$4c, textNode, "no child node for text child");
12823
+ assert(logger$4c, textNode instanceof Text || textNode instanceof HTMLBRElement, `invalid child for text child, ${textNode.nodeName}`);
12837
12824
  if (textNode instanceof HTMLBRElement) {
12838
- assert(logger$4d, offset >= 0 && offset <= 0, "invalid offset for text child");
12825
+ assert(logger$4c, offset >= 0 && offset <= 0, "invalid offset for text child");
12839
12826
  return {
12840
12827
  child,
12841
12828
  container: textNode,
12842
12829
  offset
12843
12830
  };
12844
12831
  }
12845
- assert(logger$4d, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
12832
+ assert(logger$4c, offset >= 0 && offset <= textNode.data.length, "invalid offset for text child");
12846
12833
  return {
12847
12834
  child,
12848
12835
  container: textNode,
@@ -12871,38 +12858,38 @@ var __publicField = (obj, key, value) => {
12871
12858
  }
12872
12859
  start += childLength;
12873
12860
  }
12874
- assert(logger$4d, false, "failed to get range info");
12861
+ assert(logger$4c, false, "failed to get range info");
12875
12862
  }
12876
12863
  function createChildRange(child, start, end) {
12877
12864
  if (start === end) {
12878
- assert(logger$4d, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
12865
+ assert(logger$4c, isTextBlockContentInsertionChild(child), "only insertion child can be zero offset");
12879
12866
  } else {
12880
- assert(logger$4d, start < end, `invalid start & end: ${start}, ${end}`);
12867
+ assert(logger$4c, start < end, `invalid start & end: ${start}, ${end}`);
12881
12868
  }
12882
12869
  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}`);
12870
+ assert(logger$4c, start === end, `invalid insertion child range offset: ${start}, ${end}`);
12871
+ assert(logger$4c, start === 0, `invalid insertion child range start: ${start}`);
12885
12872
  const insertionElem = child;
12886
- assert(logger$4d, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
12873
+ assert(logger$4c, insertionElem.children.length === 3, `invalid insertion dom, children.length = ${insertionElem.children.length}`);
12887
12874
  const range = createExpandedRange(insertionElem, 1, insertionElem, 2);
12888
12875
  return range;
12889
12876
  }
12890
12877
  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}`);
12878
+ assert(logger$4c, start + 1 === end, `invalid box child range offset: ${start}, ${end}`);
12879
+ assert(logger$4c, start === 0, `invalid box child range start: ${start}`);
12893
12880
  const box = child;
12894
- assert(logger$4d, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
12881
+ assert(logger$4c, box.children.length === 3, `invalid box dom, children.length = ${box.children.length}`);
12895
12882
  const range = createExpandedRange(box, 1, box, 2);
12896
12883
  return range;
12897
12884
  }
12898
12885
  const length = getTextBlockContentChildTextLength(child);
12899
- assert(logger$4d, end <= length, `invalid child end: ${end}, ${length}`);
12886
+ assert(logger$4c, end <= length, `invalid child end: ${end}, ${length}`);
12900
12887
  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}`);
12888
+ assert(logger$4c, textNode instanceof Text, "invalid block text child");
12889
+ assert(logger$4c, textNode.data.length >= end, `invalid range end: ${end}, ${textNode.data.length}`);
12903
12890
  return createExpandedRange(textNode, start, textNode, end);
12904
12891
  }
12905
- const logger$4c = getLogger("caret-rect");
12892
+ const logger$4b = getLogger("caret-rect");
12906
12893
  function getChildClientRects(block, child) {
12907
12894
  if (isBox(child)) {
12908
12895
  const box = child;
@@ -12911,7 +12898,7 @@ var __publicField = (obj, key, value) => {
12911
12898
  const blockContent = getBlockContent(block);
12912
12899
  const lineHeight = Number.parseFloat(window.getComputedStyle(blockContent).lineHeight) || boxContent.getBoundingClientRect().height;
12913
12900
  const rects = Array.from(boxContent.getClientRects());
12914
- assert(logger$4c, rects.length > 0, "no box client rects");
12901
+ assert(logger$4b, rects.length > 0, "no box client rects");
12915
12902
  const blockRect = blockContent.getBoundingClientRect();
12916
12903
  const firstRect = rects[0];
12917
12904
  const lastRect = new DOMRect(blockRect.left, firstRect.bottom, 1, lineHeight);
@@ -12931,22 +12918,22 @@ var __publicField = (obj, key, value) => {
12931
12918
  const rect2 = getLastClientRect(ranges[0].child);
12932
12919
  return new DOMRect(rect2.right, rect2.top, 1, rect2.height);
12933
12920
  }
12934
- assert(logger$4c, ranges[1], "invalid ranges");
12921
+ assert(logger$4b, ranges[1], "invalid ranges");
12935
12922
  const rect = getFirstClientRect(ranges[1].child);
12936
12923
  return new DOMRect(rect.left, rect.top, 1, rect.height);
12937
12924
  }
12938
12925
  let rangeInfo = ranges[0];
12939
- assert(logger$4c, ranges.length >= 1, "failed to get block range");
12926
+ assert(logger$4b, ranges.length >= 1, "failed to get block range");
12940
12927
  if (ranges.length === 1) {
12941
12928
  rangeInfo = ranges[0];
12942
12929
  } else {
12943
- assert(logger$4c, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
12930
+ assert(logger$4b, ranges.length >= 2, `invalid range info length: ${ranges.length}`);
12944
12931
  if (isTextBlockContentInsertionChild(ranges[ranges.length - 1].child)) {
12945
12932
  rangeInfo = ranges[ranges.length - 1];
12946
12933
  const child = rangeInfo.child;
12947
12934
  const content = getInsertionContent(child);
12948
12935
  const rects2 = content.getClientRects();
12949
- assert(logger$4c, rects2.length >= 1, "no client rects for box content");
12936
+ assert(logger$4b, rects2.length >= 1, "no client rects for box content");
12950
12937
  const rect = rects2[rects2.length - 1];
12951
12938
  return new DOMRect(rect.right, rect.y, 1, rect.height);
12952
12939
  }
@@ -12963,9 +12950,9 @@ var __publicField = (obj, key, value) => {
12963
12950
  }
12964
12951
  }
12965
12952
  if (rangeInfo.container instanceof HTMLBRElement) {
12966
- assert(logger$4c, pos.offset === 0, "invalid offset for empty block text");
12953
+ assert(logger$4b, pos.offset === 0, "invalid offset for empty block text");
12967
12954
  const parent = rangeInfo.container.parentElement;
12968
- assert(logger$4c, parent, "invalid br parent");
12955
+ assert(logger$4b, parent, "invalid br parent");
12969
12956
  const rect = parent.getBoundingClientRect();
12970
12957
  const ret = new DOMRect(rect.left, rect.top, 1, rect.height);
12971
12958
  return ret;
@@ -12973,11 +12960,11 @@ var __publicField = (obj, key, value) => {
12973
12960
  const range = createRange(rangeInfo.container, rangeInfo.offset);
12974
12961
  const rects = Array.from(range.getClientRects());
12975
12962
  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");
12963
+ assert(logger$4b, !isTextBlockContentTextChild(rangeInfo.child), "only box or insertion child range has zero client rect");
12964
+ assert(logger$4b, rangeInfo.offset === 1 || rangeInfo.offset === 2, "invalid offset for box or insertion child");
12978
12965
  const child = rangeInfo.child;
12979
12966
  const rects2 = getChildClientRects(block, child);
12980
- assert(logger$4c, rects2.length >= 1, "no client rects for box content");
12967
+ assert(logger$4b, rects2.length >= 1, "no client rects for box content");
12981
12968
  if (rangeInfo.offset === 1) {
12982
12969
  const rect2 = rects2[0];
12983
12970
  return new DOMRect(rect2.x, rect2.y, 1, rect2.height);
@@ -13023,7 +13010,7 @@ var __publicField = (obj, key, value) => {
13023
13010
  });
13024
13011
  }
13025
13012
  }
13026
- assert(logger$4c, rects.length > 0, "no client rects for range");
13013
+ assert(logger$4b, rects.length > 0, "no client rects for range");
13027
13014
  if (pos.type === "home") {
13028
13015
  return rects[rects.length - 1];
13029
13016
  }
@@ -13103,13 +13090,13 @@ var __publicField = (obj, key, value) => {
13103
13090
  };
13104
13091
  }
13105
13092
  }
13106
- const logger$4b = getLogger("selection-range");
13093
+ const logger$4a = getLogger("selection-range");
13107
13094
  function createEditorSelectionRange(editor, options) {
13108
13095
  const { anchor: anchor2, focus } = options;
13109
13096
  if (anchor2 instanceof EditorSimpleBlockPosition && focus instanceof EditorSimpleBlockPosition) {
13110
13097
  return new EditorSimpleSelectionRange(editor, { anchor: anchor2, focus });
13111
13098
  }
13112
- assert(logger$4b, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
13099
+ assert(logger$4a, anchor2 instanceof EditorComplexBlockPosition && focus instanceof EditorComplexBlockPosition, "start position type does not math end type");
13113
13100
  return new EditorComplexSelectionRange(editor, { anchor: anchor2, focus });
13114
13101
  }
13115
13102
  function createBlockSimpleRange(editor, block, anchor2, focus) {
@@ -13131,7 +13118,7 @@ var __publicField = (obj, key, value) => {
13131
13118
  const focus = createSimpleBlockPosition(range.focus.blockId, range.focus.offset, "normal");
13132
13119
  return createEditorSelectionRange(editor, { anchor: anchor2, focus });
13133
13120
  }
13134
- const logger$4a = getLogger("range-from-point");
13121
+ const logger$49 = getLogger("range-from-point");
13135
13122
  function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
13136
13123
  const yOffsets = [0, -12, 12];
13137
13124
  let x = pointX;
@@ -13163,7 +13150,7 @@ var __publicField = (obj, key, value) => {
13163
13150
  const rect = elem.getBoundingClientRect();
13164
13151
  if (rect.width && rect.top && i === 0) {
13165
13152
  if (rect.left + rect.width < x || rect.top + rect.height < y) {
13166
- logger$4a.debug("click on scrollbar, out of element rect");
13153
+ logger$49.debug("click on scrollbar, out of element rect");
13167
13154
  return null;
13168
13155
  }
13169
13156
  }
@@ -13201,7 +13188,7 @@ var __publicField = (obj, key, value) => {
13201
13188
  let block = getLastChildBlock(container);
13202
13189
  if (!isVisibleBlock(block)) {
13203
13190
  const preBlock = getPrevVisibleBlock(block);
13204
- assert(logger$4a, preBlock, "container must have visible block");
13191
+ assert(logger$49, preBlock, "container must have visible block");
13205
13192
  block = preBlock;
13206
13193
  }
13207
13194
  const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, block.getBoundingClientRect().bottom - 4);
@@ -13220,7 +13207,7 @@ var __publicField = (obj, key, value) => {
13220
13207
  if (range instanceof EditorSimpleSelectionRange) {
13221
13208
  return range;
13222
13209
  }
13223
- assert(logger$4a, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
13210
+ assert(logger$49, range instanceof EditorComplexSelectionRange, `invalid range type: ${typeof range}`);
13224
13211
  const complexRange = range;
13225
13212
  const container2 = editor.getContainerById(complexRange.start.childContainerId);
13226
13213
  return getRangeInContainer(editor, container2, x, y);
@@ -13243,7 +13230,7 @@ var __publicField = (obj, key, value) => {
13243
13230
  });
13244
13231
  return getRangeInContainer(editor, container, x, y);
13245
13232
  }
13246
- const logger$49 = getLogger("adjust-selection-pos");
13233
+ const logger$48 = getLogger("adjust-selection-pos");
13247
13234
  function getParentContainers(block) {
13248
13235
  const containers = [];
13249
13236
  while (block) {
@@ -13253,10 +13240,10 @@ var __publicField = (obj, key, value) => {
13253
13240
  return containers;
13254
13241
  }
13255
13242
  const newBlock = getParentBlock(container);
13256
- assert(logger$49, newBlock, "child container has not parent container");
13243
+ assert(logger$48, newBlock, "child container has not parent container");
13257
13244
  block = newBlock;
13258
13245
  }
13259
- assert(logger$49, false, "should not come here: getParentContainers");
13246
+ assert(logger$48, false, "should not come here: getParentContainers");
13260
13247
  }
13261
13248
  function getParentBlockInContainer(container, block) {
13262
13249
  while (block) {
@@ -13265,16 +13252,16 @@ var __publicField = (obj, key, value) => {
13265
13252
  return block;
13266
13253
  }
13267
13254
  const newBlock = getParentBlock(parent);
13268
- assert(logger$49, newBlock, "could not find parent block for a child container");
13255
+ assert(logger$48, newBlock, "could not find parent block for a child container");
13269
13256
  block = newBlock;
13270
13257
  }
13271
- assert(logger$49, false, "no parent block in specified container");
13258
+ assert(logger$48, false, "no parent block in specified container");
13272
13259
  }
13273
13260
  function getClosestParentBlock(block1, block2) {
13274
13261
  const containers1 = getParentContainers(block1);
13275
13262
  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");
13263
+ assert(logger$48, containers1.length > 0 && containers2.length > 0, "block has not parent container");
13264
+ assert(logger$48, containers1[0] === containers2[0], "root container does not equal");
13278
13265
  let parentContainer = containers1[0];
13279
13266
  for (let i = 1; i < containers1.length || containers2.length; i++) {
13280
13267
  if (containers1[i] === containers2[i]) {
@@ -13293,23 +13280,23 @@ var __publicField = (obj, key, value) => {
13293
13280
  }
13294
13281
  function getParentContainerInComplexBlock(parentComplexBlock, element) {
13295
13282
  let block = getParentBlock(element);
13296
- assert(logger$49, block, "element is not in a block");
13283
+ assert(logger$48, block, "element is not in a block");
13297
13284
  while (block) {
13298
13285
  const container = getParentContainer(block);
13299
- assert(logger$49, isChildContainer(container), "not a child container");
13286
+ assert(logger$48, isChildContainer(container), "not a child container");
13300
13287
  const parentBlock = getParentBlock(container);
13301
- assert(logger$49, parentBlock, "child container has not parent block");
13288
+ assert(logger$48, parentBlock, "child container has not parent block");
13302
13289
  if (parentBlock === parentComplexBlock) {
13303
13290
  return container;
13304
13291
  }
13305
13292
  block = parentBlock;
13306
13293
  }
13307
- assert(logger$49, false, "failed to find parent container in complex block");
13294
+ assert(logger$48, false, "failed to find parent container in complex block");
13308
13295
  }
13309
13296
  function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
13310
13297
  const blockId = getBlockId(complexBlock);
13311
- assert(logger$49, blockId === anchor2.blockId, "invalid start pos");
13312
- assert(logger$49, blockId === focus.blockId, "invalid end pos");
13298
+ assert(logger$48, blockId === anchor2.blockId, "invalid start pos");
13299
+ assert(logger$48, blockId === focus.blockId, "invalid end pos");
13313
13300
  const blockClass = getComplexBlockClass(editor, complexBlock);
13314
13301
  if (blockClass.adjustSelectionPos) {
13315
13302
  return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
@@ -13343,8 +13330,8 @@ var __publicField = (obj, key, value) => {
13343
13330
  if (focus instanceof EditorComplexBlockPosition) {
13344
13331
  focus = createSimpleBlockPosition(focusBlock, getBlockTextLength$6(editor, focusBlock), "end");
13345
13332
  }
13346
- assert(logger$49, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
13347
- assert(logger$49, focus instanceof EditorSimpleBlockPosition, "not valid position type");
13333
+ assert(logger$48, anchor2 instanceof EditorSimpleBlockPosition, "not valid position type");
13334
+ assert(logger$48, focus instanceof EditorSimpleBlockPosition, "not valid position type");
13348
13335
  return {
13349
13336
  anchor: anchor2,
13350
13337
  focus
@@ -13379,7 +13366,7 @@ var __publicField = (obj, key, value) => {
13379
13366
  const focusChildContainer = getParentContainerInComplexBlock(parentComplexBlock, focusBlock);
13380
13367
  anchor2 = createComplexBlockPosition(newAnchorBlock, getContainerId(anchorChildContainer));
13381
13368
  focus = createComplexBlockPosition(newAnchorBlock, getContainerId(focusChildContainer));
13382
- logger$49.debug(`select in complex block: ${anchorChildContainer.id}, ${focusChildContainer.id}`);
13369
+ logger$48.debug(`select in complex block: ${anchorChildContainer.id}, ${focusChildContainer.id}`);
13383
13370
  return complexBlockAdjustSelectionPos(editor, parentComplexBlock, anchor2, focus);
13384
13371
  }
13385
13372
  let anchorOffsetNormal = reverse ? getBlockTextLength$6(editor, newAnchorBlock) : 0;
@@ -13399,7 +13386,7 @@ var __publicField = (obj, key, value) => {
13399
13386
  focus
13400
13387
  };
13401
13388
  }
13402
- const logger$48 = getLogger("core");
13389
+ const logger$47 = getLogger("core");
13403
13390
  function createBlockAnchor(editor, block, id, refClientRect) {
13404
13391
  const tools = getBlockTools(block);
13405
13392
  let elem = tools.querySelector(`.block-anchor[data-id=${id}]`);
@@ -13417,7 +13404,7 @@ var __publicField = (obj, key, value) => {
13417
13404
  return elem;
13418
13405
  }
13419
13406
  function createBlockCaretAnchor(editor, block, offset, id) {
13420
- assert(logger$48, isTextKindBlock(editor, block), "not a text kind block");
13407
+ assert(logger$47, isTextKindBlock(editor, block), "not a text kind block");
13421
13408
  const caretRect = getTextCaretRect(block, createSimpleBlockPosition(block, offset, "normal"));
13422
13409
  const blockRect = block.getBoundingClientRect();
13423
13410
  const tools = getBlockTools(block);
@@ -13776,19 +13763,19 @@ var __publicField = (obj, key, value) => {
13776
13763
  return result + (index2 ? "-" : "") + word.toLowerCase();
13777
13764
  });
13778
13765
  const kebabCase$1 = kebabCase;
13779
- const logger$47 = getLogger("box");
13766
+ const logger$46 = getLogger("box");
13780
13767
  function isBoxOp(op) {
13781
13768
  if (!op.attributes)
13782
13769
  return false;
13783
13770
  if (!op.attributes.box)
13784
13771
  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)}`);
13772
+ assert(logger$46, typeof op.attributes.box === "string" && op.attributes.box === "true" || op.attributes.box === true, `invalid op attribute box property, ${op.attributes.box}`);
13773
+ assert(logger$46, op.attributes.type, `no box type: ${JSON.stringify(op)}`);
13787
13774
  return true;
13788
13775
  }
13789
- const logger$46 = getLogger("text-op");
13776
+ const logger$45 = getLogger("text-op");
13790
13777
  function getOpLength(op) {
13791
- assert(logger$46, typeof op.insert === "string", "invalid op, no insert");
13778
+ assert(logger$45, typeof op.insert === "string", "invalid op, no insert");
13792
13779
  return op.insert.length;
13793
13780
  }
13794
13781
  function getOpAt(text2, offset) {
@@ -13796,7 +13783,7 @@ var __publicField = (obj, key, value) => {
13796
13783
  let pos = 0;
13797
13784
  for (let i = 0; i < ops.length; i++) {
13798
13785
  const op = ops[i];
13799
- assert(logger$46, typeof op.insert === "string", "invalid text op, no insert");
13786
+ assert(logger$45, typeof op.insert === "string", "invalid text op, no insert");
13800
13787
  const end = pos + getOpLength(op);
13801
13788
  if (end > offset) {
13802
13789
  return [op];
@@ -13812,22 +13799,22 @@ var __publicField = (obj, key, value) => {
13812
13799
  }
13813
13800
  return [];
13814
13801
  }
13815
- const logger$45 = getLogger("rich-text-length");
13802
+ const logger$44 = getLogger("rich-text-length");
13816
13803
  function getTextOpLength(op) {
13817
- assert(logger$45, typeof op.insert === "string", "op.insert is not string");
13804
+ assert(logger$44, typeof op.insert === "string", "op.insert is not string");
13818
13805
  return op.insert.length;
13819
13806
  }
13820
13807
  function getTextLength(ops) {
13821
13808
  let count = 0;
13822
13809
  ops.forEach((op) => {
13823
13810
  if (op.insert) {
13824
- assert(logger$45, typeof op.insert === "string", "op.insert is not string");
13811
+ assert(logger$44, typeof op.insert === "string", "op.insert is not string");
13825
13812
  count += getTextOpLength(op);
13826
13813
  }
13827
13814
  });
13828
13815
  return count;
13829
13816
  }
13830
- const logger$44 = getLogger("split-text");
13817
+ const logger$43 = getLogger("split-text");
13831
13818
  function splitText(ops, offset, splitResult) {
13832
13819
  ops = cloneDeep__default.default(ops);
13833
13820
  if (offset === 0) {
@@ -13845,8 +13832,8 @@ var __publicField = (obj, key, value) => {
13845
13832
  let counted = 0;
13846
13833
  for (let i = 0; i < ops.length; i++) {
13847
13834
  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}`);
13835
+ assert(logger$43, typeof op === "object", `invalid op type, ${typeof op}`);
13836
+ assert(logger$43, typeof op.insert === "string", `invalid op.insert type, ${typeof op.insert}`);
13850
13837
  const subLen = getTextOpLength(op);
13851
13838
  if (counted + subLen < offset) {
13852
13839
  counted += subLen;
@@ -13856,18 +13843,18 @@ var __publicField = (obj, key, value) => {
13856
13843
  right: ops.slice(i + 1)
13857
13844
  };
13858
13845
  } else {
13859
- assert(logger$44, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
13846
+ assert(logger$43, counted + subLen > offset, `invalid offset, ${counted}, ${subLen}, ${offset}`);
13860
13847
  const splitIndex = offset - counted;
13861
13848
  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");
13849
+ assert(logger$43, copied.insert, "no copied.insert");
13850
+ assert(logger$43, typeof copied.insert === "string", "invalid copied.insert type");
13864
13851
  copied.insert = copied.insert.substr(0, splitIndex);
13865
13852
  op.insert = op.insert.substr(splitIndex);
13866
13853
  if (copied.insert === "") {
13867
- assert(logger$44, false, "invalid copied.insert, is empty string");
13854
+ assert(logger$43, false, "invalid copied.insert, is empty string");
13868
13855
  }
13869
13856
  if (op.insert === "") {
13870
- assert(logger$44, false, "invalid op.insert, is empty string");
13857
+ assert(logger$43, false, "invalid op.insert, is empty string");
13871
13858
  }
13872
13859
  const right = [
13873
13860
  op,
@@ -13886,9 +13873,9 @@ var __publicField = (obj, key, value) => {
13886
13873
  throw new Error(`invalid split offset: ${offset}, ${JSON.stringify(ops)}`);
13887
13874
  }
13888
13875
  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");
13876
+ assert(logger$43, offset >= 0, "invalid offset, < 0");
13877
+ assert(logger$43, length > 0, "invalid length, <= 0");
13878
+ assert(logger$43, offset + length <= getTextLength(text2), "invalid offset + length < text length");
13892
13879
  const { left: temp, right } = splitText(text2, offset + length);
13893
13880
  const { left, right: middle } = splitText(temp, offset);
13894
13881
  return { left, middle, right };
@@ -14111,9 +14098,9 @@ var __publicField = (obj, key, value) => {
14111
14098
  }
14112
14099
  return [color, backgroundColor];
14113
14100
  }
14114
- const logger$43 = getLogger("text-block-content");
14101
+ const logger$42 = getLogger("text-block-content");
14115
14102
  function updateBlockContentCore(editor, blockPath, content, blockText, insertions) {
14116
- assert(logger$43, blockText, "no text for block");
14103
+ assert(logger$42, blockText, "no text for block");
14117
14104
  if (blockText.length === 0 && (!insertions || insertions.size === 0)) {
14118
14105
  content.innerHTML = "<span><br></span>";
14119
14106
  return;
@@ -14145,9 +14132,9 @@ var __publicField = (obj, key, value) => {
14145
14132
  for (let i2 = 0; i2 < text2.length; i2++) {
14146
14133
  const op = text2[i2];
14147
14134
  if (isBoxOp(op)) {
14148
- assert(logger$43, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
14135
+ assert(logger$42, op.attributes, `op is not an valid box: ${JSON.stringify(op)}`);
14149
14136
  const span2 = editor.editorBoxes.createBox(content, op.attributes);
14150
- assert(logger$43, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
14137
+ assert(logger$42, span2 instanceof HTMLSpanElement, `invalid box element: ${span2.tagName}`);
14151
14138
  const ret = editor.editorBlockRenders.renderBox(blockPath, op.attributes);
14152
14139
  if (ret.classes) {
14153
14140
  addClass(span2, ...ret.classes);
@@ -14165,7 +14152,7 @@ var __publicField = (obj, key, value) => {
14165
14152
  fragment.appendChild(span2);
14166
14153
  continue;
14167
14154
  }
14168
- assert(logger$43, op.insert, `no insert in op: ${JSON.stringify(op)}`);
14155
+ assert(logger$42, op.insert, `no insert in op: ${JSON.stringify(op)}`);
14169
14156
  const span = createElement("span", ["text"], fragment, op.insert);
14170
14157
  if (op.attributes) {
14171
14158
  const ret = editor.editorBlockRenders.renderText(blockPath, op.attributes);
@@ -14196,7 +14183,7 @@ var __publicField = (obj, key, value) => {
14196
14183
  const compositionText = editor.compositingText;
14197
14184
  if (compositionText) {
14198
14185
  const pos = editor.selection.range.start;
14199
- assert(logger$43, pos.isSimple(), "not an simple position while compositing");
14186
+ assert(logger$42, pos.isSimple(), "not an simple position while compositing");
14200
14187
  if (pos.blockId === blockId) {
14201
14188
  const attributes = getAttributesAt(text2, 0);
14202
14189
  insertions.set(pos.offset, [{
@@ -14212,11 +14199,11 @@ var __publicField = (obj, key, value) => {
14212
14199
  function clearAllTempCompositionText(editor) {
14213
14200
  const children = editor.rootContainer.querySelectorAll('span[data-type="editor-insertion"].inputting-insertion');
14214
14201
  if (children.length) {
14215
- logger$43.debug(`remove ${children.length} temp composition span`);
14202
+ logger$42.debug(`remove ${children.length} temp composition span`);
14216
14203
  }
14217
14204
  Array.from(children).forEach((c) => c.remove());
14218
14205
  }
14219
- const logger$42 = getLogger("client-rects");
14206
+ const logger$41 = getLogger("client-rects");
14220
14207
  function getChildrenOffsets(block) {
14221
14208
  const children = getTextBlockContentChildren(block);
14222
14209
  let start = 0;
@@ -14234,15 +14221,15 @@ var __publicField = (obj, key, value) => {
14234
14221
  return ret;
14235
14222
  }
14236
14223
  function getChildrenInRange(editor, block, from, to) {
14237
- assert(logger$42, from < to, `invalid from & to: ${from}, ${to}`);
14224
+ assert(logger$41, from < to, `invalid from & to: ${from}, ${to}`);
14238
14225
  const blockLength = getBlockTextLength$6(editor, block);
14239
- assert(logger$42, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
14226
+ assert(logger$41, from >= 0 && to >= 0 && from <= blockLength && to <= blockLength, `invalid offset: ${from}, ${to}, length: ${blockLength}`);
14240
14227
  const offsets = getChildrenOffsets(block);
14241
14228
  const startIndex = offsets.findIndex((c) => c.startBlockOffset <= from && from < c.endBlockOffset);
14242
14229
  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}`);
14230
+ assert(logger$41, startIndex !== -1, "failed to find start child");
14231
+ assert(logger$41, endIndex !== -1, "failed to find end child");
14232
+ assert(logger$41, startIndex <= endIndex, `invalid start index & end index: ${startIndex}, ${endIndex}`);
14246
14233
  if (startIndex === endIndex) {
14247
14234
  const child = offsets[startIndex];
14248
14235
  return [{
@@ -14324,16 +14311,16 @@ var __publicField = (obj, key, value) => {
14324
14311
  return rects;
14325
14312
  }
14326
14313
  function getRangeClientRects(editor, block, range) {
14327
- assert(logger$42, range instanceof EditorSimpleSelectionRange, "invalid range");
14314
+ assert(logger$41, range instanceof EditorSimpleSelectionRange, "invalid range");
14328
14315
  const start = range.start;
14329
14316
  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");
14317
+ assert(logger$41, start.isSimple(), "text block only allow simple position");
14318
+ assert(logger$41, end.isSimple(), "text block only allow simple position");
14319
+ assert(logger$41, start.blockId === end.blockId, "only allow update one text block selection");
14320
+ assert(logger$41, start.blockId === getBlockId(block), "only allow update one text block selection");
14334
14321
  return getClientRects$2(editor, block, start, end);
14335
14322
  }
14336
- const logger$41 = getLogger("selection-background");
14323
+ const logger$40 = getLogger("selection-background");
14337
14324
  function getLineHeight(elem) {
14338
14325
  const style2 = window.getComputedStyle(elem);
14339
14326
  const lineHeightStyle = style2.getPropertyValue("line-height");
@@ -14353,9 +14340,9 @@ var __publicField = (obj, key, value) => {
14353
14340
  return lineHeight;
14354
14341
  }
14355
14342
  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");
14343
+ assert(logger$40, start.isSimple(), "text block only allow simple position");
14344
+ assert(logger$40, end.isSimple(), "text block only allow simple position");
14345
+ assert(logger$40, start.blockId === end.blockId, "only allow update one text block selection");
14359
14346
  const from = start.offset;
14360
14347
  const to = end.offset;
14361
14348
  if (from === to) {
@@ -14414,7 +14401,7 @@ var __publicField = (obj, key, value) => {
14414
14401
  }
14415
14402
  });
14416
14403
  }
14417
- const logger$40 = getLogger("line-breaker");
14404
+ const logger$3$ = getLogger("line-breaker");
14418
14405
  function mergeTextRects(rects) {
14419
14406
  const result = [];
14420
14407
  let lastRect = null;
@@ -14541,7 +14528,7 @@ var __publicField = (obj, key, value) => {
14541
14528
  }
14542
14529
  const textChild = child;
14543
14530
  const rects = mergeTextRects(textChild.getClientRects());
14544
- assert(logger$40, rects.length > 0, "invalid text child dom");
14531
+ assert(logger$3$, rects.length > 0, "invalid text child dom");
14545
14532
  if (rects.length === 1) {
14546
14533
  const nextChild = children[i + 1];
14547
14534
  if (!nextChild) {
@@ -14566,10 +14553,10 @@ var __publicField = (obj, key, value) => {
14566
14553
  continue;
14567
14554
  }
14568
14555
  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}`);
14556
+ assert(logger$3$, textNode, "invalid text child, no text node");
14557
+ assert(logger$3$, textNode instanceof Text, `invalid text child, not a valid text node: ${typeof textNode}`);
14571
14558
  const textChildLength = getTextBlockContentChildTextLength(textChild);
14572
- assert(logger$40, textNode.data.length === textChildLength, "text node data length not equal child text length");
14559
+ assert(logger$3$, textNode.data.length === textChildLength, "text node data length not equal child text length");
14573
14560
  const textRects = getTextRects(textNode);
14574
14561
  for (let rIndex = 0; rIndex < textRects.length - 1; rIndex++) {
14575
14562
  const rect = textRects[rIndex];
@@ -14611,7 +14598,7 @@ var __publicField = (obj, key, value) => {
14611
14598
  }
14612
14599
  }
14613
14600
  }
14614
- assert(logger$40, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
14601
+ assert(logger$3$, position.offset <= getTextBlockLength(block), "invalid position, offset > block length");
14615
14602
  return {
14616
14603
  lineIndex: lineBreaks.length,
14617
14604
  lineBreaks
@@ -23384,7 +23371,7 @@ var __publicField = (obj, key, value) => {
23384
23371
  const Graphemer_1 = __importDefault(Graphemer$1);
23385
23372
  var _default = lib$1.default = Graphemer_1.default;
23386
23373
  const splitter = new _default();
23387
- const logger$3$ = getLogger("text-offset");
23374
+ const logger$3_ = getLogger("text-offset");
23388
23375
  function getChildOffset(block, child) {
23389
23376
  const children = getTextBlockContentChildren(block);
23390
23377
  let start = 0;
@@ -23400,26 +23387,26 @@ var __publicField = (obj, key, value) => {
23400
23387
  }
23401
23388
  start += testLength;
23402
23389
  }
23403
- assert(logger$3$, false, "can not find child in children");
23390
+ assert(logger$3_, false, "can not find child in children");
23404
23391
  }
23405
23392
  function isValidOffset(block, blockOffset) {
23406
- assert(logger$3$, blockOffset >= 0, `invalid offset: ${blockOffset}`);
23393
+ assert(logger$3_, blockOffset >= 0, `invalid offset: ${blockOffset}`);
23407
23394
  const childInfo = getTextBlockChild(block, blockOffset);
23408
23395
  const { prev, next: next2, offset } = childInfo;
23409
23396
  if (!prev && !next2) {
23410
- assert(logger$3$, false, "invalid offset, no prev & next child at offset");
23397
+ assert(logger$3_, false, "invalid offset, no prev & next child at offset");
23411
23398
  }
23412
23399
  if (prev !== next2) {
23413
23400
  return true;
23414
23401
  }
23415
23402
  const child = prev;
23416
- assert(logger$3$, child, "no child");
23403
+ assert(logger$3_, child, "no child");
23417
23404
  if (isTextBlockContentBoxChild(child)) {
23418
- assert(logger$3$, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
23405
+ assert(logger$3_, offset === 0 || offset === 1, `invalid box child offset: ${offset}`);
23419
23406
  return true;
23420
23407
  }
23421
23408
  const text2 = child.textContent;
23422
- assert(logger$3$, text2, "no content for text child");
23409
+ assert(logger$3_, text2, "no content for text child");
23423
23410
  const chars = splitter.splitGraphemes(text2);
23424
23411
  const validOffsets = /* @__PURE__ */ new Set();
23425
23412
  let start = 0;
@@ -23449,7 +23436,7 @@ var __publicField = (obj, key, value) => {
23449
23436
  }
23450
23437
  function getNextValidOffset(block, blockOffset) {
23451
23438
  const length = getTextBlockLength(block);
23452
- assert(logger$3$, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
23439
+ assert(logger$3_, blockOffset >= 0 && blockOffset <= length, `invalid offset: ${blockOffset}, ${length}`);
23453
23440
  if (blockOffset === length) {
23454
23441
  return length;
23455
23442
  }
@@ -23463,7 +23450,7 @@ var __publicField = (obj, key, value) => {
23463
23450
  }
23464
23451
  return ret;
23465
23452
  }
23466
- const logger$3_ = getLogger("line-offset");
23453
+ const logger$3Z = getLogger("line-offset");
23467
23454
  function getLineOffsets(block) {
23468
23455
  const lineBreaks = getLineBreaks(block);
23469
23456
  const ret = [];
@@ -23484,7 +23471,7 @@ var __publicField = (obj, key, value) => {
23484
23471
  }
23485
23472
  function getLineOffset(block, lineIndex) {
23486
23473
  const lines = getLineOffsets(block);
23487
- assert(logger$3_, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
23474
+ assert(logger$3Z, lineIndex >= 0 && lineIndex < lines.length, `invalid line index: ${lineIndex}, ${lines.length}`);
23488
23475
  return lines[lineIndex];
23489
23476
  }
23490
23477
  function getLineOffsetByPos(block, pos) {
@@ -23541,7 +23528,7 @@ var __publicField = (obj, key, value) => {
23541
23528
  function getLineCount(block) {
23542
23529
  return getLineOffsets(block).length;
23543
23530
  }
23544
- const logger$3Z = getLogger("find-text-position");
23531
+ const logger$3Y = getLogger("find-text-position");
23545
23532
  function isWrappedLine(block, lineIndex) {
23546
23533
  const { start, end } = getLineOffset(block, lineIndex);
23547
23534
  const blockId = getBlockId(block);
@@ -23552,13 +23539,13 @@ var __publicField = (obj, key, value) => {
23552
23539
  return false;
23553
23540
  }
23554
23541
  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");
23542
+ assert(logger$3Y, childInfo.next, "no next child at offset");
23543
+ assert(logger$3Y, !isTextBlockContentTextChild(childInfo.next), "next child is not text child");
23557
23544
  return true;
23558
23545
  }
23559
23546
  function getWrappedLineOffsets(block, lineIndex) {
23560
23547
  const blockId = getBlockId(block);
23561
- assert(logger$3Z, isWrappedLine(block, lineIndex), "line is not wrapped");
23548
+ assert(logger$3Y, isWrappedLine(block, lineIndex), "line is not wrapped");
23562
23549
  const { start, end } = getLineOffset(block, lineIndex);
23563
23550
  const homePos = createSimpleBlockPosition(blockId, start, "home");
23564
23551
  for (let offset = start + 1; offset <= end; offset += 1) {
@@ -23573,11 +23560,11 @@ var __publicField = (obj, key, value) => {
23573
23560
  return offset - 1;
23574
23561
  }
23575
23562
  }
23576
- assert(logger$3Z, false, "failed to find wrapped offset");
23563
+ assert(logger$3Y, false, "failed to find wrapped offset");
23577
23564
  return 0;
23578
23565
  }
23579
23566
  function findTextPositionInLine(editor, block, lineIndex, sourceBlock, pos, findDirection, suggestedX) {
23580
- assert(logger$3Z, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
23567
+ assert(logger$3Y, isTextKindBlock(editor, block), `not a text kind block: ${getBlockType(block)}`);
23581
23568
  const { start, end } = getLineOffset(block, lineIndex);
23582
23569
  let from = start;
23583
23570
  const blockId = getBlockId(block);
@@ -23619,11 +23606,11 @@ var __publicField = (obj, key, value) => {
23619
23606
  return retPos;
23620
23607
  }
23621
23608
  function findPrevTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
23622
- assert(logger$3Z, isTextKindBlock(editor, block), "not a text block");
23609
+ assert(logger$3Y, isTextKindBlock(editor, block), "not a text block");
23623
23610
  return findTextPositionInLine(editor, block, getLineCount(block) - 1, sourceBlock, pos, "up", suggestedX);
23624
23611
  }
23625
23612
  function findNextTextBlockPosition(editor, block, sourceBlock, pos, suggestedX) {
23626
- assert(logger$3Z, isTextKindBlock(editor, block), "not a text block");
23613
+ assert(logger$3Y, isTextKindBlock(editor, block), "not a text block");
23627
23614
  return findTextPositionInLine(editor, block, 0, sourceBlock, pos, "down", suggestedX);
23628
23615
  }
23629
23616
  function moveDown(editor, block, position, suggestedX) {
@@ -23731,7 +23718,7 @@ var __publicField = (obj, key, value) => {
23731
23718
  }
23732
23719
  return pos;
23733
23720
  }
23734
- const logger$3Y = getLogger("move-caret");
23721
+ const logger$3X = getLogger("move-caret");
23735
23722
  function moveTextCaret(editor, block, position, direction) {
23736
23723
  if (direction === "ArrowLeft") {
23737
23724
  const ret = moveLeft(block, position);
@@ -23761,9 +23748,9 @@ var __publicField = (obj, key, value) => {
23761
23748
  }
23762
23749
  return createSimpleBlockPosition(getBlockId(block), ret.offset, ret.type);
23763
23750
  }
23764
- assert(logger$3Y, false, `invalid navigation direction: ${direction}`);
23751
+ assert(logger$3X, false, `invalid navigation direction: ${direction}`);
23765
23752
  }
23766
- const logger$3X = getLogger("text-range");
23753
+ const logger$3W = getLogger("text-range");
23767
23754
  function getBlockRects(block) {
23768
23755
  const ret = [];
23769
23756
  const children = getTextBlockContentChildren(block);
@@ -23821,9 +23808,9 @@ var __publicField = (obj, key, value) => {
23821
23808
  return null;
23822
23809
  }
23823
23810
  const children = getTextBlockContentChildren(block);
23824
- assert(logger$3X, children.indexOf(child) !== -1, "failed to find child in children");
23811
+ assert(logger$3W, children.indexOf(child) !== -1, "failed to find child in children");
23825
23812
  const offsetInfo = getChildOffset(block, child);
23826
- assert(logger$3X, offsetInfo, "failed to get child offset");
23813
+ assert(logger$3W, offsetInfo, "failed to get child offset");
23827
23814
  const { start } = offsetInfo;
23828
23815
  let offset;
23829
23816
  let length;
@@ -23839,7 +23826,7 @@ var __publicField = (obj, key, value) => {
23839
23826
  }
23840
23827
  length = 0;
23841
23828
  } else {
23842
- assert(logger$3X, child.firstChild instanceof Text, "child is not text");
23829
+ assert(logger$3W, child.firstChild instanceof Text, "child is not text");
23843
23830
  offset = start + textNodeOffsetFromPoint(child.firstChild, x, y);
23844
23831
  length = 0;
23845
23832
  }
@@ -23863,9 +23850,9 @@ var __publicField = (obj, key, value) => {
23863
23850
  }
23864
23851
  return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
23865
23852
  }
23866
- const logger$3W = getLogger("create-text-op");
23853
+ const logger$3V = getLogger("create-text-op");
23867
23854
  function createTextOp(text2, attributes) {
23868
- assert(logger$3W, text2, "text is empty");
23855
+ assert(logger$3V, text2, "text is empty");
23869
23856
  const ret = {
23870
23857
  insert: text2
23871
23858
  };
@@ -23888,7 +23875,7 @@ var __publicField = (obj, key, value) => {
23888
23875
  }
23889
23876
  return result;
23890
23877
  }
23891
- const logger$3V = getLogger("merge-ops");
23878
+ const logger$3U = getLogger("merge-ops");
23892
23879
  function mergeOps(text2) {
23893
23880
  if (text2.length <= 1) {
23894
23881
  return text2;
@@ -23910,10 +23897,10 @@ var __publicField = (obj, key, value) => {
23910
23897
  return false;
23911
23898
  }
23912
23899
  if (op1.attributes === void 0) {
23913
- assert(logger$3V, op2.attributes === void 0, "op2.attributes is not undefined");
23900
+ assert(logger$3U, op2.attributes === void 0, "op2.attributes is not undefined");
23914
23901
  return true;
23915
23902
  }
23916
- assert(logger$3V, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
23903
+ assert(logger$3U, op1.attributes && op2.attributes, "op1.attributes && op2.attributes is undefined");
23917
23904
  return isEqual__default.default(op1.attributes, op2.attributes);
23918
23905
  };
23919
23906
  const newOps = [];
@@ -23922,8 +23909,8 @@ var __publicField = (obj, key, value) => {
23922
23909
  for (let i = 1; i < text2.length; i += 1) {
23923
23910
  const op = text2[i];
23924
23911
  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");
23912
+ assert(logger$3U, typeof before.insert === "string", "before.insert is not string");
23913
+ assert(logger$3U, typeof op.insert === "string", "op.insert is not string");
23927
23914
  before.insert += op.insert;
23928
23915
  } else {
23929
23916
  newOps.push(op);
@@ -23951,15 +23938,15 @@ var __publicField = (obj, key, value) => {
23951
23938
  }
23952
23939
  return text2.slice(0, i + 1);
23953
23940
  }
23954
- const logger$3U = getLogger("delete-text");
23941
+ const logger$3T = getLogger("delete-text");
23955
23942
  function deleteText(richText2, offset, count) {
23956
23943
  const { left, right } = splitToThree(richText2, offset, count);
23957
23944
  const result = [...left, ...right];
23958
23945
  return mergeOps(result);
23959
23946
  }
23960
23947
  function createDeleteOps(offset, count) {
23961
- assert(logger$3U, offset >= 0, `invalid offset: ${offset}`);
23962
- assert(logger$3U, count >= 1, `invalid delete count: ${count}`);
23948
+ assert(logger$3T, offset >= 0, `invalid offset: ${offset}`);
23949
+ assert(logger$3T, count >= 1, `invalid delete count: ${count}`);
23963
23950
  const ops = [];
23964
23951
  if (offset !== 0) {
23965
23952
  ops.push({
@@ -23971,7 +23958,7 @@ var __publicField = (obj, key, value) => {
23971
23958
  });
23972
23959
  return ops;
23973
23960
  }
23974
- const logger$3T = getLogger("delta");
23961
+ const logger$3S = getLogger("delta");
23975
23962
  function diffRichText(oldText, newText) {
23976
23963
  const delta1D = new Delta__default.default(oldText);
23977
23964
  const delta2D = new Delta__default.default(newText);
@@ -23981,7 +23968,7 @@ var __publicField = (obj, key, value) => {
23981
23968
  return new Delta__default.default(ops).transformPosition(cursor, !isLocalOp);
23982
23969
  }
23983
23970
  function isValidDocText(text2) {
23984
- assert(logger$3T, text2, "ops is null or undefined");
23971
+ assert(logger$3S, text2, "ops is null or undefined");
23985
23972
  for (let i = 0; i < text2.length; i++) {
23986
23973
  const op = text2[i];
23987
23974
  if (op.insert === null || op.insert === void 0) {
@@ -24001,7 +23988,7 @@ var __publicField = (obj, key, value) => {
24001
23988
  }
24002
23989
  class RichText {
24003
23990
  static ensureValidText(text2) {
24004
- assert(logger$3T, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
23991
+ assert(logger$3S, isValidDocText(text2), `text is not a valid text, ${JSON.stringify(text2)}`);
24005
23992
  }
24006
23993
  static diff(oldText, newText) {
24007
23994
  this.ensureValidText(oldText);
@@ -24023,9 +24010,9 @@ var __publicField = (obj, key, value) => {
24023
24010
  return resultText;
24024
24011
  }
24025
24012
  }
24026
- const logger$3S = getLogger("insert-text");
24013
+ const logger$3R = getLogger("insert-text");
24027
24014
  function insertText(richText2, offset, text2, attributes) {
24028
- assert(logger$3S, text2, `invalid text to insert: ${text2}`);
24015
+ assert(logger$3R, text2, `invalid text to insert: ${text2}`);
24029
24016
  const { left, right } = splitText(richText2, offset);
24030
24017
  const insertedText = typeof text2 === "string" ? [createTextOp(text2, attributes)] : text2;
24031
24018
  const result = [...left, ...insertedText, ...right];
@@ -24038,7 +24025,7 @@ var __publicField = (obj, key, value) => {
24038
24025
  };
24039
24026
  }
24040
24027
  function createInsertOps(offset, text2, attributes) {
24041
- assert(logger$3S, offset >= 0, `invalid offset: ${offset}`);
24028
+ assert(logger$3R, offset >= 0, `invalid offset: ${offset}`);
24042
24029
  if (text2.length === 0) {
24043
24030
  return [];
24044
24031
  }
@@ -24068,7 +24055,7 @@ var __publicField = (obj, key, value) => {
24068
24055
  function cloneText(text2) {
24069
24056
  return cloneDeep__default.default(text2);
24070
24057
  }
24071
- const logger$3R = getLogger("update-op-attribute");
24058
+ const logger$3Q = getLogger("update-op-attribute");
24072
24059
  function updateOpAttributes(orgOps, key, value, newAttributes) {
24073
24060
  const ops = cloneText(orgOps);
24074
24061
  const index2 = ops.findIndex((op2) => {
@@ -24076,7 +24063,7 @@ var __publicField = (obj, key, value) => {
24076
24063
  return false;
24077
24064
  return op2.attributes[key] === value;
24078
24065
  });
24079
- assert(logger$3R, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
24066
+ assert(logger$3Q, index2 !== -1, `can not find op by key: ${key}, value: ${value}`);
24080
24067
  const op = ops[index2];
24081
24068
  op.attributes = {
24082
24069
  ...op.attributes,
@@ -24158,11 +24145,11 @@ var __publicField = (obj, key, value) => {
24158
24145
  ]);
24159
24146
  }
24160
24147
  const FILL_CHAR = "\u200B";
24161
- const logger$3Q = getLogger("to-plain-text");
24148
+ const logger$3P = getLogger("to-plain-text");
24162
24149
  function toPlainText(ops, options) {
24163
24150
  let text2 = "";
24164
24151
  ops.forEach((op) => {
24165
- assert(logger$3Q, typeof op.insert === "string", "invalid op");
24152
+ assert(logger$3P, typeof op.insert === "string", "invalid op");
24166
24153
  if (op.attributes && op.attributes.box === true) {
24167
24154
  if (options == null ? void 0 : options.boxReplacement) {
24168
24155
  text2 += options.boxReplacement;
@@ -24217,11 +24204,11 @@ var __publicField = (obj, key, value) => {
24217
24204
  focus: pos
24218
24205
  };
24219
24206
  }
24220
- const logger$3P = getLogger("block-to-text");
24207
+ const logger$3O = getLogger("block-to-text");
24221
24208
  function textBlockToText$1(editor, ops, doc2) {
24222
24209
  let text2 = "";
24223
24210
  ops.forEach((op) => {
24224
- assert(logger$3P, typeof op.insert === "string", "invalid op");
24211
+ assert(logger$3O, typeof op.insert === "string", "invalid op");
24225
24212
  if (op.attributes && op.attributes.box === true) {
24226
24213
  const box = op.attributes;
24227
24214
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24239,11 +24226,11 @@ var __publicField = (obj, key, value) => {
24239
24226
  });
24240
24227
  return text2;
24241
24228
  }
24242
- const logger$3O = getLogger("block-to-text");
24229
+ const logger$3N = getLogger("block-to-text");
24243
24230
  function textToMarkdownText(editor, ops, doc2) {
24244
24231
  let text2 = "";
24245
24232
  ops.forEach((op) => {
24246
- assert(logger$3O, typeof op.insert === "string", "invalid op");
24233
+ assert(logger$3N, typeof op.insert === "string", "invalid op");
24247
24234
  if (op.attributes && op.attributes.box === true) {
24248
24235
  const box = op.attributes;
24249
24236
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24366,11 +24353,11 @@ var __publicField = (obj, key, value) => {
24366
24353
  return void 0;
24367
24354
  }
24368
24355
  }
24369
- const logger$3N = getLogger("block-to-text");
24356
+ const logger$3M = getLogger("block-to-text");
24370
24357
  function textBlockToHtml(editor, ops, doc2) {
24371
24358
  let html = "";
24372
24359
  ops.forEach((op) => {
24373
- assert(logger$3N, typeof op.insert === "string", "invalid op");
24360
+ assert(logger$3M, typeof op.insert === "string", "invalid op");
24374
24361
  if (op.attributes && op.attributes.box === true) {
24375
24362
  const box = op.attributes;
24376
24363
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -24439,16 +24426,16 @@ var __publicField = (obj, key, value) => {
24439
24426
  }
24440
24427
  return `<p>${html}</p>`;
24441
24428
  }
24442
- const logger$3M = getLogger("text-block");
24429
+ const logger$3L = getLogger("text-block");
24443
24430
  function createBlockContent$5(editor, path, container, blockElement, blockData) {
24444
24431
  const { text: text2 } = blockData;
24445
- assert(logger$3M, text2, "no text for text block");
24432
+ assert(logger$3L, text2, "no text for text block");
24446
24433
  const content = createBlockContentElement(blockElement, "div");
24447
24434
  updateBlockContent$1(editor, path, blockData.id, content, text2);
24448
24435
  return content;
24449
24436
  }
24450
24437
  function updateBlockText$1(editor, block, text2) {
24451
- assert(logger$3M, text2, "no text to update");
24438
+ assert(logger$3L, text2, "no text to update");
24452
24439
  const newContent = createBlockContentElement(null, "div");
24453
24440
  updateBlockContent$1(editor, getBlockPath(block), getBlockId(block), newContent, text2);
24454
24441
  const oldContent = getBlockContent(block);
@@ -24458,7 +24445,7 @@ var __publicField = (obj, key, value) => {
24458
24445
  return getRangeClientRects(editor, block, range);
24459
24446
  }
24460
24447
  function convertTo$k(editor, blockData, doc2, type) {
24461
- assert(logger$3M, blockData.text, "no text for text block");
24448
+ assert(logger$3L, blockData.text, "no text for text block");
24462
24449
  if (type === "text") {
24463
24450
  return textBlockToText$1(editor, blockData.text, doc2);
24464
24451
  }
@@ -24472,7 +24459,7 @@ var __publicField = (obj, key, value) => {
24472
24459
  blockData.id = genId();
24473
24460
  info == null ? void 0 : info.blockIdMap.set(srcBlockData.id, blockData.id);
24474
24461
  const { text: text2 } = blockData;
24475
- assert(logger$3M, text2, "no text for text block");
24462
+ assert(logger$3L, text2, "no text for text block");
24476
24463
  text2.forEach((op) => {
24477
24464
  if (op.insert && op.attributes && op.attributes.box === true) {
24478
24465
  const boxId = genId();
@@ -24504,7 +24491,7 @@ var __publicField = (obj, key, value) => {
24504
24491
  blockToDoc: blockToDoc$1
24505
24492
  };
24506
24493
  const updateTextBlockContent = updateBlockContent$1;
24507
- const logger$3L = getLogger("action-helper");
24494
+ const logger$3K = getLogger("action-helper");
24508
24495
  function editorGetBlockData(editor, block) {
24509
24496
  const container = getParentContainer(block);
24510
24497
  const containerId = getContainerId(container);
@@ -24512,10 +24499,10 @@ var __publicField = (obj, key, value) => {
24512
24499
  return editor.doc.getBlockData(containerId, blockIndex);
24513
24500
  }
24514
24501
  function editorGetBlockText(editor, block) {
24515
- assert(logger$3L, isTextKindBlock(editor, block), "not a text kind block");
24502
+ assert(logger$3K, isTextKindBlock(editor, block), "not a text kind block");
24516
24503
  const data2 = editorGetBlockData(editor, block);
24517
24504
  const text2 = data2.text;
24518
- assert(logger$3L, text2, "no text in block");
24505
+ assert(logger$3K, text2, "no text in block");
24519
24506
  return text2;
24520
24507
  }
24521
24508
  function editorGetBlockTextEx(editor, block, length) {
@@ -24523,7 +24510,7 @@ var __publicField = (obj, key, value) => {
24523
24510
  }
24524
24511
  function editorGetBoxData(editor, box) {
24525
24512
  const block = getParentBlock(box);
24526
- assert(logger$3L, block, "no parent block");
24513
+ assert(logger$3K, block, "no parent block");
24527
24514
  const text2 = editorGetBlockText(editor, block);
24528
24515
  const id = getBoxId(box);
24529
24516
  const op = text2.find((op2) => {
@@ -24533,60 +24520,60 @@ var __publicField = (obj, key, value) => {
24533
24520
  }
24534
24521
  return false;
24535
24522
  });
24536
- assert(logger$3L, op, "failed to find box");
24523
+ assert(logger$3K, op, "failed to find box");
24537
24524
  return op.attributes;
24538
24525
  }
24539
- const logger$3K = getLogger("block-text");
24526
+ const logger$3J = getLogger("block-text");
24540
24527
  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}`);
24528
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24529
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24530
+ assert(logger$3J, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24544
24531
  const newOffset = getNextValidOffset(block, offset);
24545
24532
  const length = newOffset - offset;
24546
24533
  if (length === 0) {
24547
- assert(logger$3K, false, `no text after offset: ${offset}`);
24534
+ assert(logger$3J, false, `no text after offset: ${offset}`);
24548
24535
  }
24549
24536
  const text2 = editorGetBlockText(editor, block);
24550
24537
  const { middle } = splitToThree(text2, offset, length);
24551
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24538
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24552
24539
  const op = middle[0];
24553
24540
  if (isBoxOp(op)) {
24554
24541
  return " ";
24555
24542
  }
24556
- assert(logger$3K, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24543
+ assert(logger$3J, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24557
24544
  return op.insert;
24558
24545
  }
24559
24546
  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}`);
24547
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24548
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24549
+ assert(logger$3J, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24563
24550
  const newOffset = getPrevValidOffset(block, offset);
24564
24551
  const length = offset - newOffset;
24565
24552
  if (length === 0) {
24566
- assert(logger$3K, false, `no text before offset: ${offset}`);
24553
+ assert(logger$3J, false, `no text before offset: ${offset}`);
24567
24554
  }
24568
24555
  const text2 = editorGetBlockText(editor, block);
24569
24556
  const { middle } = splitToThree(text2, newOffset, length);
24570
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24557
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24571
24558
  const op = middle[0];
24572
24559
  if (isBoxOp(op)) {
24573
24560
  return " ";
24574
24561
  }
24575
- assert(logger$3K, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24562
+ assert(logger$3J, op.insert.length === 1 || op.insert.length === 2, "invalid op");
24576
24563
  return op.insert;
24577
24564
  }
24578
24565
  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}`);
24566
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24567
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24568
+ assert(logger$3J, offset > 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24582
24569
  const newOffset = getPrevValidOffset(block, offset);
24583
24570
  const length = offset - newOffset;
24584
24571
  if (length === 0) {
24585
- assert(logger$3K, false, `no text before offset: ${offset}`);
24572
+ assert(logger$3J, false, `no text before offset: ${offset}`);
24586
24573
  }
24587
24574
  const text2 = editorGetBlockText(editor, block);
24588
24575
  const { middle } = splitToThree(text2, newOffset, length);
24589
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24576
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24590
24577
  const op = middle[0];
24591
24578
  if (isBoxOp(op)) {
24592
24579
  return {
@@ -24604,17 +24591,17 @@ var __publicField = (obj, key, value) => {
24604
24591
  };
24605
24592
  }
24606
24593
  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}`);
24594
+ assert(logger$3J, isTextKindBlock(editor, block), "not a text kind block");
24595
+ assert(logger$3J, isValidOffset(block, offset), "not a valid offset");
24596
+ assert(logger$3J, offset >= 0 && offset < getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
24610
24597
  const newOffset = getNextValidOffset(block, offset);
24611
24598
  const length = newOffset - offset;
24612
24599
  if (length === 0) {
24613
- assert(logger$3K, false, `no text after offset: ${offset}`);
24600
+ assert(logger$3J, false, `no text after offset: ${offset}`);
24614
24601
  }
24615
24602
  const text2 = editorGetBlockText(editor, block);
24616
24603
  const { middle } = splitToThree(text2, offset, length);
24617
- assert(logger$3K, middle.length === 1, "failed to split text to 3 parts");
24604
+ assert(logger$3J, middle.length === 1, "failed to split text to 3 parts");
24618
24605
  const op = middle[0];
24619
24606
  if (isBoxOp(op)) {
24620
24607
  return {
@@ -24678,7 +24665,7 @@ var __publicField = (obj, key, value) => {
24678
24665
  return null;
24679
24666
  }
24680
24667
  function findWordLeft(editor, block, offset) {
24681
- assert(logger$3K, isTextKindBlock(editor, block), "invalid blok type");
24668
+ assert(logger$3J, isTextKindBlock(editor, block), "invalid blok type");
24682
24669
  if (isEmptyTextBlock(editor, block)) {
24683
24670
  return 0;
24684
24671
  }
@@ -24706,7 +24693,7 @@ var __publicField = (obj, key, value) => {
24706
24693
  return startInfo.offset + startInfo.length;
24707
24694
  }
24708
24695
  function findWordEnd(editor, block, offset) {
24709
- assert(logger$3K, isTextKindBlock(editor, block), "invalid blok type");
24696
+ assert(logger$3J, isTextKindBlock(editor, block), "invalid blok type");
24710
24697
  if (isEmptyTextBlock(editor, block)) {
24711
24698
  return 0;
24712
24699
  }
@@ -24733,10 +24720,10 @@ var __publicField = (obj, key, value) => {
24733
24720
  return getBlockTextLength$6(editor, block);
24734
24721
  return startInfo.offset;
24735
24722
  }
24736
- const logger$3J = getLogger("text-box");
24723
+ const logger$3I = getLogger("text-box");
24737
24724
  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)}`);
24725
+ assert(logger$3I, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
24726
+ assert(logger$3I, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
24740
24727
  createElement("span", [], boxContent, boxData.text);
24741
24728
  }
24742
24729
  function convertTo$j(editor, boxData, doc2, type) {
@@ -24770,7 +24757,7 @@ var __publicField = (obj, key, value) => {
24770
24757
  updateBoxContent: updateBoxContent$7,
24771
24758
  convertTo: convertTo$i
24772
24759
  };
24773
- const logger$3I = getLogger("editor-boxes");
24760
+ const logger$3H = getLogger("editor-boxes");
24774
24761
  class EditorBoxes {
24775
24762
  constructor(editor) {
24776
24763
  __publicField(this, "boxes", /* @__PURE__ */ new Map());
@@ -24779,12 +24766,12 @@ var __publicField = (obj, key, value) => {
24779
24766
  registerBoxClass(boxClass) {
24780
24767
  const type = boxClass.boxType;
24781
24768
  const exists = this.boxes.get(type);
24782
- assert(logger$3I, !exists, `duplicated box type: ${type}`);
24769
+ assert(logger$3H, !exists, `duplicated box type: ${type}`);
24783
24770
  this.boxes.set(type, boxClass);
24784
24771
  }
24785
24772
  getBoxClass(type) {
24786
24773
  const exists = this.boxes.get(type);
24787
- assert(logger$3I, exists, `unknown box type: ${type}`);
24774
+ assert(logger$3H, exists, `unknown box type: ${type}`);
24788
24775
  return exists;
24789
24776
  }
24790
24777
  createBox(blockContent, box) {
@@ -25146,7 +25133,7 @@ var __publicField = (obj, key, value) => {
25146
25133
  return { classes, attributes: newAttributes, styles: newStyles };
25147
25134
  }
25148
25135
  }
25149
- const logger$3H = getLogger("editor-insertion");
25136
+ const logger$3G = getLogger("editor-insertion");
25150
25137
  class EditorInsertions {
25151
25138
  constructor(editor) {
25152
25139
  __publicField(this, "insertions", /* @__PURE__ */ new Map());
@@ -25155,12 +25142,12 @@ var __publicField = (obj, key, value) => {
25155
25142
  registerInsertionClass(insertionClass) {
25156
25143
  const type = insertionClass.insertionType;
25157
25144
  const exists = this.insertions.get(type);
25158
- assert(logger$3H, !exists, `duplicated insertion type: ${type}`);
25145
+ assert(logger$3G, !exists, `duplicated insertion type: ${type}`);
25159
25146
  this.insertions.set(type, insertionClass);
25160
25147
  }
25161
25148
  getInsertionClass(type) {
25162
25149
  const exists = this.insertions.get(type);
25163
- assert(logger$3H, exists, `unknown insertion type: ${type}`);
25150
+ assert(logger$3G, exists, `unknown insertion type: ${type}`);
25164
25151
  return exists;
25165
25152
  }
25166
25153
  createInsertionElement(type, id, attributes) {
@@ -25280,7 +25267,7 @@ var __publicField = (obj, key, value) => {
25280
25267
  };
25281
25268
  }
25282
25269
  }
25283
- const logger$3G = getLogger("editor-input");
25270
+ const logger$3F = getLogger("editor-input");
25284
25271
  class EditorInput$1 {
25285
25272
  constructor(editor, callbacks) {
25286
25273
  __publicField(this, "editor");
@@ -25402,7 +25389,7 @@ var __publicField = (obj, key, value) => {
25402
25389
  return;
25403
25390
  }
25404
25391
  this.callbacks.onCut(event);
25405
- logger$3G.debug("on cut");
25392
+ logger$3F.debug("on cut");
25406
25393
  });
25407
25394
  __publicField(this, "handlePaste", (event) => {
25408
25395
  if (event.isTrusted) {
@@ -25517,11 +25504,11 @@ var __publicField = (obj, key, value) => {
25517
25504
  this.callbacks.removeHandler(handler);
25518
25505
  }
25519
25506
  defaultInsertText(editor, containerId, blockIndex, offset, text2) {
25520
- assert(logger$3G, editor === this.editor, "invalid editor");
25507
+ assert(logger$3F, editor === this.editor, "invalid editor");
25521
25508
  this.callbacks.defaultInsertText(editor, containerId, blockIndex, offset, text2);
25522
25509
  }
25523
25510
  defaultHandleKeydown(editor, event) {
25524
- assert(logger$3G, editor === this.editor, "invalid editor");
25511
+ assert(logger$3F, editor === this.editor, "invalid editor");
25525
25512
  return this.callbacks.defaultHandleKeydown(editor, event);
25526
25513
  }
25527
25514
  forEach(callback) {
@@ -25546,7 +25533,7 @@ var __publicField = (obj, key, value) => {
25546
25533
  input2.style.left = `${x / scale}px`;
25547
25534
  input2.style.top = `${y / scale}px`;
25548
25535
  }
25549
- const logger$3F = getLogger("editor-caret");
25536
+ const logger$3E = getLogger("editor-caret");
25550
25537
  function getFirefoxVersion() {
25551
25538
  const userAgent = window.navigator.userAgent;
25552
25539
  const match = userAgent.match(/Firefox\/(\d+)\./);
@@ -25609,11 +25596,11 @@ var __publicField = (obj, key, value) => {
25609
25596
  return;
25610
25597
  }
25611
25598
  const { range } = this.editor.selection;
25612
- assert(logger$3F, range.isCollapsed, "range is not collapsed");
25599
+ assert(logger$3E, range.isCollapsed, "range is not collapsed");
25613
25600
  const pos = range.start;
25614
- assert(logger$3F, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
25601
+ assert(logger$3E, pos instanceof EditorSimpleBlockPosition, "only simple block position can has caret");
25615
25602
  const block = this.editor.getBlockById(pos.blockId);
25616
- assert(logger$3F, isTextKindBlock(this.editor, block), "only text kind block can has caret");
25603
+ assert(logger$3E, isTextKindBlock(this.editor, block), "only text kind block can has caret");
25617
25604
  let rect;
25618
25605
  const compositionSpan = block.querySelector("span.inputting-insertion");
25619
25606
  if (compositionSpan) {
@@ -25651,7 +25638,7 @@ var __publicField = (obj, key, value) => {
25651
25638
  clearAllSelection(editor);
25652
25639
  editor.selection.range.getSelectedBlocks().forEach((s) => updateBlockSelection(editor, s.block, s.start, s.end));
25653
25640
  }
25654
- const logger$3E = getLogger("editor-dom");
25641
+ const logger$3D = getLogger("editor-dom");
25655
25642
  function editorGetClientHeight(editor) {
25656
25643
  const scrollContainer = getScrollContainer$1(editor.rootContainer);
25657
25644
  return scrollContainer.clientHeight;
@@ -25739,7 +25726,7 @@ var __publicField = (obj, key, value) => {
25739
25726
  }
25740
25727
  function editorScrollIntoView(editor) {
25741
25728
  if (!isElementVisible(editor.rootContainer)) {
25742
- logger$3E.warn("editorScrollIntoView: editor is not visible");
25729
+ logger$3D.warn("editorScrollIntoView: editor is not visible");
25743
25730
  return;
25744
25731
  }
25745
25732
  const rootClientRect = editor.rootContainer.getBoundingClientRect();
@@ -25804,7 +25791,7 @@ var __publicField = (obj, key, value) => {
25804
25791
  const { start, end } = range;
25805
25792
  return start.blockId === getBlockId(firstChildBlock) && start.offset === 0 && end.blockId === getBlockId(lastChildBlock) && end.offset === getBlockTextLength$6(editor, lastChildBlock);
25806
25793
  }
25807
- const logger$3D = getLogger("range-in-block");
25794
+ const logger$3C = getLogger("range-in-block");
25808
25795
  function rangeInBlock(block, range) {
25809
25796
  const editor = range.getEditor();
25810
25797
  const start = editor.getBlockById(range.start.blockId);
@@ -25825,16 +25812,16 @@ var __publicField = (obj, key, value) => {
25825
25812
  while (prevBlock && !blocks.has(getBlockId(prevBlock))) {
25826
25813
  prevBlock = getPrevVisibleBlock(prevBlock);
25827
25814
  }
25828
- assert(logger$3D, prevBlock, "no prev block while deleting a block");
25815
+ assert(logger$3C, prevBlock, "no prev block while deleting a block");
25829
25816
  newRange = createBlockSimpleRange(editor, prevBlock, getBlockTextLength$6(editor, prevBlock));
25830
25817
  } else {
25831
25818
  const nextBlock = getNextVisibleBlock(block);
25832
- assert(logger$3D, nextBlock, "no prev and next block while deleting a block");
25819
+ assert(logger$3C, nextBlock, "no prev and next block while deleting a block");
25833
25820
  newRange = createBlockSimpleRange(editor, nextBlock, 0);
25834
25821
  }
25835
25822
  return newRange;
25836
25823
  }
25837
- const logger$3C = getLogger("block-to-html");
25824
+ const logger$3B = getLogger("block-to-html");
25838
25825
  function blockToHtml(editor, blockData, doc2, path) {
25839
25826
  const blockClass = getBlockClassByType(editor, blockData.type);
25840
25827
  if (blockClass.convertTo) {
@@ -25843,15 +25830,15 @@ var __publicField = (obj, key, value) => {
25843
25830
  if (blockClass.blockKind !== "text") {
25844
25831
  return `[${blockData.type}]`;
25845
25832
  }
25846
- assert(logger$3C, blockData.text, "no text");
25833
+ assert(logger$3B, blockData.text, "no text");
25847
25834
  const plainText = toPlainText(blockData.text);
25848
25835
  return `<div>${escapeHtmlText(plainText)}</div>`;
25849
25836
  }
25850
- const logger$3B = getLogger("block-to-text");
25837
+ const logger$3A = getLogger("block-to-text");
25851
25838
  function textBlockToText(editor, ops, doc2) {
25852
25839
  let text2 = "";
25853
25840
  ops.forEach((op) => {
25854
- assert(logger$3B, typeof op.insert === "string", "invalid op");
25841
+ assert(logger$3A, typeof op.insert === "string", "invalid op");
25855
25842
  if (op.attributes && op.attributes.box === true) {
25856
25843
  const box = op.attributes;
25857
25844
  const boxClass = editor.editorBoxes.getBoxClass(box.type);
@@ -25877,7 +25864,7 @@ var __publicField = (obj, key, value) => {
25877
25864
  if (blockClass.blockKind !== "text") {
25878
25865
  return `[${blockData.type}]`;
25879
25866
  }
25880
- assert(logger$3B, blockData.text, "no text");
25867
+ assert(logger$3A, blockData.text, "no text");
25881
25868
  const plainText = textBlockToText(editor, blockData.text, doc2);
25882
25869
  return plainText;
25883
25870
  }
@@ -25910,11 +25897,11 @@ var __publicField = (obj, key, value) => {
25910
25897
  const markdown = lines.join("\n");
25911
25898
  return markdown;
25912
25899
  }
25913
- const logger$3A = getLogger("get-text-position");
25900
+ const logger$3z = getLogger("get-text-position");
25914
25901
  function editorGetTextPosition(editor, insertPos) {
25915
25902
  const pos = insertPos != null ? insertPos : editor.selection.range.start;
25916
25903
  if (!(pos instanceof EditorSimpleBlockPosition)) {
25917
- assert(logger$3A, false, `invalid insert pos type: ${typeof pos}`);
25904
+ assert(logger$3z, false, `invalid insert pos type: ${typeof pos}`);
25918
25905
  }
25919
25906
  const { blockId } = pos;
25920
25907
  const block = editor.getBlockById(blockId);
@@ -26002,14 +25989,14 @@ var __publicField = (obj, key, value) => {
26002
25989
  return attributes;
26003
25990
  }
26004
25991
  }
26005
- const logger$3z = getLogger("insert-text");
25992
+ const logger$3y = getLogger("insert-text");
26006
25993
  function getTextAttributes(editor, containerId, blockIndex, offset) {
26007
25994
  var _a, _b;
26008
25995
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26009
- assert(logger$3z, blockData, "no block data");
26010
- assert(logger$3z, blockData.text, "no block text");
25996
+ assert(logger$3y, blockData, "no block data");
25997
+ assert(logger$3y, blockData.text, "no block text");
26011
25998
  if (getTextLength(blockData.text) === 0) {
26012
- assert(logger$3z, offset === 0, "invalid text offset");
25999
+ assert(logger$3y, offset === 0, "invalid text offset");
26013
26000
  return BlockAttributesHandler.get(editor).getEmptyBlockTextAttributes(blockData.id);
26014
26001
  }
26015
26002
  if (offset === 0) {
@@ -26056,7 +26043,7 @@ var __publicField = (obj, key, value) => {
26056
26043
  }
26057
26044
  for (let i = 0; i < text2.length; i++) {
26058
26045
  const op = text2[i];
26059
- assert(logger$3z, typeof op.insert === "string", "invalid text op, no insert");
26046
+ assert(logger$3y, typeof op.insert === "string", "invalid text op, no insert");
26060
26047
  const endPos = pos + getOpLength(op);
26061
26048
  if (endPos === start) {
26062
26049
  return false;
@@ -26070,8 +26057,8 @@ var __publicField = (obj, key, value) => {
26070
26057
  }
26071
26058
  function editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset) {
26072
26059
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26073
- assert(logger$3z, blockData, "no block data");
26074
- assert(logger$3z, blockData.text, "no block text");
26060
+ assert(logger$3y, blockData, "no block data");
26061
+ assert(logger$3y, blockData.text, "no block text");
26075
26062
  const attributes = getTextAttributes(editor, containerId, blockIndex, offset);
26076
26063
  if (attributes && Object.keys(attributes).includes("link")) {
26077
26064
  const inOp = checkRangeInOp(blockData.text, offset);
@@ -26090,21 +26077,21 @@ var __publicField = (obj, key, value) => {
26090
26077
  const { containerId, blockIndex, offset } = editorGetTextPosition(editor);
26091
26078
  editorInsertTextToBlockEx(editor, text2, containerId, blockIndex, offset);
26092
26079
  }
26093
- const logger$3y = getLogger("update-composition-text");
26080
+ const logger$3x = getLogger("update-composition-text");
26094
26081
  function editorUpdateCompositionText(editor) {
26095
26082
  const pos = editor.selection.range.start;
26096
26083
  if (!(pos instanceof EditorSimpleBlockPosition)) {
26097
- assert(logger$3y, false, `invalid insert pos type: ${typeof pos}`);
26084
+ assert(logger$3x, false, `invalid insert pos type: ${typeof pos}`);
26098
26085
  }
26099
26086
  const { blockId } = pos;
26100
26087
  const block = editor.getBlockById(blockId);
26101
- assert(logger$3y, isTextKindBlock(editor, block), "not a text kind block");
26088
+ assert(logger$3x, isTextKindBlock(editor, block), "not a text kind block");
26102
26089
  const container = getParentContainer(block);
26103
26090
  const containerId = getContainerId(container);
26104
26091
  const blockIndex = getBlockIndex(block);
26105
26092
  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");
26093
+ assert(logger$3x, blockData, "no block data in doc");
26094
+ assert(logger$3x, blockData.text, "no text data in text block");
26108
26095
  const blockContent = getBlockContent(block);
26109
26096
  updateBlockContent$1(editor, getBlockPath(block), blockId, blockContent, blockData.text);
26110
26097
  }
@@ -26116,25 +26103,25 @@ var __publicField = (obj, key, value) => {
26116
26103
  const block = editor.getBlockById(blockData.id);
26117
26104
  return block;
26118
26105
  }
26119
- const logger$3x = getLogger("delete-block-text");
26106
+ const logger$3w = getLogger("delete-block-text");
26120
26107
  function editorDeleteBlockText(editor, block, offset, count, options) {
26121
26108
  if (!editor.isBlockWritable(block)) {
26122
- logger$3x.error("block is not writable");
26109
+ logger$3w.error("block is not writable");
26123
26110
  return 0;
26124
26111
  }
26125
- assert(logger$3x, isTextKindBlock(editor, block), "block is not a text kind block");
26112
+ assert(logger$3w, isTextKindBlock(editor, block), "block is not a text kind block");
26126
26113
  const container = getParentContainer(block);
26127
26114
  const containerId = getContainerId(container);
26128
26115
  const blockIndex = getBlockIndex(block);
26129
26116
  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");
26117
+ assert(logger$3w, blockData, "no block data in doc");
26118
+ assert(logger$3w, blockData.text, "no text data in text block");
26132
26119
  let from = offset;
26133
26120
  if (!isValidOffset(block, offset)) {
26134
26121
  from = getPrevValidOffset(block, from);
26135
26122
  }
26136
26123
  let to = offset + count;
26137
- assert(logger$3x, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
26124
+ assert(logger$3w, to <= getBlockTextLength$6(editor, block), `invalid offset and count: ${offset}, ${count}`);
26138
26125
  if (!isValidOffset(block, to)) {
26139
26126
  to = getNextValidOffset(block, to);
26140
26127
  }
@@ -26143,7 +26130,7 @@ var __publicField = (obj, key, value) => {
26143
26130
  editor.doc.localUpdateBlockText(containerId, blockIndex, actions2, options);
26144
26131
  return deleteCount;
26145
26132
  }
26146
- const logger$3w = getLogger("break-text-block");
26133
+ const logger$3v = getLogger("break-text-block");
26147
26134
  function copyBlockAttributes(editor, block) {
26148
26135
  const blockData = editor.getBlockData(block);
26149
26136
  const quoted = blockData.quoted;
@@ -26155,8 +26142,8 @@ var __publicField = (obj, key, value) => {
26155
26142
  return {};
26156
26143
  }
26157
26144
  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}`);
26145
+ assert(logger$3v, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
26146
+ assert(logger$3v, offset >= 0 && offset <= getBlockTextLength$6(editor, block), `invalid offset: ${offset}`);
26160
26147
  const container = getParentContainer(block);
26161
26148
  const containerId = getContainerId(container);
26162
26149
  const blockIndex = getBlockIndex(block);
@@ -26186,7 +26173,7 @@ var __publicField = (obj, key, value) => {
26186
26173
  };
26187
26174
  }
26188
26175
  }
26189
- assert(logger$3w, isValidOffset(block, offset), "not a valid offset");
26176
+ assert(logger$3v, isValidOffset(block, offset), "not a valid offset");
26190
26177
  const text2 = editorGetBlockText(editor, block);
26191
26178
  const { right } = splitText(text2, offset);
26192
26179
  const rightLength = getTextLength(right);
@@ -26212,12 +26199,12 @@ var __publicField = (obj, key, value) => {
26212
26199
  newBlock
26213
26200
  };
26214
26201
  }
26215
- const logger$3v = getLogger("prepare-insert-new-block");
26202
+ const logger$3u = getLogger("prepare-insert-new-block");
26216
26203
  function editorPrepareInsertNewBlock(editor, containerId, blockIndex) {
26217
26204
  if (containerId && blockIndex !== void 0 && blockIndex !== null) {
26218
26205
  const container = editor.getContainerById(containerId);
26219
26206
  const blocks = getChildBlocks(container);
26220
- assert(logger$3v, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
26207
+ assert(logger$3u, blockIndex >= 0 && blockIndex <= blocks.length, `invalid blockIndex: ${blockIndex}`);
26221
26208
  return {
26222
26209
  containerId,
26223
26210
  blockIndex
@@ -26251,15 +26238,15 @@ var __publicField = (obj, key, value) => {
26251
26238
  blockIndex: getBlockIndex(newBlock)
26252
26239
  };
26253
26240
  }
26254
- const logger$3u = getLogger("auto-insert-block");
26241
+ const logger$3t = getLogger("auto-insert-block");
26255
26242
  function editorAutoInsertBlock(editor, blockData, containerId, blockIndex, newRange, insertBlockOptions) {
26256
26243
  const result = editorPrepareInsertNewBlock(editor, containerId, blockIndex);
26257
- assert(logger$3u, result, `not an valid insert position: ${editor.selection.range}`);
26244
+ assert(logger$3t, result, `not an valid insert position: ${editor.selection.range}`);
26258
26245
  const defaultPos = { blockId: blockData.id, offset: 0 };
26259
26246
  const defaultRange = { anchor: defaultPos, focus: defaultPos };
26260
26247
  return editorInsertBlock(editor, result.containerId, result.blockIndex, blockData, newRange != null ? newRange : defaultRange, insertBlockOptions);
26261
26248
  }
26262
- const logger$3t = getLogger("delete-block");
26249
+ const logger$3s = getLogger("delete-block");
26263
26250
  function getAllChildContainers(editor, blockData, containerIds) {
26264
26251
  if (blockData.children) {
26265
26252
  containerIds.push(...blockData.children);
@@ -26276,7 +26263,7 @@ var __publicField = (obj, key, value) => {
26276
26263
  const containerId = getContainerId(container);
26277
26264
  const blockIndex = getBlockIndex(block);
26278
26265
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
26279
- assert(logger$3t, blockData, "no block data in doc");
26266
+ assert(logger$3s, blockData, "no block data in doc");
26280
26267
  editor.doc.localDeleteBlock(containerId, blockIndex, createEditorSelectionRange(editor, { anchor: newRange.start, focus: newRange.end }));
26281
26268
  return blockData;
26282
26269
  }
@@ -26322,15 +26309,15 @@ var __publicField = (obj, key, value) => {
26322
26309
  });
26323
26310
  editor.doc.localDeleteChildContainers(containerIds);
26324
26311
  }
26325
- const logger$3s = getLogger("merge-text-block");
26312
+ const logger$3r = getLogger("merge-text-block");
26326
26313
  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");
26314
+ assert(logger$3r, isTextKindBlock(editor, block1), "only text block can be merged");
26315
+ assert(logger$3r, isTextKindBlock(editor, block2), "only text block can be merged");
26329
26316
  const data1 = editorGetBlockData(editor, block1);
26330
26317
  const data2 = editorGetBlockData(editor, block2);
26331
26318
  const text1 = data1.text;
26332
26319
  const text2 = data2.text;
26333
- assert(logger$3s, text1 && text2, "block data has no text");
26320
+ assert(logger$3r, text1 && text2, "block data has no text");
26334
26321
  const container = getParentContainer(block1);
26335
26322
  const containerId = getContainerId(container);
26336
26323
  const blockIndex = getBlockIndex(block1);
@@ -26340,15 +26327,15 @@ var __publicField = (obj, key, value) => {
26340
26327
  editorDeleteBlock(editor, block2, newRange);
26341
26328
  return block;
26342
26329
  }
26343
- const logger$3r = getLogger("clear-selected-contents");
26330
+ const logger$3q = getLogger("clear-selected-contents");
26344
26331
  function deleteTextBlockSelection(editor, selectedBlock) {
26345
- assert(logger$3r, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
26332
+ assert(logger$3q, isTextKindBlock(editor, selectedBlock.block), "not a text kind block");
26346
26333
  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");
26334
+ assert(logger$3q, start.isSimple(), "not a simple block position");
26335
+ assert(logger$3q, end.isSimple(), "not a simple block position");
26349
26336
  const startOffset = start.offset;
26350
26337
  const endOffset = end.offset;
26351
- assert(logger$3r, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
26338
+ assert(logger$3q, startOffset <= endOffset, `invalid delete text offset: ${startOffset}, ${endOffset}`);
26352
26339
  if (startOffset === endOffset) {
26353
26340
  return;
26354
26341
  }
@@ -26373,7 +26360,7 @@ var __publicField = (obj, key, value) => {
26373
26360
  return;
26374
26361
  }
26375
26362
  if (isEmbedBlock(block) || start.isSimple()) {
26376
- assert(logger$3r, end.isSimple(), "invalid range");
26363
+ assert(logger$3q, end.isSimple(), "invalid range");
26377
26364
  const container = getParentContainer(block);
26378
26365
  const blockIndex = getBlockIndex(block);
26379
26366
  const newBlock = editor.insertTextBlock("", getContainerId(container), blockIndex);
@@ -26381,8 +26368,8 @@ var __publicField = (obj, key, value) => {
26381
26368
  editor.deleteBlock(block);
26382
26369
  return;
26383
26370
  }
26384
- assert(logger$3r, isComplexKindBlock(editor, block), "invalid block kind");
26385
- assert(logger$3r, !start.isSimple() && !end.isSimple(), "invalid range");
26371
+ assert(logger$3q, isComplexKindBlock(editor, block), "invalid block kind");
26372
+ assert(logger$3q, !start.isSimple() && !end.isSimple(), "invalid range");
26386
26373
  complexBlockGetSelectedContainers(editor, block, start, end);
26387
26374
  const containers = editor.selection.range.getSelectedContainers();
26388
26375
  containers.forEach((container, index2) => {
@@ -26399,7 +26386,7 @@ var __publicField = (obj, key, value) => {
26399
26386
  return;
26400
26387
  }
26401
26388
  const selectedBlocks = range.getSelectedBlocks();
26402
- assert(logger$3r, selectedBlocks.length > 0, "no selected block");
26389
+ assert(logger$3q, selectedBlocks.length > 0, "no selected block");
26403
26390
  if (selectedBlocks.length === 1) {
26404
26391
  clearOneBlock(editor, selectedBlocks[0]);
26405
26392
  return;
@@ -26407,7 +26394,7 @@ var __publicField = (obj, key, value) => {
26407
26394
  const firstSelectedBlock = selectedBlocks[0];
26408
26395
  const firstBlock = firstSelectedBlock.block;
26409
26396
  const container = getParentContainer(firstBlock);
26410
- assert(logger$3r, selectedBlocks.length > 1, "no selected block");
26397
+ assert(logger$3q, selectedBlocks.length > 1, "no selected block");
26411
26398
  const lastSelectedBlock = selectedBlocks[selectedBlocks.length - 1];
26412
26399
  const lastBlock2 = lastSelectedBlock.block;
26413
26400
  if (isTextKindBlock(editor, firstBlock)) {
@@ -26437,7 +26424,7 @@ var __publicField = (obj, key, value) => {
26437
26424
  }
26438
26425
  const prevBlock = getPrevBlock(firstBlock);
26439
26426
  const nextBlock = getNextBlock(lastBlock2);
26440
- assert(logger$3r, prevBlock || nextBlock, "no prev or next block");
26427
+ assert(logger$3q, prevBlock || nextBlock, "no prev or next block");
26441
26428
  selectedBlocks.forEach((selectedBlock) => editor.deleteBlock(selectedBlock.block));
26442
26429
  }
26443
26430
  function editorClearSelectedContents(editor, selectionRange) {
@@ -26456,7 +26443,7 @@ var __publicField = (obj, key, value) => {
26456
26443
  editor.emit("afterClearSelection", editor);
26457
26444
  });
26458
26445
  }
26459
- const logger$3q = getLogger("core");
26446
+ const logger$3p = getLogger("core");
26460
26447
  function editorUpdateBlockText(editor, block, ops, options) {
26461
26448
  const container = getParentContainer(block);
26462
26449
  const containerId = getContainerId(container);
@@ -26469,7 +26456,7 @@ var __publicField = (obj, key, value) => {
26469
26456
  }
26470
26457
  function editorSetBlockText(editor, block, newText, options) {
26471
26458
  if (!editor.isBlockWritable(block)) {
26472
- logger$3q.error("block is not writable");
26459
+ logger$3p.error("block is not writable");
26473
26460
  return;
26474
26461
  }
26475
26462
  const oldText = editor.getBlockText(block);
@@ -26482,7 +26469,7 @@ var __publicField = (obj, key, value) => {
26482
26469
  const ops = RichText.diff(oldText, newText);
26483
26470
  return editorUpdateBlockText(editor, block, ops);
26484
26471
  }
26485
- const logger$3p = getLogger("update-block-data");
26472
+ const logger$3o = getLogger("update-block-data");
26486
26473
  function editorUpdateBlockData(editor, block, data2, newRange, options) {
26487
26474
  const container = getParentContainer(block);
26488
26475
  const containerId = getContainerId(container);
@@ -26499,17 +26486,17 @@ var __publicField = (obj, key, value) => {
26499
26486
  if (oldKey === "id" || oldKey === "type" || oldKey === "text") {
26500
26487
  return;
26501
26488
  }
26502
- logger$3p.debug(`delete key: ${oldKey}`);
26489
+ logger$3o.debug(`delete key: ${oldKey}`);
26503
26490
  delta.delete.push(oldKey);
26504
26491
  }
26505
26492
  });
26506
26493
  const entries = Object.entries(data2);
26507
26494
  entries.forEach(([key, value]) => {
26508
- assert(logger$3p, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
26495
+ assert(logger$3o, key !== "id" && key !== "type", `invalid block data delta, ${key}`);
26509
26496
  const oldValue = oldData[key];
26510
26497
  if (value === null || value === void 0) {
26511
26498
  if (oldValue !== null && oldValue !== void 0) {
26512
- logger$3p.debug(`delete key: ${key}`);
26499
+ logger$3o.debug(`delete key: ${key}`);
26513
26500
  delta.delete.push(key);
26514
26501
  }
26515
26502
  return;
@@ -26527,10 +26514,10 @@ var __publicField = (obj, key, value) => {
26527
26514
  }
26528
26515
  }
26529
26516
  if (oldKeys.has(key)) {
26530
- logger$3p.debug(`replace key: ${key}`);
26517
+ logger$3o.debug(`replace key: ${key}`);
26531
26518
  delta.delete.push(key);
26532
26519
  } else {
26533
- logger$3p.debug(`insert key: ${key}`);
26520
+ logger$3o.debug(`insert key: ${key}`);
26534
26521
  }
26535
26522
  delta.insert[key] = value;
26536
26523
  });
@@ -26575,13 +26562,13 @@ var __publicField = (obj, key, value) => {
26575
26562
  comments: {}
26576
26563
  };
26577
26564
  }
26578
- const logger$3o = getLogger("clone-block");
26565
+ const logger$3n = getLogger("clone-block");
26579
26566
  function cloneBlock(editorBlocks, oldDoc, data2, info) {
26580
26567
  var _a;
26581
26568
  const blockClass = editorBlocks.getBlockClass(data2.type);
26582
26569
  if (blockClass.blockToDoc) {
26583
26570
  return blockClass.blockToDoc(oldDoc, data2, (oldDoc2, childBlock) => {
26584
- assert(logger$3o, data2 !== childBlock, "invalid child block");
26571
+ assert(logger$3n, data2 !== childBlock, "invalid child block");
26585
26572
  return cloneBlock(editorBlocks, oldDoc2, data2, info);
26586
26573
  }, info);
26587
26574
  }
@@ -26594,7 +26581,7 @@ var __publicField = (obj, key, value) => {
26594
26581
  }
26595
26582
  const newChildContainerId = genId();
26596
26583
  const childBlocks = oldDoc.blocks[oldChildContainerId];
26597
- assert(logger$3o, Array.isArray(childBlocks), "invalid child blocks");
26584
+ assert(logger$3n, Array.isArray(childBlocks), "invalid child blocks");
26598
26585
  const newDocs = childBlocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
26599
26586
  const newDoc = mergeDocs(newDocs);
26600
26587
  const { root: root2, ...childContainersData } = newDoc.blocks;
@@ -26623,7 +26610,7 @@ var __publicField = (obj, key, value) => {
26623
26610
  if (key.startsWith(prefix1)) {
26624
26611
  const keyContent = key.substring(prefix1.length);
26625
26612
  const newKey = `${newContainerId}/${keyContent}`;
26626
- logger$3o.debug(`replace key: ${key} -> ${newKey}`);
26613
+ logger$3n.debug(`replace key: ${key} -> ${newKey}`);
26627
26614
  return newKey;
26628
26615
  }
26629
26616
  }
@@ -26632,7 +26619,7 @@ var __publicField = (obj, key, value) => {
26632
26619
  if (key.startsWith(prefix2)) {
26633
26620
  const keyContent = key.substring(prefix2.length);
26634
26621
  const newKey = `${newContainerId}_${keyContent}`;
26635
- logger$3o.debug(`replace key: ${key} -> ${newKey}`);
26622
+ logger$3n.debug(`replace key: ${key} -> ${newKey}`);
26636
26623
  return newKey;
26637
26624
  }
26638
26625
  }
@@ -26662,7 +26649,7 @@ var __publicField = (obj, key, value) => {
26662
26649
  }
26663
26650
  function cloneChildContainer(editorBlocks, oldDoc, containerId, info) {
26664
26651
  const blocks = oldDoc.blocks[containerId];
26665
- assert(logger$3o, Array.isArray(blocks), "invalid child blocks");
26652
+ assert(logger$3n, Array.isArray(blocks), "invalid child blocks");
26666
26653
  const newDocs = blocks.map((c) => cloneBlock(editorBlocks, oldDoc, c, info));
26667
26654
  const newDoc = mergeDocs(newDocs);
26668
26655
  return newDoc;
@@ -26671,19 +26658,24 @@ var __publicField = (obj, key, value) => {
26671
26658
  const docs = doc2.blocks.root.map((b) => cloneBlock(editor.editorBlocks, doc2, b, info));
26672
26659
  return cloneDeep__default.default(mergeDocs(docs));
26673
26660
  }
26674
- const logger$3n = getLogger("insert-doc");
26661
+ const logger$3m = getLogger("insert-doc");
26675
26662
  function editorInsertDoc(editor, block, offset, insertedDoc, cloneDocResult) {
26663
+ var _a;
26676
26664
  if (isComplexKindBlock(editor, block)) {
26677
- logger$3n.warn("failed to insert doc into a complex block");
26665
+ logger$3m.warn("failed to insert doc into a complex block");
26678
26666
  return;
26679
26667
  }
26680
26668
  const doc2 = cloneDoc(editor, insertedDoc, cloneDocResult);
26681
26669
  const container = getParentContainer(block);
26682
26670
  const blockIndex = getBlockIndex(block);
26683
26671
  const containerId = getContainerId(container);
26672
+ if (doc2.blocks.root.length === 1 && isTextKindBlockType(editor, doc2.blocks.root[0].type)) {
26673
+ editor.insertTextToBlock(block, offset, (_a = doc2.blocks.root[0].text) != null ? _a : []);
26674
+ return;
26675
+ }
26684
26676
  editor.doc.beginBatchUpdate();
26685
26677
  editor.undoManager.runInGroup(() => {
26686
- var _a, _b, _c;
26678
+ var _a2, _b, _c;
26687
26679
  const childContainers = [];
26688
26680
  Object.entries(doc2.blocks).forEach(([containerId2, blocks2]) => {
26689
26681
  if (containerId2 === "root")
@@ -26708,7 +26700,7 @@ var __publicField = (obj, key, value) => {
26708
26700
  }
26709
26701
  return;
26710
26702
  }
26711
- assert(logger$3n, isTextKindBlock(editor, block), "not a text block");
26703
+ assert(logger$3m, isTextKindBlock(editor, block), "not a text block");
26712
26704
  if (isEmptyTextBlock(editor, block)) {
26713
26705
  const blockIndex2 = getBlockIndex(block);
26714
26706
  let lastBlock22;
@@ -26748,7 +26740,7 @@ var __publicField = (obj, key, value) => {
26748
26740
  if (blocks.length === 1) {
26749
26741
  const newBlock2 = blocks[0];
26750
26742
  if (isTextKindBlockType(editor, newBlock2.type)) {
26751
- editor.insertTextToBlock(block, offset, (_a = newBlock2.text) != null ? _a : []);
26743
+ editor.insertTextToBlock(block, offset, (_a2 = newBlock2.text) != null ? _a2 : []);
26752
26744
  return;
26753
26745
  }
26754
26746
  editor.breakTextBlock(block, offset);
@@ -26840,11 +26832,11 @@ var __publicField = (obj, key, value) => {
26840
26832
  editor.deleteBlock(block);
26841
26833
  }
26842
26834
  }
26843
- const logger$3m = getLogger("add-text-attribute");
26835
+ const logger$3l = getLogger("add-text-attribute");
26844
26836
  function editorRemoveTextAttribute(editor, block, range, attributeName) {
26845
26837
  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");
26838
+ assert(logger$3l, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26839
+ assert(logger$3l, attributeName, "invalid attribute name");
26848
26840
  const oldText = editor.getBlockText(block);
26849
26841
  const newText = rangeRemoveAttribute(start.offset, end.offset - start.offset, oldText, attributeName, void 0, { ignoreValue: true });
26850
26842
  editor.setBlockText(block, newText);
@@ -26852,8 +26844,8 @@ var __publicField = (obj, key, value) => {
26852
26844
  }
26853
26845
  function editorAddTextAttribute(editor, block, range, attributeName, value) {
26854
26846
  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");
26847
+ assert(logger$3l, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26848
+ assert(logger$3l, attributeName, "invalid attribute name");
26857
26849
  const oldText = editor.getBlockText(block);
26858
26850
  const newText = rangeAddAttribute(start.offset, end.offset - start.offset, oldText, attributeName, value);
26859
26851
  editor.setBlockText(block, newText);
@@ -26861,7 +26853,7 @@ var __publicField = (obj, key, value) => {
26861
26853
  }
26862
26854
  function editorSetTextColor(editor, block, range, type, value) {
26863
26855
  const { start, end } = range;
26864
- assert(logger$3m, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26856
+ assert(logger$3l, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
26865
26857
  const oldText = editor.getBlockText(block);
26866
26858
  const newText = rangeSetTextColor(start.offset, end.offset - start.offset, oldText, type, value);
26867
26859
  editor.setBlockText(block, newText);
@@ -26950,10 +26942,10 @@ var __publicField = (obj, key, value) => {
26950
26942
  });
26951
26943
  return [color, backgroundColor];
26952
26944
  }
26953
- const logger$3l = getLogger("move-complex-block-position");
26945
+ const logger$3k = getLogger("move-complex-block-position");
26954
26946
  function moveComplexBlockPosition(editor, old, type) {
26955
26947
  const block = editor.getBlockById(old.blockId);
26956
- assert(logger$3l, isComplexKindBlock(editor, block), "is not a complex block");
26948
+ assert(logger$3k, isComplexKindBlock(editor, block), "is not a complex block");
26957
26949
  const blockClass = getComplexBlockClass(editor, block);
26958
26950
  const focusedContainer = editor.getContainerById(old.childContainerId);
26959
26951
  const nextContainer = blockClass.getNextContainer(editor, block, focusedContainer, type, { noWrap: true });
@@ -26962,24 +26954,24 @@ var __publicField = (obj, key, value) => {
26962
26954
  }
26963
26955
  return createComplexBlockPosition(block, getContainerId(nextContainer));
26964
26956
  }
26965
- const logger$3k = getLogger("move-simple-block-position");
26957
+ const logger$3j = getLogger("move-simple-block-position");
26966
26958
  function getFirstChildBlockInComplexBlock(editor, complexBlock) {
26967
26959
  const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
26968
26960
  if (containers.length === 0) {
26969
- logger$3k.warn("complex block has not any child container, not loaded?");
26961
+ logger$3j.warn("complex block has not any child container, not loaded?");
26970
26962
  return null;
26971
26963
  }
26972
- assert(logger$3k, containers.length > 0, "complex block has not any child container");
26964
+ assert(logger$3j, containers.length > 0, "complex block has not any child container");
26973
26965
  const container = containers[0];
26974
26966
  return getFirstChildBlock(container);
26975
26967
  }
26976
26968
  function getLastChildBlockInComplexBlock(editor, complexBlock) {
26977
26969
  const containers = complexBlockGetAllChildContainers(editor, complexBlock, { visibleOnly: true });
26978
26970
  if (containers.length === 0) {
26979
- logger$3k.warn("complex block has not any child container, not loaded?");
26971
+ logger$3j.warn("complex block has not any child container, not loaded?");
26980
26972
  return null;
26981
26973
  }
26982
- assert(logger$3k, containers.length > 0, "complex block has not any child container");
26974
+ assert(logger$3j, containers.length > 0, "complex block has not any child container");
26983
26975
  const container = containers[containers.length - 1];
26984
26976
  return getLastChildBlock(container);
26985
26977
  }
@@ -27024,8 +27016,8 @@ var __publicField = (obj, key, value) => {
27024
27016
  return null;
27025
27017
  }
27026
27018
  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");
27019
+ assert(logger$3j, parentComplexBlock, "child container has not parent block");
27020
+ assert(logger$3j, isComplexKindBlock(editor, parentComplexBlock), "is not a complex block");
27029
27021
  const nextContainer = getComplexBlockClass(editor, parentComplexBlock).getNextContainer(editor, parentComplexBlock, container, type);
27030
27022
  if (nextContainer) {
27031
27023
  if (isFindPrev(type)) {
@@ -27047,7 +27039,7 @@ var __publicField = (obj, key, value) => {
27047
27039
  return null;
27048
27040
  }
27049
27041
  const parentBlock = getParentBlock(container);
27050
- assert(logger$3k, parentBlock, "child container has not parent block");
27042
+ assert(logger$3j, parentBlock, "child container has not parent block");
27051
27043
  if (isFindPrev(type)) {
27052
27044
  const prev = getPrevBlock(parentBlock);
27053
27045
  if (prev) {
@@ -27102,7 +27094,7 @@ var __publicField = (obj, key, value) => {
27102
27094
  }
27103
27095
  if (!targetBlock) {
27104
27096
  if (isComplexKindBlock(editor, block) && complexBlockGetAllChildContainers(editor, block).length === 0) {
27105
- logger$3k.warn("complex block has not any child container, not loaded?");
27097
+ logger$3j.warn("complex block has not any child container, not loaded?");
27106
27098
  targetBlock = direction === "ArrowDown" || direction === "ArrowRight" ? getNextVisibleBlock(block) : getPrevVisibleBlock(block);
27107
27099
  }
27108
27100
  }
@@ -27249,10 +27241,10 @@ var __publicField = (obj, key, value) => {
27249
27241
  editorAdjustSelection(editor, "ArrowUp", "select");
27250
27242
  return true;
27251
27243
  }
27252
- const logger$3j = getLogger("word-offset");
27244
+ const logger$3i = getLogger("word-offset");
27253
27245
  function editorGetWordLeftPos(editor, type) {
27254
27246
  const old = editor.selection.range.focus;
27255
- assert(logger$3j, old.isSimple(), "invalid range type");
27247
+ assert(logger$3i, old.isSimple(), "invalid range type");
27256
27248
  const block = editor.getBlockById(old.blockId);
27257
27249
  if (isEmptyTextBlock(editor, block)) {
27258
27250
  return createSimpleBlockPosition(block, 0, "home");
@@ -27277,7 +27269,7 @@ var __publicField = (obj, key, value) => {
27277
27269
  }
27278
27270
  function editorGetWordRightPos(editor, type) {
27279
27271
  const old = editor.selection.range.focus;
27280
- assert(logger$3j, old.isSimple(), "invalid range type");
27272
+ assert(logger$3i, old.isSimple(), "invalid range type");
27281
27273
  const block = editor.getBlockById(old.blockId);
27282
27274
  if (isEmptyTextBlock(editor, block)) {
27283
27275
  return createSimpleBlockPosition(block, 0, "end");
@@ -27389,10 +27381,10 @@ var __publicField = (obj, key, value) => {
27389
27381
  editor.selection.setSelection(editor.selection.getAnchorPos(), pos);
27390
27382
  return true;
27391
27383
  }
27392
- const logger$3i = getLogger("line-offset");
27384
+ const logger$3h = getLogger("line-offset");
27393
27385
  function editorGetLineHomePos(editor) {
27394
27386
  const old = editor.selection.range.focus;
27395
- assert(logger$3i, old.isSimple(), "invalid range type");
27387
+ assert(logger$3h, old.isSimple(), "invalid range type");
27396
27388
  const block = editor.getBlockById(old.blockId);
27397
27389
  if (old.offset === 0 || !isTextKindBlock(editor, block)) {
27398
27390
  const newPos2 = createSimpleBlockPosition(block, 0, "home");
@@ -27409,7 +27401,7 @@ var __publicField = (obj, key, value) => {
27409
27401
  }
27410
27402
  function editorGetLineEndPos(editor) {
27411
27403
  const old = editor.selection.range.focus;
27412
- assert(logger$3i, old.isSimple(), "invalid range type");
27404
+ assert(logger$3h, old.isSimple(), "invalid range type");
27413
27405
  const block = editor.getBlockById(old.blockId);
27414
27406
  if (old.offset === getBlockTextLength$6(editor, block) || !isTextKindBlock(editor, block)) {
27415
27407
  const newPos2 = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
@@ -27509,7 +27501,7 @@ var __publicField = (obj, key, value) => {
27509
27501
  editorPageDownScroll(editor);
27510
27502
  return true;
27511
27503
  }
27512
- const logger$3h = getLogger("table-scroll");
27504
+ const logger$3g = getLogger("table-scroll");
27513
27505
  class DomEventHandler {
27514
27506
  constructor(editor, dom, name, handler, data2, options) {
27515
27507
  __publicField(this, "handleEvent", (event) => {
@@ -27541,7 +27533,7 @@ var __publicField = (obj, key, value) => {
27541
27533
  const existsHandlers = this.handlers.get(element);
27542
27534
  if (existsHandlers) {
27543
27535
  if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
27544
- logger$3h.warn(`event has already registered: ${eventName}`);
27536
+ logger$3g.warn(`event has already registered: ${eventName}`);
27545
27537
  return;
27546
27538
  }
27547
27539
  existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
@@ -27651,7 +27643,7 @@ var __publicField = (obj, key, value) => {
27651
27643
  });
27652
27644
  return true;
27653
27645
  }
27654
- const logger$3g = getLogger("select-all");
27646
+ const logger$3f = getLogger("select-all");
27655
27647
  function isContainerSelectedAllChildBlocks(container, range) {
27656
27648
  const firstBlock = getFirstChildBlock(container);
27657
27649
  const lastBlock2 = getLastChildBlock(container);
@@ -27666,8 +27658,8 @@ var __publicField = (obj, key, value) => {
27666
27658
  return range.start.blockId === blockId && range.start.childContainerId === getContainerId(first) && range.end.blockId === blockId && range.end.childContainerId === getContainerId(last);
27667
27659
  }
27668
27660
  function selectComplexBlock(editor, block) {
27669
- assert(logger$3g, block, "no parent block");
27670
- assert(logger$3g, isComplexKindBlock(editor, block), "not a complex block");
27661
+ assert(logger$3f, block, "no parent block");
27662
+ assert(logger$3f, isComplexKindBlock(editor, block), "not a complex block");
27671
27663
  const containers = getComplexBlockClass(editor, block).getChildContainers(editor, block);
27672
27664
  const first = containers[0];
27673
27665
  const last = containers[containers.length - 1];
@@ -27703,13 +27695,13 @@ var __publicField = (obj, key, value) => {
27703
27695
  selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
27704
27696
  return false;
27705
27697
  }
27706
- assert(logger$3g, !range.isSimple(), "invalid range type");
27698
+ assert(logger$3f, !range.isSimple(), "invalid range type");
27707
27699
  if (isComplexBlockSelectedAllChildContainer(focusedBlock, range)) {
27708
27700
  selectParentContainer(editor, focusedBlock);
27709
27701
  return false;
27710
27702
  }
27711
- assert(logger$3g, focusedBlock, "no parent block");
27712
- assert(logger$3g, isComplexKindBlock(editor, focusedBlock), "not a complex block");
27703
+ assert(logger$3f, focusedBlock, "no parent block");
27704
+ assert(logger$3f, isComplexKindBlock(editor, focusedBlock), "not a complex block");
27713
27705
  selectComplexBlock(editor, focusedBlock);
27714
27706
  return true;
27715
27707
  }
@@ -27824,7 +27816,7 @@ var __publicField = (obj, key, value) => {
27824
27816
  }
27825
27817
  return cloned;
27826
27818
  }
27827
- const logger$3f = getLogger("selected-block-to-doc");
27819
+ const logger$3e = getLogger("selected-block-to-doc");
27828
27820
  function appendBlockChildren(editor, data2, doc2) {
27829
27821
  if (!data2.children)
27830
27822
  return;
@@ -27845,7 +27837,7 @@ var __publicField = (obj, key, value) => {
27845
27837
  if (isTextKindBlock(editor, selectedBlock.block)) {
27846
27838
  const start = selectedBlock.start;
27847
27839
  const end = selectedBlock.end;
27848
- assert(logger$3f, data2.text, "no block text");
27840
+ assert(logger$3e, data2.text, "no block text");
27849
27841
  if (start.offset === end.offset) {
27850
27842
  return {
27851
27843
  blocks: {
@@ -27879,8 +27871,8 @@ var __publicField = (obj, key, value) => {
27879
27871
  comments: {}
27880
27872
  };
27881
27873
  }
27882
- assert(logger$3f, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
27883
- assert(logger$3f, data2.children, "no children");
27874
+ assert(logger$3e, isComplexKindBlock(editor, selectedBlock.block), "not complex block");
27875
+ assert(logger$3e, data2.children, "no children");
27884
27876
  const ret = {
27885
27877
  blocks: {
27886
27878
  root: [
@@ -27898,9 +27890,9 @@ var __publicField = (obj, key, value) => {
27898
27890
  const end = createSimpleBlockPosition(block, getBlockTextLength$6(editor, block), "end");
27899
27891
  return selectedBlockToDoc(editor, { block, start, end });
27900
27892
  }
27901
- const logger$3e = getLogger("block-to-doc");
27893
+ const logger$3d = getLogger("block-to-doc");
27902
27894
  function blocksToDoc(editor, blocks) {
27903
- assert(logger$3e, blocks.length > 0, "invalid params, no blocks");
27895
+ assert(logger$3d, blocks.length > 0, "invalid params, no blocks");
27904
27896
  const docs = blocks.map((b) => blockToDoc(editor, b));
27905
27897
  return mergeDocs(docs);
27906
27898
  }
@@ -27920,7 +27912,7 @@ var __publicField = (obj, key, value) => {
27920
27912
  const newDocs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
27921
27913
  return mergeDocs(newDocs);
27922
27914
  }
27923
- const logger$3d = getLogger("ensure-block-visible");
27915
+ const logger$3c = getLogger("ensure-block-visible");
27924
27916
  function ensureBlockVisible(editor, block) {
27925
27917
  var _a;
27926
27918
  while (block) {
@@ -27930,16 +27922,16 @@ var __publicField = (obj, key, value) => {
27930
27922
  return;
27931
27923
  }
27932
27924
  const parentComplexBlock = getParentBlock(container);
27933
- assert(logger$3d, parentComplexBlock, "no parent block");
27925
+ assert(logger$3c, parentComplexBlock, "no parent block");
27934
27926
  const parentComplexBlockClass = getBlockClass(editor, parentComplexBlock);
27935
27927
  if (parentComplexBlockClass.isChildContainerVisible && !((_a = parentComplexBlockClass.isChildContainerVisible) == null ? void 0 : _a.call(parentComplexBlockClass, editor, parentComplexBlock, container))) {
27936
- assert(logger$3d, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
27928
+ assert(logger$3c, parentComplexBlockClass.showChildContainer, "no showChildContainer method");
27937
27929
  parentComplexBlockClass.showChildContainer(editor, parentComplexBlock, container);
27938
27930
  }
27939
27931
  block = parentComplexBlock;
27940
27932
  }
27941
27933
  }
27942
- const logger$3c = getLogger("editor-selection");
27934
+ const logger$3b = getLogger("editor-selection");
27943
27935
  class EditorSelection {
27944
27936
  constructor(editor) {
27945
27937
  __publicField(this, "editor");
@@ -27952,7 +27944,7 @@ var __publicField = (obj, key, value) => {
27952
27944
  }
27953
27945
  const range = this.range;
27954
27946
  if (rangeInBlock(deletedBlock, range)) {
27955
- logger$3c.debug("adjust selection because remote deleted current block");
27947
+ logger$3b.debug("adjust selection because remote deleted current block");
27956
27948
  const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
27957
27949
  this.setRange(newRange, { noScroll: true });
27958
27950
  }
@@ -28077,14 +28069,14 @@ var __publicField = (obj, key, value) => {
28077
28069
  if (pos.isSimple()) {
28078
28070
  const ok = pos.offset >= 0 && pos.offset <= getBlockTextLength$6(this.editor, block);
28079
28071
  if (!ok) {
28080
- assert(logger$3c, false, "invalid block position, out of range");
28072
+ assert(logger$3b, false, "invalid block position, out of range");
28081
28073
  }
28082
28074
  } else {
28083
28075
  const childContainerId = pos.childContainerId;
28084
28076
  const container = this.editor.getContainerById(childContainerId);
28085
28077
  const ok = !!container;
28086
28078
  if (!ok) {
28087
- assert(logger$3c, false, "invalid complex block position, no container found");
28079
+ assert(logger$3b, false, "invalid complex block position, no container found");
28088
28080
  }
28089
28081
  }
28090
28082
  }
@@ -28145,7 +28137,7 @@ var __publicField = (obj, key, value) => {
28145
28137
  let container = getParentContainer(block);
28146
28138
  while (isChildContainer(container)) {
28147
28139
  const parentBlock = getParentBlock(container);
28148
- assert(logger$3c, parentBlock, "parent block not found");
28140
+ assert(logger$3b, parentBlock, "parent block not found");
28149
28141
  addClass(parentBlock, "child-focused");
28150
28142
  container = getParentContainer(parentBlock);
28151
28143
  }
@@ -28255,15 +28247,15 @@ var __publicField = (obj, key, value) => {
28255
28247
  editor.undoManager.redo();
28256
28248
  return true;
28257
28249
  }
28258
- const logger$3b = getLogger("delete-text");
28250
+ const logger$3a = getLogger("delete-text");
28259
28251
  function editorDeleteText(editor, type, count, insertPos) {
28260
28252
  const pos = insertPos != null ? insertPos : editor.selection.range.start;
28261
28253
  if (!(pos instanceof EditorSimpleBlockPosition)) {
28262
- assert(logger$3b, false, `invalid insert pos type: ${typeof pos}`);
28254
+ assert(logger$3a, false, `invalid insert pos type: ${typeof pos}`);
28263
28255
  }
28264
28256
  const { blockId } = pos;
28265
28257
  const block = editor.getBlockById(blockId);
28266
- assert(logger$3b, isTextKindBlock(editor, block), "block is not a text kind block");
28258
+ assert(logger$3a, isTextKindBlock(editor, block), "block is not a text kind block");
28267
28259
  let { offset } = pos;
28268
28260
  if (type === "backward") {
28269
28261
  if (offset - count < 0) {
@@ -28293,7 +28285,7 @@ var __publicField = (obj, key, value) => {
28293
28285
  }
28294
28286
  return false;
28295
28287
  }
28296
- const logger$3a = getLogger("handle-backspace");
28288
+ const logger$39 = getLogger("handle-backspace");
28297
28289
  function tryDeleteEmptyBlock(editor, block) {
28298
28290
  if (!isEmptyTextBlock(editor, block)) {
28299
28291
  return;
@@ -28333,7 +28325,7 @@ var __publicField = (obj, key, value) => {
28333
28325
  }
28334
28326
  } else {
28335
28327
  tryDeleteEmptyBlock(editor, block);
28336
- assert(logger$3a, isEmbedBlock(prevBlock), "prev block is not embed block");
28328
+ assert(logger$39, isEmbedBlock(prevBlock), "prev block is not embed block");
28337
28329
  editor.selection.selectBlock(prevBlock, 1);
28338
28330
  }
28339
28331
  } else {
@@ -28360,7 +28352,6 @@ var __publicField = (obj, key, value) => {
28360
28352
  editor.deleteBlock(block);
28361
28353
  }
28362
28354
  }
28363
- const logger$39 = getLogger("word-offset");
28364
28355
  function handleEditorDelete(editor, event) {
28365
28356
  if (!editor.selection.range.isCollapsed()) {
28366
28357
  editor.clearSelectedContents();
@@ -28395,130 +28386,6 @@ var __publicField = (obj, key, value) => {
28395
28386
  editor.deleteBlock(block);
28396
28387
  }
28397
28388
  }
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
28389
  function handleEditorEnterEvent$1(editor, event) {
28523
28390
  if (isFullSelectedOneComplexBlock(editor)) {
28524
28391
  const focusedBlock2 = editor.getFocusedBlock();
@@ -28740,42 +28607,6 @@ var __publicField = (obj, key, value) => {
28740
28607
  return true;
28741
28608
  });
28742
28609
  }
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
28610
  function editorHandleBackspace(editor, event) {
28780
28611
  if (editor.readonly || !editor.isWritable()) {
28781
28612
  return false;
@@ -28866,10 +28697,6 @@ ${codeText}
28866
28697
  __proto__: null,
28867
28698
  editorHandleEnter,
28868
28699
  editorHandleDelete,
28869
- editorHandleDeleteLeftWord,
28870
- editorHandleDeleteRightWord,
28871
- editorHandleDeleteAfterWords,
28872
- editorHandleDeleteRightChar,
28873
28700
  editorHandleBackspace,
28874
28701
  editorHandleInsertBr,
28875
28702
  editorHandlePastePlainText,
@@ -28879,35 +28706,23 @@ ${codeText}
28879
28706
  }, Symbol.toStringTag, { value: "Module" }));
28880
28707
  const DefaultShortcuts = {
28881
28708
  "ArrowDown": editorMoveDown,
28882
- "Ctrl+N": editorMoveDown,
28883
28709
  "ArrowUp": editorMoveUp,
28884
- "Ctrl+P": editorMoveUp,
28885
28710
  "ArrowLeft": editorMoveLeft,
28886
- "Ctrl+B": editorMoveLeft,
28887
28711
  "ArrowRight": editorMoveRight,
28888
- "Ctrl+F": editorMoveRight,
28889
28712
  "Shift+ArrowDown": editorSelectDown,
28890
28713
  "Shift+ArrowUp": editorSelectUp,
28891
28714
  "Shift+ArrowLeft": editorSelectLeft,
28892
28715
  "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,
28716
+ "CtrlOrCmd+ArrowLeft": editorMoveWordLeft,
28717
+ "CtrlOrCmd+ArrowRight": editorMoveWordEnd,
28718
+ "CtrlOrCmd+Shift+ArrowLeft": editorSelectWordLeft,
28719
+ "CtrlOrCmd+Shift+ArrowRight": editorSelectWordEnd,
28903
28720
  "CtrlOrCmd+ArrowUp": editorMoveHome,
28904
28721
  "CtrlOrCmd+ArrowDown": editorMoveEnd,
28905
28722
  "CtrlOrCmd+Shift+ArrowUp": editorSelectHome,
28906
28723
  "CtrlOrCmd+Shift+ArrowDown": editorSelectEnd,
28907
28724
  "CtrlOrCmd+A": editorSelectAll,
28908
- "Ctrl+A": editorMoveLineHome,
28909
28725
  "Home": editorMoveLineHome,
28910
- "Ctrl+E": editorMoveLineEnd,
28911
28726
  "End": editorMoveLineEnd,
28912
28727
  "Shift+Home": editorSelectLineHome,
28913
28728
  "Shift+End": editorSelectLineEnd,
@@ -28915,13 +28730,6 @@ ${codeText}
28915
28730
  "PageDown": editorMovePageDown,
28916
28731
  "Shift+PageUp": editorSelectPageUp,
28917
28732
  "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
28733
  "CtrlOrCmd+Z": editorUndo,
28926
28734
  "CtrlOrCmd+Shift+Z": editorRedo,
28927
28735
  "Enter": editorHandleEnter,
@@ -41581,6 +41389,7 @@ ${codeText}
41581
41389
  this.options.onClickItem(this, item);
41582
41390
  }, 300, { leading: true, trailing: false }));
41583
41391
  __publicField(this, "handleShow", (menu) => {
41392
+ this.menu.content.classList.add("auto-suggest-menu");
41584
41393
  });
41585
41394
  __publicField(this, "handleShown", () => {
41586
41395
  var _a, _b;
@@ -42115,21 +41924,8 @@ ${codeText}
42115
41924
  }
42116
41925
  const textColorItem = "";
42117
41926
  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
41927
  class TextColorItem extends tinyTypedEmitter.TypedEmitter {
42132
- constructor(editor, storageName = STORAGE_NAME) {
41928
+ constructor(editor, storageName = "color-item") {
42133
41929
  super();
42134
41930
  __publicField(this, "id", "text-color-item");
42135
41931
  __publicField(this, "name", i18n$1.t("colorPalette.name"));
@@ -42207,7 +42003,7 @@ ${codeText}
42207
42003
  this.children.push(this.colorPaletteItem);
42208
42004
  this.element = createColorButton();
42209
42005
  this.bindColorButtonEvents();
42210
- const existColors = getColorsFromLocalStorage(editor);
42006
+ const existColors = this.getColorsFromLocalStorage();
42211
42007
  this.latestColors = existColors;
42212
42008
  this.setCurrentButtonColor(this.latestColors);
42213
42009
  this.element.setAttribute(`data-editor-tooltip-${editor.clientId}`, this.name);
@@ -42219,6 +42015,18 @@ ${codeText}
42219
42015
  this.element.addEventListener("click", this.handleButtonClick);
42220
42016
  }
42221
42017
  }
42018
+ getColorsFromLocalStorage() {
42019
+ const colors = [null, null];
42020
+ const color = Number.parseInt(this.editor.settingsProvider.getItem(`${this.storageName}-color`) || "", 10);
42021
+ const backgroundColor = Number.parseInt(this.editor.settingsProvider.getItem(`${this.storageName}-backgroundColor`) || `${DEFAULT_BG_COLOR}`, 10);
42022
+ if (!Number.isNaN(color)) {
42023
+ colors[0] = color;
42024
+ }
42025
+ if (!Number.isNaN(backgroundColor)) {
42026
+ colors[1] = backgroundColor;
42027
+ }
42028
+ return colors;
42029
+ }
42222
42030
  destroy() {
42223
42031
  this.colorPaletteItem.destroy();
42224
42032
  this.element.removeEventListener("click", this.handleButtonClick);
@@ -42601,6 +42409,32 @@ ${codeText}
42601
42409
  }
42602
42410
  return this.menu.handleKeydown(event);
42603
42411
  }
42412
+ async handleBeforePasteDoc(editor, doc2) {
42413
+ var _a;
42414
+ if (!((_a = this.menu) == null ? void 0 : _a.isVisible)) {
42415
+ return false;
42416
+ }
42417
+ const shouldCancelAutoSuggest = () => {
42418
+ var _a2;
42419
+ const blocks = doc2.blocks.root;
42420
+ if (blocks.length !== 1) {
42421
+ return true;
42422
+ }
42423
+ const block = blocks[0];
42424
+ if (((_a2 = editor.editorBlocks.getBlockClass(block.type)) == null ? void 0 : _a2.blockKind) !== "text") {
42425
+ return true;
42426
+ }
42427
+ const text2 = toPlainText(block.text || []);
42428
+ if (text2.length > 50) {
42429
+ return true;
42430
+ }
42431
+ return false;
42432
+ };
42433
+ if (shouldCancelAutoSuggest()) {
42434
+ this.menu.close();
42435
+ }
42436
+ return false;
42437
+ }
42604
42438
  popup(block, offset, leftText, trigger) {
42605
42439
  this.anchor = {
42606
42440
  blockId: getBlockId(block),
@@ -42656,6 +42490,13 @@ ${codeText}
42656
42490
  }
42657
42491
  return this.triggerPopup(editor, containerId, blockIndex, insertOffset, text2);
42658
42492
  }
42493
+ async handleAfterPasteDoc(editor, doc2, cloneDocResult) {
42494
+ var _a;
42495
+ if ((_a = this.menu) == null ? void 0 : _a.isVisible) {
42496
+ this.resetItems();
42497
+ }
42498
+ return false;
42499
+ }
42659
42500
  handleUpdateCompositionText(editor, containerId, blockIndex, offset, end) {
42660
42501
  var _a;
42661
42502
  const start = editor.selection.range.start;
@@ -49669,7 +49510,7 @@ ${codeText}
49669
49510
  }
49670
49511
  return handleDragList(editor, draggedBlock, targetBlock, insertPos);
49671
49512
  }
49672
- function executeShortcut$3(editor, type) {
49513
+ function executeShortcut$1(editor, type) {
49673
49514
  if (!editor.isWritable()) {
49674
49515
  return false;
49675
49516
  }
@@ -49683,8 +49524,8 @@ ${codeText}
49683
49524
  return true;
49684
49525
  }
49685
49526
  const ListBlockShortcuts = {
49686
- "Shift+CtrlOrCmd+L": (editor) => executeShortcut$3(editor, "ordered-list"),
49687
- "Shift+CtrlOrCmd+U": (editor) => executeShortcut$3(editor, "unordered-list")
49527
+ "Shift+CtrlOrCmd+L": (editor) => executeShortcut$1(editor, "ordered-list"),
49528
+ "Shift+CtrlOrCmd+U": (editor) => executeShortcut$1(editor, "unordered-list")
49688
49529
  };
49689
49530
  function getBlockPadding$1(block) {
49690
49531
  const padding = block.getAttribute("block-padding-level");
@@ -60007,31 +59848,6 @@ $$${mathData.mathjaxText}$$
60007
59848
  return editor.addCustom("overflow-tooltip-helper", () => new OverflowTooltipHelper(editor));
60008
59849
  }
60009
59850
  }
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
59851
  const TextCommands = {
60036
59852
  "text/style-bold": "bold",
60037
59853
  "text/style-italic": "italic",
@@ -60047,7 +59863,7 @@ $$${mathData.mathjaxText}$$
60047
59863
  const styleCommands = blockCommands.filter((command) => styleCommandsSet.has(command.id));
60048
59864
  return styleCommands;
60049
59865
  }
60050
- function executeShortcut$1(editor, style2) {
59866
+ function executeShortcut(editor, style2) {
60051
59867
  if (!editor.isWritable()) {
60052
59868
  return false;
60053
59869
  }
@@ -60092,37 +59908,13 @@ $$${mathData.mathjaxText}$$
60092
59908
  return shortcuts2;
60093
59909
  };
60094
59910
  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"),
59911
+ "CtrlOrCmd+B": (editor) => executeShortcut(editor, "style-bold"),
59912
+ "CtrlOrCmd+I": (editor) => executeShortcut(editor, "style-italic"),
59913
+ "CtrlOrCmd+U": (editor) => executeShortcut(editor, "style-underline"),
59914
+ "CtrlOrCmd+D": (editor) => executeShortcut(editor, "style-strikethrough"),
59915
+ "CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
60100
59916
  ...headingShortcut()
60101
59917
  };
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
59918
  const zhCN$p = {
60127
59919
  quickMenu: {
60128
59920
  basic: {
@@ -60878,7 +60670,7 @@ $$${mathData.mathjaxText}$$
60878
60670
  __publicField(this, "updateButtonColor", (range) => {
60879
60671
  const currentTextColor = editorRangeGetColor(this.editor, range, this.getEmptyTextBlockColor);
60880
60672
  this.colorItem.setCurrentTextColors(currentTextColor);
60881
- const lastButtonColor = getColorsFromLocalStorage(this.editor);
60673
+ const lastButtonColor = this.colorItem.getColorsFromLocalStorage();
60882
60674
  this.colorItem.setCurrentButtonColor(lastButtonColor);
60883
60675
  });
60884
60676
  __publicField(this, "setActiveAttribute", (type, value) => {
@@ -72290,6 +72082,16 @@ ${codeText}
72290
72082
  return false;
72291
72083
  }
72292
72084
  }
72085
+ const existsAutoSuggest = document.querySelector(".auto-suggest-menu");
72086
+ if (existsAutoSuggest) {
72087
+ const root2 = existsAutoSuggest.closest("[data-tippy-root]");
72088
+ if (root2) {
72089
+ const visibility = window.getComputedStyle(root2).visibility;
72090
+ if (visibility === "visible") {
72091
+ return false;
72092
+ }
72093
+ }
72094
+ }
72293
72095
  this.button.clearCheckedState();
72294
72096
  this.button.show(docs);
72295
72097
  this.event = event;
@@ -74871,19 +74673,7 @@ ${content}
74871
74673
  const containerId = getContainerId(container);
74872
74674
  for (let i = 0; i < images.length; i++) {
74873
74675
  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
- }
74676
+ await insertEmptyEmbedBlock(editor, "image", containerId, insertIndex + i, { file: image });
74887
74677
  }
74888
74678
  }
74889
74679
  }
@@ -88621,11 +88411,9 @@ ${data2.flowchartText}
88621
88411
  FindReplaceShortcuts,
88622
88412
  BlockPaddingShortcuts,
88623
88413
  TextStyleShortcuts,
88624
- AlignShortcuts,
88625
88414
  AutoLinkShortcuts,
88626
88415
  DefaultShortcuts,
88627
88416
  ListBlockShortcuts,
88628
- TextColorShortcuts,
88629
88417
  ...options.shortcuts || []
88630
88418
  ],
88631
88419
  colors: [
@@ -88744,7 +88532,7 @@ ${data2.flowchartText}
88744
88532
  }
88745
88533
  }
88746
88534
  });
88747
- editor.version = "2.2.23-beta.1";
88535
+ editor.version = "2.2.23";
88748
88536
  return editor;
88749
88537
  }
88750
88538
  function isDoc(doc2) {
@@ -88839,7 +88627,7 @@ ${data2.flowchartText}
88839
88627
  });
88840
88628
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88841
88629
  OnesEditorToolbar.register(editor);
88842
- editor.version = "2.2.23-beta.1";
88630
+ editor.version = "2.2.23";
88843
88631
  return editor;
88844
88632
  }
88845
88633
  async function showDocVersions(editor, options, serverUrl) {
@@ -134577,7 +134365,6 @@ ${data2.flowchartText}
134577
134365
  exports2.AbstractProvider = AbstractProvider;
134578
134366
  exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
134579
134367
  exports2.AlignProvider = AlignProvider;
134580
- exports2.AlignShortcuts = AlignShortcuts;
134581
134368
  exports2.AnchorBox = AnchorBox;
134582
134369
  exports2.AuthError = AuthError;
134583
134370
  exports2.AuthHeader = AuthHeader;
@@ -134696,7 +134483,6 @@ ${data2.flowchartText}
134696
134483
  exports2.TextBlock = TextBlock;
134697
134484
  exports2.TextBox = TextBox;
134698
134485
  exports2.TextColorItem = TextColorItem;
134699
- exports2.TextColorShortcuts = TextColorShortcuts;
134700
134486
  exports2.TextCommandProvider = TextCommandProvider;
134701
134487
  exports2.TextScriptProvider = TextScriptProvider;
134702
134488
  exports2.TextStyleShortcuts = TextStyleShortcuts;
@@ -134940,7 +134726,6 @@ ${data2.flowchartText}
134940
134726
  exports2.getBlockTextLength = getBlockTextLength$6;
134941
134727
  exports2.getBlockTools = getBlockTools;
134942
134728
  exports2.getBlockType = getBlockType;
134943
- exports2.getBlocksBetween = getBlocksBetween;
134944
134729
  exports2.getBlocksWidth = getBlocksWidth;
134945
134730
  exports2.getBoxContent = getBoxContent;
134946
134731
  exports2.getBoxId = getBoxId;
@@ -135120,7 +134905,7 @@ ${data2.flowchartText}
135120
134905
  exports2.loadJs = loadJs;
135121
134906
  exports2.loadJsPromise = loadJsPromise;
135122
134907
  exports2.lockers = lockers;
135123
- exports2.logger = logger$4e;
134908
+ exports2.logger = logger$4d;
135124
134909
  exports2.markdownToDoc = markdownToDoc;
135125
134910
  exports2.mergeCommands = mergeCommands;
135126
134911
  exports2.mergeDocs = mergeDocs;