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

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