@ones-editor/editor 2.2.8-beta.6 → 2.2.8-beta.8

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
@@ -2084,6 +2084,61 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
2084
2084
  height: 40px;
2085
2085
  transform: scaleX(0.5);
2086
2086
  background-color: var(--Fills-Vibrant-Secondary, rgba(127, 127, 127, 0.4));
2087
+ }div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer {
2088
+ position: absolute;
2089
+ background-color: transparent;
2090
+ border: 1px solid #0064ff;
2091
+ pointer-events: none;
2092
+ z-index: 1;
2093
+ display: none;
2094
+ }
2095
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active {
2096
+ display: block;
2097
+ }
2098
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper {
2099
+ position: absolute;
2100
+ width: 10px;
2101
+ height: 10px;
2102
+ background-color: #0064ff;
2103
+ border-radius: 50%;
2104
+ pointer-events: all;
2105
+ outline: 2px solid #fff;
2106
+ }
2107
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper::before {
2108
+ content: "";
2109
+ position: absolute;
2110
+ top: -3px;
2111
+ left: -3px;
2112
+ width: 16px;
2113
+ height: 16px;
2114
+ }
2115
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom {
2116
+ left: calc(50% - 5px);
2117
+ bottom: -5px;
2118
+ cursor: ns-resize;
2119
+ }
2120
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left {
2121
+ left: -5px;
2122
+ top: -5px;
2123
+ cursor: nwse-resize;
2124
+ }
2125
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right {
2126
+ right: -5px;
2127
+ top: -5px;
2128
+ cursor: nesw-resize;
2129
+ }
2130
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left {
2131
+ left: -5px;
2132
+ bottom: -5px;
2133
+ cursor: nesw-resize;
2134
+ }
2135
+ div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right {
2136
+ right: -5px;
2137
+ bottom: -5px;
2138
+ cursor: nwse-resize;
2139
+ }
2140
+ div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-type=block-tools] .block-resizer {
2141
+ display: none;
2087
2142
  }div[data-type=editor-block].block-exclusive:after {
2088
2143
  content: attr(data-exclusive-tips);
2089
2144
  position: absolute;
@@ -2889,61 +2944,6 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] div[data
2889
2944
  }
2890
2945
  div.editor-root.readonly div.editor-content div[data-type=editor-block] div[data-type=block-content] > span.status-box .box-status-common:hover {
2891
2946
  outline: none;
2892
- }div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer {
2893
- position: absolute;
2894
- background-color: transparent;
2895
- border: 1px solid #0064ff;
2896
- pointer-events: none;
2897
- z-index: 1;
2898
- display: none;
2899
- }
2900
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active {
2901
- display: block;
2902
- }
2903
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper {
2904
- position: absolute;
2905
- width: 10px;
2906
- height: 10px;
2907
- background-color: #0064ff;
2908
- border-radius: 50%;
2909
- pointer-events: all;
2910
- outline: 2px solid #fff;
2911
- }
2912
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper::before {
2913
- content: "";
2914
- position: absolute;
2915
- top: -3px;
2916
- left: -3px;
2917
- width: 16px;
2918
- height: 16px;
2919
- }
2920
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom {
2921
- left: calc(50% - 5px);
2922
- bottom: -5px;
2923
- cursor: ns-resize;
2924
- }
2925
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left {
2926
- left: -5px;
2927
- top: -5px;
2928
- cursor: nwse-resize;
2929
- }
2930
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right {
2931
- right: -5px;
2932
- top: -5px;
2933
- cursor: nesw-resize;
2934
- }
2935
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left {
2936
- left: -5px;
2937
- bottom: -5px;
2938
- cursor: nesw-resize;
2939
- }
2940
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right {
2941
- right: -5px;
2942
- bottom: -5px;
2943
- cursor: nwse-resize;
2944
- }
2945
- div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-type=block-tools] .block-resizer {
2946
- display: none;
2947
2947
  }.before-content, .editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content] .images .image-container.active::before, .editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected:not(.focused) [data-type=block-content] .images .image-container::before {
2948
2948
  content: " ";
2949
2949
  position: absolute;
@@ -11556,7 +11556,7 @@ var __publicField = (obj, key, value) => {
11556
11556
  }
11557
11557
  this.editor.selectionHandler.handleMouseDown(event, { autoScroll: true });
11558
11558
  }
11559
- this.editor.input.focus();
11559
+ this.editor.input.focus({ preventScroll: true });
11560
11560
  });
11561
11561
  __publicField(this, "handleMouseMove", (event) => {
11562
11562
  assert(logger$4p, this.mouseDownEvent, "no mouse down event");
@@ -13104,7 +13104,8 @@ var __publicField = (obj, key, value) => {
13104
13104
  if (pointX < rect.left) {
13105
13105
  x = rect.left;
13106
13106
  } else if (pointX > rect.right) {
13107
- x = rect.right - 50;
13107
+ const offset = targetBlock && isTextKindBlock(editor, targetBlock) ? 3 : 50;
13108
+ x = rect.right - offset;
13108
13109
  }
13109
13110
  }
13110
13111
  for (let i = 0; i < yOffsets.length; i++) {
@@ -14453,10 +14454,6 @@ var __publicField = (obj, key, value) => {
14453
14454
  }
14454
14455
  if (isTextBlockContentBoxChild(child)) {
14455
14456
  const boxChild = child;
14456
- const nextChild = children[i + 1];
14457
- if (!nextChild) {
14458
- break;
14459
- }
14460
14457
  const prevChild = children[i - 1];
14461
14458
  if (prevChild) {
14462
14459
  if (endAtNewLine(prevChild, boxChild)) {
@@ -14473,6 +14470,10 @@ var __publicField = (obj, key, value) => {
14473
14470
  });
14474
14471
  }
14475
14472
  }
14473
+ const nextChild = children[i + 1];
14474
+ if (!nextChild) {
14475
+ break;
14476
+ }
14476
14477
  if (nextChildStartsNewLine(boxChild, nextChild)) {
14477
14478
  offset += 1;
14478
14479
  lineBreaks.push({
@@ -27430,7 +27431,7 @@ var __publicField = (obj, key, value) => {
27430
27431
  }
27431
27432
  const logger$3g = getLogger("table-scroll");
27432
27433
  class DomEventHandler {
27433
- constructor(editor, dom, name, handler, data2) {
27434
+ constructor(editor, dom, name, handler, data2, options) {
27434
27435
  __publicField(this, "handleEvent", (event) => {
27435
27436
  this.handler(this.editor, event, this.data);
27436
27437
  });
@@ -27439,7 +27440,7 @@ var __publicField = (obj, key, value) => {
27439
27440
  this.name = name;
27440
27441
  this.handler = handler;
27441
27442
  this.data = data2;
27442
- dom.addEventListener(name, this.handleEvent);
27443
+ dom.addEventListener(name, this.handleEvent, options);
27443
27444
  }
27444
27445
  destroy() {
27445
27446
  this.dom.removeEventListener(this.name, this.handleEvent);
@@ -27456,16 +27457,16 @@ var __publicField = (obj, key, value) => {
27456
27457
  this.handlers.delete(element);
27457
27458
  });
27458
27459
  }
27459
- addEventListener(element, eventName, eventHandler, data2) {
27460
+ addEventListener(element, eventName, eventHandler, data2, options) {
27460
27461
  const existsHandlers = this.handlers.get(element);
27461
27462
  if (existsHandlers) {
27462
27463
  if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
27463
27464
  logger$3g.warn(`event has already registered: ${eventName}`);
27464
27465
  return;
27465
27466
  }
27466
- existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2));
27467
+ existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
27467
27468
  } else {
27468
- const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2);
27469
+ const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options);
27469
27470
  this.handlers.set(element, [handler]);
27470
27471
  }
27471
27472
  }
@@ -39898,17 +39899,23 @@ ${codeText}
39898
39899
  return true;
39899
39900
  }
39900
39901
  if (event.key === "ArrowUp") {
39901
- const prev = this.getPrevItemIndex(this.getSelectedItemIndex());
39902
- this.startPauseMouseEnter();
39903
- this.selectItem(this.items[prev].id);
39904
- event.preventDefault();
39905
- event.stopPropagation();
39902
+ const curr = this.getSelectedItemIndex();
39903
+ const prev = this.getPrevItemIndex(curr);
39904
+ if (curr !== prev) {
39905
+ this.startPauseMouseEnter();
39906
+ this.selectItem(this.items[prev].id);
39907
+ event.preventDefault();
39908
+ event.stopPropagation();
39909
+ }
39906
39910
  } else if (event.key === "ArrowDown") {
39907
- const next2 = this.getNextItemIndex(this.getSelectedItemIndex());
39908
- this.startPauseMouseEnter();
39909
- this.selectItem(this.items[next2].id);
39910
- event.preventDefault();
39911
- event.stopPropagation();
39911
+ const curr = this.getSelectedItemIndex();
39912
+ const next2 = this.getNextItemIndex(curr);
39913
+ if (curr !== next2) {
39914
+ this.startPauseMouseEnter();
39915
+ this.selectItem(this.items[next2].id);
39916
+ event.preventDefault();
39917
+ event.stopPropagation();
39918
+ }
39912
39919
  } else if (event.key === "ArrowRight") {
39913
39920
  const item = this.getSelectedItem();
39914
39921
  if (item && item.children) {
@@ -40114,7 +40121,7 @@ ${codeText}
40114
40121
  this.emit("click", this, item, target);
40115
40122
  }
40116
40123
  createPopperOptions() {
40117
- var _a, _b;
40124
+ var _a, _b, _c;
40118
40125
  const popperOptions = { modifiers: [] };
40119
40126
  const overflowBoundary = this.options.overflowBoundary;
40120
40127
  const padding = this.options.padding;
@@ -40147,6 +40154,10 @@ ${codeText}
40147
40154
  }
40148
40155
  });
40149
40156
  }
40157
+ (_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
40158
+ name: "flip",
40159
+ enabled: false
40160
+ });
40150
40161
  return popperOptions;
40151
40162
  }
40152
40163
  destroy() {
@@ -40493,6 +40504,9 @@ ${codeText}
40493
40504
  static hasExistsCommandBar() {
40494
40505
  return !!document.querySelector("[data-command-bar-id]");
40495
40506
  }
40507
+ static hideAll() {
40508
+ tippy$1.hideAll();
40509
+ }
40496
40510
  };
40497
40511
  let CommandBar = _CommandBar;
40498
40512
  __publicField(CommandBar, "commandBarCreators", /* @__PURE__ */ new Map());
@@ -46988,7 +47002,413 @@ ${codeText}
46988
47002
  }
46989
47003
  return rects[0];
46990
47004
  }
46991
- const logger$24 = getLogger("exclusive-block");
47005
+ const zhCN$v = {
47006
+ embedProperties: {
47007
+ edit: "\u7F16\u8F91",
47008
+ addComment: "\u6DFB\u52A0\u6279\u6CE8"
47009
+ }
47010
+ };
47011
+ const enUS$v = {
47012
+ embedProperties: {
47013
+ edit: "Edit",
47014
+ addComment: "Add annotation"
47015
+ }
47016
+ };
47017
+ const jaJP$v = {
47018
+ embedProperties: {
47019
+ edit: "\u7DE8\u96C6",
47020
+ addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
47021
+ }
47022
+ };
47023
+ i18n$1.mergeLang({
47024
+ "zh-CN": zhCN$v,
47025
+ "en-US": enUS$v,
47026
+ "ja-JP": jaJP$v
47027
+ });
47028
+ const logger$24 = getLogger("embed-block-properties");
47029
+ function addCommentToBlock$1(editor, block) {
47030
+ var _a;
47031
+ for (const hook of editor.blockHooks) {
47032
+ const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
47033
+ if (!commands) {
47034
+ continue;
47035
+ }
47036
+ if (commands.group === "block-comment-actions") {
47037
+ const command = commands.commands[0];
47038
+ if (!command) {
47039
+ continue;
47040
+ }
47041
+ commands.executeCommand(editor, block, commands.commands[0], null);
47042
+ return true;
47043
+ }
47044
+ }
47045
+ return false;
47046
+ }
47047
+ class StandardEmbedBlockCommands {
47048
+ constructor(editor, block, properties) {
47049
+ __publicField(this, "group", "hovering-toolbar");
47050
+ __publicField(this, "_commands", [{
47051
+ id: "edit",
47052
+ name: i18n$1.t("embedProperties.edit"),
47053
+ icon: EditIcon
47054
+ }, {
47055
+ id: "separator",
47056
+ name: "",
47057
+ type: "separator"
47058
+ }]);
47059
+ this.editor = editor;
47060
+ this.block = block;
47061
+ this.properties = properties;
47062
+ }
47063
+ get commands() {
47064
+ var _a, _b, _c, _d;
47065
+ if (clientType.isMobile) {
47066
+ return [];
47067
+ }
47068
+ let standardCommands = [];
47069
+ if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
47070
+ this.properties.presetIds.forEach((id) => {
47071
+ const command = this._commands.find((item) => item.id === id);
47072
+ if (command) {
47073
+ standardCommands.push(command);
47074
+ }
47075
+ });
47076
+ }
47077
+ if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
47078
+ standardCommands.push(...this.properties.extCommands);
47079
+ }
47080
+ if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
47081
+ standardCommands.push(...this.properties.extCommands(this.editor, this.block));
47082
+ }
47083
+ if ((_d = this.properties) == null ? void 0 : _d.extIds) {
47084
+ this.properties.extIds.forEach((id) => {
47085
+ const command = this._commands.find((item) => item.id === id);
47086
+ if (command) {
47087
+ standardCommands.push(command);
47088
+ }
47089
+ });
47090
+ }
47091
+ const { enableComments = true } = this.editor.options;
47092
+ if (!enableComments || this.editor.readonly) {
47093
+ standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
47094
+ }
47095
+ if (this.editor.readonly) {
47096
+ standardCommands = standardCommands.filter((command) => command.id !== "edit");
47097
+ }
47098
+ standardCommands.forEach((item) => {
47099
+ if (item.id === "add-comment" || item.id === "edit") {
47100
+ item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
47101
+ }
47102
+ });
47103
+ return standardCommands;
47104
+ }
47105
+ executeCommand(editor, block, item) {
47106
+ var _a, _b;
47107
+ if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
47108
+ return;
47109
+ }
47110
+ if (item.id === "add-comment") {
47111
+ if (!addCommentToBlock$1(editor, block)) {
47112
+ logger$24.error("failed to add comment to block");
47113
+ }
47114
+ return;
47115
+ }
47116
+ logger$24.error(`unknown command: ${JSON.stringify(item)}`);
47117
+ }
47118
+ }
47119
+ function getStandardEmbedBlockProperties(editor, block, properties) {
47120
+ return {
47121
+ blockCommands: {
47122
+ "hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
47123
+ }
47124
+ };
47125
+ }
47126
+ function createResizeGripper(parent, type) {
47127
+ const elem = createElement("div", ["resize-gripper", type], parent);
47128
+ elem.setAttribute("data-resize-type", type);
47129
+ }
47130
+ function getExistsResizer(block) {
47131
+ const tools = getBlockTools(block);
47132
+ return tools.querySelector(".block-resizer");
47133
+ }
47134
+ function hideResizer(block) {
47135
+ const exists = getExistsResizer(block);
47136
+ if (exists) {
47137
+ removeClass(exists, "active");
47138
+ }
47139
+ }
47140
+ function updateSize(block, element, resizer) {
47141
+ const blockRect = block.getBoundingClientRect();
47142
+ const elementRect = element.getBoundingClientRect();
47143
+ const top = elementRect.top - blockRect.top;
47144
+ const left = elementRect.left - blockRect.left;
47145
+ const width = elementRect.width;
47146
+ const height = elementRect.height;
47147
+ resizer.style.top = `${top}px`;
47148
+ resizer.style.left = `${left}px`;
47149
+ resizer.style.width = `${width}px`;
47150
+ resizer.style.height = `${height}px`;
47151
+ }
47152
+ function createResizer(block, element, options, mouseDownEvent) {
47153
+ const exists = getExistsResizer(block);
47154
+ if (exists) {
47155
+ addClass(exists, "active");
47156
+ updateSize(block, element, exists);
47157
+ return exists;
47158
+ }
47159
+ const tools = getBlockTools(block);
47160
+ const resizer = createElement("div", ["block-resizer"], tools);
47161
+ updateSize(block, element, resizer);
47162
+ options.resize.forEach((type) => {
47163
+ createResizeGripper(resizer, type);
47164
+ });
47165
+ resizer.addEventListener("mousedown", mouseDownEvent);
47166
+ addClass(resizer, "active");
47167
+ return resizer;
47168
+ }
47169
+ function updateResizer(block, element) {
47170
+ const resizer = getExistsResizer(block);
47171
+ if (!resizer) {
47172
+ return;
47173
+ }
47174
+ if (!isChildNode(block, element)) {
47175
+ return;
47176
+ }
47177
+ const blockRect = block.getBoundingClientRect();
47178
+ const elementRect = element.getBoundingClientRect();
47179
+ const top = elementRect.top - blockRect.top;
47180
+ const left = elementRect.left - blockRect.left;
47181
+ const width = elementRect.width;
47182
+ const height = elementRect.height;
47183
+ resizer.style.top = `${top}px`;
47184
+ resizer.style.left = `${left}px`;
47185
+ resizer.style.width = `${width}px`;
47186
+ resizer.style.height = `${height}px`;
47187
+ }
47188
+ const style$a = "";
47189
+ const logger$23 = getLogger("block-resizer");
47190
+ class BlockResizer extends tinyTypedEmitter.TypedEmitter {
47191
+ constructor(editor, options) {
47192
+ super();
47193
+ __publicField(this, "resizableElement");
47194
+ __publicField(this, "block", null);
47195
+ __publicField(this, "startRect", null);
47196
+ __publicField(this, "startPos", null);
47197
+ __publicField(this, "resizeType", null);
47198
+ __publicField(this, "enabled", false);
47199
+ __publicField(this, "handleEditorResize", () => {
47200
+ if (this.block) {
47201
+ this.updateResizer();
47202
+ }
47203
+ });
47204
+ __publicField(this, "handleMouseDown", (event) => {
47205
+ event.preventDefault();
47206
+ event.stopPropagation();
47207
+ const element = this.getResizableElement();
47208
+ if (!element) {
47209
+ return;
47210
+ }
47211
+ if (event.button !== 0) {
47212
+ return;
47213
+ }
47214
+ const gripper = event.target;
47215
+ if (!gripper) {
47216
+ return;
47217
+ }
47218
+ if (!(gripper instanceof HTMLElement)) {
47219
+ return;
47220
+ }
47221
+ const resizeType = gripper.getAttribute("data-resize-type");
47222
+ if (!resizeType) {
47223
+ return;
47224
+ }
47225
+ this.bindEvents();
47226
+ this.startRect = element.getBoundingClientRect();
47227
+ this.startPos = event;
47228
+ this.resizeType = resizeType;
47229
+ setDefaultCursor(window.getComputedStyle(gripper).cursor);
47230
+ if (this.block) {
47231
+ this.editor.selection.selectBlock(this.block, 0);
47232
+ }
47233
+ });
47234
+ __publicField(this, "handleMouseMove", (event) => {
47235
+ if (!this.startPos || !this.startRect || !this.resizeType) {
47236
+ return;
47237
+ }
47238
+ const element = this.getResizableElement();
47239
+ if (!element || !this.block) {
47240
+ return;
47241
+ }
47242
+ const deltaX = event.x - this.startPos.x;
47243
+ const deltaY = event.y - this.startPos.y;
47244
+ const oldRect = this.startRect;
47245
+ let { top, left, right, bottom } = oldRect;
47246
+ if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
47247
+ bottom += deltaY;
47248
+ }
47249
+ if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
47250
+ top += deltaY;
47251
+ }
47252
+ if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
47253
+ left += deltaX;
47254
+ }
47255
+ if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
47256
+ right += deltaX;
47257
+ }
47258
+ const width = right > left ? right - left : 0;
47259
+ const height = bottom > top ? bottom - top : 0;
47260
+ const newRect = new DOMRect(left, top, width, height);
47261
+ this.emit("resizing", this, newRect);
47262
+ const newElement = this.getResizableElement();
47263
+ if (newElement) {
47264
+ updateResizer(this.block, newElement);
47265
+ }
47266
+ });
47267
+ __publicField(this, "handleMouseUp", (event) => {
47268
+ if (event.button !== 0) {
47269
+ return;
47270
+ }
47271
+ setDefaultCursor("");
47272
+ this.unbindEvents();
47273
+ this.emit("resized", this);
47274
+ const element = this.getResizableElement();
47275
+ if (!element || !this.block) {
47276
+ return;
47277
+ }
47278
+ updateResizer(this.block, element);
47279
+ });
47280
+ this.editor = editor;
47281
+ this.options = options;
47282
+ this.editor.addListener("resize", this.handleEditorResize);
47283
+ }
47284
+ enableResize(block, resizableElement) {
47285
+ this.block = block;
47286
+ this.resizableElement = resizableElement;
47287
+ this.createResizer();
47288
+ this.enabled = true;
47289
+ }
47290
+ disableResize() {
47291
+ if (!this.block) {
47292
+ return;
47293
+ }
47294
+ hideResizer(this.block);
47295
+ this.enabled = false;
47296
+ }
47297
+ update(block, resizableElement) {
47298
+ this.block = block;
47299
+ this.resizableElement = resizableElement;
47300
+ const elem = this.getResizableElement();
47301
+ if (elem && this.enabled) {
47302
+ this.createResizer();
47303
+ }
47304
+ }
47305
+ updateResizer() {
47306
+ const newElement = this.getResizableElement();
47307
+ if (newElement && this.block) {
47308
+ updateResizer(this.block, newElement);
47309
+ }
47310
+ }
47311
+ getBlock() {
47312
+ return this.block;
47313
+ }
47314
+ destroy() {
47315
+ this.editor.removeListener("resize", this.handleEditorResize);
47316
+ }
47317
+ getResizableElement() {
47318
+ if (this.resizableElement) {
47319
+ return this.resizableElement;
47320
+ }
47321
+ if (!this.block) {
47322
+ return null;
47323
+ }
47324
+ return getBlockContent(this.block);
47325
+ }
47326
+ createResizer() {
47327
+ const element = this.getResizableElement();
47328
+ if (!element || !this.block) {
47329
+ return;
47330
+ }
47331
+ assert(logger$23, isChildNode(this.block, element), "not a block child element");
47332
+ createResizer(this.block, element, this.options, this.handleMouseDown);
47333
+ }
47334
+ bindEvents() {
47335
+ document.addEventListener("mousemove", this.handleMouseMove);
47336
+ document.addEventListener("mouseup", this.handleMouseUp);
47337
+ }
47338
+ unbindEvents() {
47339
+ document.removeEventListener("mousemove", this.handleMouseMove);
47340
+ document.removeEventListener("mouseup", this.handleMouseUp);
47341
+ }
47342
+ }
47343
+ class EmbedBlockResizer {
47344
+ constructor(editor) {
47345
+ __publicField(this, "resizing", false);
47346
+ __publicField(this, "blockResizer");
47347
+ __publicField(this, "handleResized", () => {
47348
+ this.resizing = false;
47349
+ });
47350
+ __publicField(this, "handleResizing", (resizer, rect) => {
47351
+ var _a, _b;
47352
+ this.resizing = true;
47353
+ const block = resizer.getBlock();
47354
+ if (block) {
47355
+ if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
47356
+ return;
47357
+ }
47358
+ const blockType = getEmbedType(block);
47359
+ const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
47360
+ const height = Math.max(rect.height, adjustableMinHeight || 100);
47361
+ const oldData = this.editor.getBlockData(block);
47362
+ const oldEmbedData = oldData.embedData;
47363
+ const newEmbedData = {
47364
+ ...oldEmbedData,
47365
+ height
47366
+ };
47367
+ this.editor.updateEmbedData(block, newEmbedData);
47368
+ }
47369
+ });
47370
+ __publicField(this, "handleHoveringBlockChange", (block, old) => {
47371
+ if (this.resizing) {
47372
+ return;
47373
+ }
47374
+ if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
47375
+ this.disableResizer();
47376
+ }
47377
+ if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
47378
+ this.tryEnableResizer(block);
47379
+ }
47380
+ });
47381
+ __publicField(this, "handleEditorResize", () => {
47382
+ this.blockResizer.updateResizer();
47383
+ });
47384
+ this.editor = editor;
47385
+ OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
47386
+ this.blockResizer = new BlockResizer(this.editor, {
47387
+ resize: ["bottom"]
47388
+ });
47389
+ this.blockResizer.addListener("resizing", this.handleResizing);
47390
+ this.blockResizer.addListener("resized", this.handleResized);
47391
+ this.editor.addListener("resize", this.handleEditorResize);
47392
+ }
47393
+ destroy() {
47394
+ this.editor.removeListener("resize", this.handleEditorResize);
47395
+ OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
47396
+ }
47397
+ tryEnableResizer(block) {
47398
+ this.blockResizer.enableResize(block);
47399
+ }
47400
+ disableResizer() {
47401
+ this.blockResizer.disableResize();
47402
+ }
47403
+ static get(editor) {
47404
+ return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
47405
+ }
47406
+ static register(editor, block) {
47407
+ addClass(block, "resizable");
47408
+ return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
47409
+ }
47410
+ }
47411
+ const logger$22 = getLogger("exclusive-block");
46992
47412
  function addExclusiveStyle(editor, block, userId, displayName) {
46993
47413
  var _a;
46994
47414
  addClass(block, "block-exclusive");
@@ -47006,7 +47426,7 @@ ${codeText}
47006
47426
  block.removeAttribute("data-exclusive-tips");
47007
47427
  }
47008
47428
  function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
47009
- logger$24.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
47429
+ logger$22.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
47010
47430
  if (exclusive) {
47011
47431
  addExclusiveStyle(editor, block, userId, displayName);
47012
47432
  } else {
@@ -47163,28 +47583,28 @@ ${codeText}
47163
47583
  }
47164
47584
  }
47165
47585
  const exclusiveBlockStyles = "";
47166
- const zhCN$v = {
47586
+ const zhCN$u = {
47167
47587
  exclusive: {
47168
47588
  tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
47169
47589
  fallbackAbstract: "\u8BE5 Block"
47170
47590
  }
47171
47591
  };
47172
- const enUS$v = {
47592
+ const enUS$u = {
47173
47593
  exclusive: {
47174
47594
  tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
47175
47595
  fallbackAbstract: "This Block"
47176
47596
  }
47177
47597
  };
47178
- const jaJP$v = {
47598
+ const jaJP$u = {
47179
47599
  exclusive: {
47180
47600
  tips: "\u300C{editor}\u300D\u306F\u7DE8\u96C6\u4E2D\u3067\u3059\u3002\u300C{embedType}\u300D\u306F\u8907\u6570\u4EBA\u3067\u540C\u6642\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093",
47181
47601
  fallbackAbstract: "\u3053\u306E\u8981\u7D20"
47182
47602
  }
47183
47603
  };
47184
47604
  i18n$1.mergeLang({
47185
- "zh-CN": zhCN$v,
47186
- "en-US": enUS$v,
47187
- "ja-JP": jaJP$v
47605
+ "zh-CN": zhCN$u,
47606
+ "en-US": enUS$u,
47607
+ "ja-JP": jaJP$u
47188
47608
  });
47189
47609
  function getBlockInfo(editor, block) {
47190
47610
  const data2 = editor.getBlockData(block);
@@ -47360,22 +47780,22 @@ ${codeText}
47360
47780
  };
47361
47781
  }
47362
47782
  }
47363
- const style$a = "";
47364
- const zhCN$u = {
47783
+ const style$9 = "";
47784
+ const zhCN$t = {
47365
47785
  locker: {
47366
47786
  lock: "\u9501\u5B9A",
47367
47787
  unlock: "\u89E3\u9664\u9501\u5B9A",
47368
47788
  lockedBy: "\u88AB {name} \u9501\u5B9A"
47369
47789
  }
47370
47790
  };
47371
- const enUS$u = {
47791
+ const enUS$t = {
47372
47792
  locker: {
47373
47793
  lock: "Lock",
47374
47794
  unlock: "Unlock",
47375
47795
  lockedBy: "Locked by {name}"
47376
47796
  }
47377
47797
  };
47378
- const jaJP$u = {
47798
+ const jaJP$t = {
47379
47799
  locker: {
47380
47800
  lock: "\u30ED\u30C3\u30AF",
47381
47801
  unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
@@ -47383,9 +47803,9 @@ ${codeText}
47383
47803
  }
47384
47804
  };
47385
47805
  i18n$1.mergeLang({
47386
- "zh-CN": zhCN$u,
47387
- "en-US": enUS$u,
47388
- "ja-JP": jaJP$u
47806
+ "zh-CN": zhCN$t,
47807
+ "en-US": enUS$t,
47808
+ "ja-JP": jaJP$t
47389
47809
  });
47390
47810
  class BlockLockerPasteHandler {
47391
47811
  async handleBeforePasteDoc(editor, doc2) {
@@ -47397,7 +47817,7 @@ ${codeText}
47397
47817
  return false;
47398
47818
  }
47399
47819
  }
47400
- const logger$23 = getLogger("context-menu-utils");
47820
+ const logger$21 = getLogger("context-menu-utils");
47401
47821
  function blobToString(blob) {
47402
47822
  return new Promise((resolve, reject) => {
47403
47823
  const reader = new FileReader();
@@ -47418,7 +47838,7 @@ ${codeText}
47418
47838
  const types2 = items[0].types;
47419
47839
  return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
47420
47840
  } catch (error2) {
47421
- logger$23.warn(`Failed to read clipboard data: ${error2}`);
47841
+ logger$21.warn(`Failed to read clipboard data: ${error2}`);
47422
47842
  return true;
47423
47843
  }
47424
47844
  }
@@ -47467,7 +47887,7 @@ ${codeText}
47467
47887
  }
47468
47888
  return dataTransfer;
47469
47889
  }
47470
- const logger$22 = getLogger("ClipboardProvider");
47890
+ const logger$20 = getLogger("ClipboardProvider");
47471
47891
  class ClipboardProvider {
47472
47892
  constructor(editor, options) {
47473
47893
  __publicField(this, "id", "ClipboardProvider");
@@ -47553,7 +47973,7 @@ ${codeText}
47553
47973
  }
47554
47974
  }).catch((err) => {
47555
47975
  this.clipboardPermission.read = "denied";
47556
- logger$22.log(err);
47976
+ logger$20.log(err);
47557
47977
  });
47558
47978
  } catch (error2) {
47559
47979
  this.clipboardPermission = {
@@ -47614,13 +48034,14 @@ ${codeText}
47614
48034
  }
47615
48035
  }
47616
48036
  class StandardBoxCommands {
47617
- constructor(editor) {
48037
+ constructor(editor, extIds) {
47618
48038
  __publicField(this, "group", "standard-box-commands");
47619
48039
  __publicField(this, "providers", []);
47620
48040
  this.editor = editor;
47621
- if (clientType.isMobile) {
47622
- this.providers.push(new ClipboardProvider(this.editor, { withPaste: false }));
47623
- }
48041
+ this.extIds = extIds;
48042
+ }
48043
+ addProvider(provider) {
48044
+ this.providers.push(provider);
47624
48045
  }
47625
48046
  get commands() {
47626
48047
  if (this.editor.readonly) {
@@ -47631,6 +48052,14 @@ ${codeText}
47631
48052
  for (const provider of this.providers) {
47632
48053
  items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
47633
48054
  }
48055
+ for (const extId of this.extIds || []) {
48056
+ if (extId === "separator") {
48057
+ items.push({ id: "sep", name: "", type: "separator" });
48058
+ }
48059
+ if (extId === "add-comment") {
48060
+ items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
48061
+ }
48062
+ }
47634
48063
  return items;
47635
48064
  }
47636
48065
  executeCommand(editor, block, box, item) {
@@ -47645,12 +48074,20 @@ ${codeText}
47645
48074
  return;
47646
48075
  }
47647
48076
  }
48077
+ if (item.id === "add-comment") {
48078
+ addCommentToBlock$1(editor, block);
48079
+ }
47648
48080
  }
47649
48081
  static create(editor) {
47650
48082
  return new StandardBoxCommands(editor);
47651
48083
  }
48084
+ static mobileCreate(editor) {
48085
+ const instance = new StandardBoxCommands(editor);
48086
+ instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
48087
+ return instance;
48088
+ }
47652
48089
  }
47653
- const logger$21 = getLogger("object-commands");
48090
+ const logger$1$ = getLogger("object-commands");
47654
48091
  const SEP$1 = {
47655
48092
  id: "",
47656
48093
  name: "",
@@ -47706,7 +48143,7 @@ ${codeText}
47706
48143
  let element = null;
47707
48144
  const commands = [];
47708
48145
  if (clientType.isMobile && child && isBox(child)) {
47709
- boxCommands.push(new StandardBoxCommands(editor));
48146
+ boxCommands.push(StandardBoxCommands.mobileCreate(editor));
47710
48147
  }
47711
48148
  if (boxCommands.length > 0) {
47712
48149
  element = child;
@@ -47736,10 +48173,10 @@ ${codeText}
47736
48173
  const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
47737
48174
  const { boxCommands, blockCommands } = result;
47738
48175
  if (clientType.isMobile && child && isBox(child)) {
47739
- boxCommands.push(new StandardBoxCommands(editor));
48176
+ boxCommands.push(StandardBoxCommands.mobileCreate(editor));
47740
48177
  }
47741
48178
  if (boxCommands.length > 0) {
47742
- assert(logger$21, child, "child is null");
48179
+ assert(logger$1$, child, "child is null");
47743
48180
  for (let i = 0; i < boxCommands.length; i++) {
47744
48181
  if (boxCommands[i].commands.find((c) => c.id === item.id)) {
47745
48182
  boxCommands[i].executeCommand(editor, block, child, item);
@@ -48006,18 +48443,18 @@ ${codeText}
48006
48443
  }
48007
48444
  }
48008
48445
  const LIST_MAX_LEVEL = 8;
48009
- const logger$20 = getLogger("list-block");
48010
- const logger$1$ = getLogger("list-block");
48446
+ const logger$1_ = getLogger("list-block");
48447
+ const logger$1Z = getLogger("list-block");
48011
48448
  function isListBlock(block) {
48012
48449
  return getBlockType(block) === "list";
48013
48450
  }
48014
48451
  function ensureIsListBlock(block) {
48015
- assert(logger$1$, isListBlock(block), "not a list block");
48452
+ assert(logger$1Z, isListBlock(block), "not a list block");
48016
48453
  }
48017
48454
  function getListBlockType(block) {
48018
48455
  ensureIsListBlock(block);
48019
48456
  const type = block.getAttribute("data-list-type");
48020
- assert(logger$1$, type, "no list type");
48457
+ assert(logger$1Z, type, "no list type");
48021
48458
  return type;
48022
48459
  }
48023
48460
  function isTextOnlyListBlock(block) {
@@ -48036,7 +48473,7 @@ ${codeText}
48036
48473
  function getListBlockGroupId(block) {
48037
48474
  ensureIsListBlock(block);
48038
48475
  const groupId = block.getAttribute("data-list-group-id");
48039
- assert(logger$1$, groupId, "no group id");
48476
+ assert(logger$1Z, groupId, "no group id");
48040
48477
  return groupId;
48041
48478
  }
48042
48479
  function getListBlockProperties(block) {
@@ -48046,7 +48483,7 @@ ${codeText}
48046
48483
  const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
48047
48484
  const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
48048
48485
  const groupId = block.getAttribute("data-list-group-id");
48049
- assert(logger$1$, groupId, "no group id");
48486
+ assert(logger$1Z, groupId, "no group id");
48050
48487
  return {
48051
48488
  type,
48052
48489
  start,
@@ -48315,7 +48752,7 @@ ${codeText}
48315
48752
  this.nodeMap.set(block, node);
48316
48753
  if (parentBlock) {
48317
48754
  const parentNode = this.nodeMap.get(parentBlock);
48318
- assert(logger$20, parentNode, "no parent node");
48755
+ assert(logger$1_, parentNode, "no parent node");
48319
48756
  parentNode.children.push(node);
48320
48757
  } else {
48321
48758
  this.rootNodes.push(node);
@@ -48383,7 +48820,7 @@ ${codeText}
48383
48820
  return hasClass(block, "editor-in-mindmap-first");
48384
48821
  }
48385
48822
  function isViewingAsMindmap(block) {
48386
- assert(logger$20, isListBlock(block), "not a list block");
48823
+ assert(logger$1_, isListBlock(block), "not a list block");
48387
48824
  if (hasClass(block, "editor-in-mindmap-first")) {
48388
48825
  return true;
48389
48826
  }
@@ -48404,12 +48841,12 @@ ${codeText}
48404
48841
  const container = getParentContainer(from);
48405
48842
  if (to) {
48406
48843
  const container2 = getParentContainer(to);
48407
- assert(logger$20, container === container2, "invalid block container");
48844
+ assert(logger$1_, container === container2, "invalid block container");
48408
48845
  }
48409
48846
  const fromIndex = getBlockIndex(from);
48410
48847
  if (to) {
48411
48848
  const toIndex = getBlockIndex(to);
48412
- assert(logger$20, fromIndex <= toIndex, "invalid block index");
48849
+ assert(logger$1_, fromIndex <= toIndex, "invalid block index");
48413
48850
  }
48414
48851
  addClass(from, ...styles);
48415
48852
  if (!to || to === from) {
@@ -48417,7 +48854,7 @@ ${codeText}
48417
48854
  }
48418
48855
  let next2 = getNextBlock(from);
48419
48856
  while (next2 !== to) {
48420
- assert(logger$20, next2, "no next button");
48857
+ assert(logger$1_, next2, "no next button");
48421
48858
  addClass(next2, ...styles);
48422
48859
  next2 = getNextBlock(next2);
48423
48860
  }
@@ -48428,7 +48865,7 @@ ${codeText}
48428
48865
  async function requestMindmapFullscreen(editor, block, mindmapTools) {
48429
48866
  const tools = getBlockTools(block);
48430
48867
  const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
48431
- assert(logger$20, exitFullscreenButton, "no full screen button");
48868
+ assert(logger$1_, exitFullscreenButton, "no full screen button");
48432
48869
  const resetMindmap = () => {
48433
48870
  setTimeout(() => {
48434
48871
  mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
@@ -48448,7 +48885,7 @@ ${codeText}
48448
48885
  try {
48449
48886
  await exitFullscreen();
48450
48887
  } catch (err) {
48451
- logger$20.error(err);
48888
+ logger$1_.error(err);
48452
48889
  }
48453
48890
  onExitFullscreen();
48454
48891
  } else {
@@ -48457,7 +48894,7 @@ ${codeText}
48457
48894
  await requestFullscreen(tools);
48458
48895
  resetMindmap();
48459
48896
  } catch (err) {
48460
- logger$20.error(err);
48897
+ logger$1_.error(err);
48461
48898
  }
48462
48899
  exitFullscreenButton.innerHTML = ExitFullScreenIcon;
48463
48900
  exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
@@ -48738,7 +49175,7 @@ ${codeText}
48738
49175
  if (!svg) {
48739
49176
  return;
48740
49177
  }
48741
- assert(logger$20, svg, "no mindmap svg");
49178
+ assert(logger$1_, svg, "no mindmap svg");
48742
49179
  svg.remove();
48743
49180
  editor.domEvents.removeAllListeners(svg);
48744
49181
  destroyMindmapButtons(editor, block);
@@ -48790,7 +49227,7 @@ ${codeText}
48790
49227
  });
48791
49228
  __publicField(this, "handleMouseEnter", () => {
48792
49229
  const block = getParentBlock(this.toMindmapButton);
48793
- assert(logger$20, block && isListBlock(block), "no parent list");
49230
+ assert(logger$1_, block && isListBlock(block), "no parent list");
48794
49231
  highlightEntireList(this.editor, block, true);
48795
49232
  this.currentBlock = block;
48796
49233
  });
@@ -48802,7 +49239,7 @@ ${codeText}
48802
49239
  });
48803
49240
  __publicField(this, "handleClick", () => {
48804
49241
  const block = getParentBlock(this.toMindmapButton);
48805
- assert(logger$20, block && isListBlock(block), "no parent list");
49242
+ assert(logger$1_, block && isListBlock(block), "no parent list");
48806
49243
  toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
48807
49244
  });
48808
49245
  this.editor = editor;
@@ -48930,11 +49367,11 @@ ${codeText}
48930
49367
  }
48931
49368
  }
48932
49369
  function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
48933
- logger$20.debug("drag a block on a list block");
49370
+ logger$1_.debug("drag a block on a list block");
48934
49371
  if (!isTextKindBlock(editor, draggedBlock)) {
48935
49372
  return false;
48936
49373
  }
48937
- assert(logger$20, isListBlock(targetListBlock), "target is not a list block");
49374
+ assert(logger$1_, isListBlock(targetListBlock), "target is not a list block");
48938
49375
  const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
48939
49376
  const newStart = insertPos === "after" ? start + 1 : start;
48940
49377
  const oldData = editor.getBlockData(draggedBlock);
@@ -48967,7 +49404,7 @@ ${codeText}
48967
49404
  return true;
48968
49405
  }
48969
49406
  function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
48970
- logger$20.debug("drag a list between text blocks");
49407
+ logger$1_.debug("drag a list between text blocks");
48971
49408
  if (insertPos === "after") {
48972
49409
  const nextBlock = getNextBlock(targetBlock);
48973
49410
  if (nextBlock && isListBlock(nextBlock)) {
@@ -49004,11 +49441,11 @@ ${codeText}
49004
49441
  }
49005
49442
  const { blockId } = dragData;
49006
49443
  const draggedBlock = editor.getBlockById(blockId);
49007
- assert(logger$20, draggedBlock, "no dragged block");
49444
+ assert(logger$1_, draggedBlock, "no dragged block");
49008
49445
  const { isSourceBlock, targetBlock } = options;
49009
49446
  if (!isSourceBlock && targetBlock) {
49010
- assert(logger$20, block === targetBlock, "block !== target block");
49011
- assert(logger$20, isListBlock(targetBlock), "target is not a list block");
49447
+ assert(logger$1_, block === targetBlock, "block !== target block");
49448
+ assert(logger$1_, isListBlock(targetBlock), "target is not a list block");
49012
49449
  return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
49013
49450
  }
49014
49451
  return handleDragList(editor, draggedBlock, targetBlock, insertPos);
@@ -49510,7 +49947,7 @@ ${codeText}
49510
49947
  }
49511
49948
  const nextBrother = getListNextBrother(block);
49512
49949
  while (nextBlock !== nextBrother) {
49513
- assert(logger$20, nextBlock, "no next block");
49950
+ assert(logger$1_, nextBlock, "no next block");
49514
49951
  if (isListBlock(nextBlock)) {
49515
49952
  if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
49516
49953
  return nextBlock;
@@ -49609,9 +50046,9 @@ ${codeText}
49609
50046
  }
49610
50047
  return true;
49611
50048
  }
49612
- const logger$1_ = getLogger("list-block");
50049
+ const logger$1Y = getLogger("list-block");
49613
50050
  function cloneListData(editor, block, options) {
49614
- assert(logger$1_, isListBlock(block), "not a list block");
50051
+ assert(logger$1Y, isListBlock(block), "not a list block");
49615
50052
  const blockData = {
49616
50053
  ...editor.getBlockData(block),
49617
50054
  id: genId()
@@ -49686,7 +50123,7 @@ ${codeText}
49686
50123
  return true;
49687
50124
  }
49688
50125
  function findPrevBrotherAsParent(block) {
49689
- assert(logger$20, isListBlock(block), "not a list block");
50126
+ assert(logger$1_, isListBlock(block), "not a list block");
49690
50127
  const { level } = getListBlockProperties(block);
49691
50128
  let prevBlock = getPrevBlock(block);
49692
50129
  while (prevBlock) {
@@ -49713,7 +50150,7 @@ ${codeText}
49713
50150
  }
49714
50151
  function findPrevBrother(editor, fromBlock, toParentBlock) {
49715
50152
  let prevBlock = getPrevBlock(fromBlock);
49716
- assert(logger$20, prevBlock, "no prev brother");
50153
+ assert(logger$1_, prevBlock, "no prev brother");
49717
50154
  const parentLevel = getListBlockLevel(toParentBlock);
49718
50155
  while (prevBlock) {
49719
50156
  if (prevBlock === toParentBlock) {
@@ -49734,7 +50171,7 @@ ${codeText}
49734
50171
  }
49735
50172
  ensureIsListBlock(block);
49736
50173
  const prevBrother = findPrevBrotherAsParent(block);
49737
- assert(logger$20, prevBrother, "no list prev brother");
50174
+ assert(logger$1_, prevBrother, "no list prev brother");
49738
50175
  const newParent = prevBrother;
49739
50176
  const newBrother = findPrevBrother(editor, block, newParent);
49740
50177
  const level = getListBlockLevel(newParent) + 1;
@@ -49933,14 +50370,14 @@ ${codeText}
49933
50370
  this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
49934
50371
  }
49935
50372
  }
49936
- const logger$1Z = getLogger("customize-list-start-menu");
50373
+ const logger$1X = getLogger("customize-list-start-menu");
49937
50374
  class CustomizeListStartDialog {
49938
50375
  constructor(editor) {
49939
50376
  __publicField(this, "popup");
49940
50377
  __publicField(this, "block", null);
49941
50378
  __publicField(this, "show", (editor, block) => {
49942
50379
  const listBlockMarker = block.querySelector("div.list-container");
49943
- assert(logger$1Z, listBlockMarker, "list-block mark does not exist");
50380
+ assert(logger$1X, listBlockMarker, "list-block mark does not exist");
49944
50381
  this.block = block;
49945
50382
  this.popup.manualShow(listBlockMarker, {
49946
50383
  theme: "light"
@@ -50098,7 +50535,7 @@ ${codeText}
50098
50535
  const listContainer = findTarget(event, "div.list-container");
50099
50536
  if (listContainer && this.editor.isWritable()) {
50100
50537
  const block = getParentBlock(listContainer);
50101
- assert(logger$20, block, "no parent block");
50538
+ assert(logger$1_, block, "no parent block");
50102
50539
  ensureIsListBlock(block);
50103
50540
  const blockData = editor.getBlockData(block);
50104
50541
  if (blockData && blockData.checkbox) {
@@ -50238,7 +50675,7 @@ ${codeText}
50238
50675
  }
50239
50676
  return blockContent;
50240
50677
  }
50241
- const zhCN$t = {
50678
+ const zhCN$s = {
50242
50679
  list: {
50243
50680
  confirm: "\u786E\u5B9A",
50244
50681
  setStart: "\u8BBE\u7F6E\u7F16\u53F7",
@@ -50258,7 +50695,7 @@ ${codeText}
50258
50695
  exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
50259
50696
  }
50260
50697
  };
50261
- const enUS$t = {
50698
+ const enUS$s = {
50262
50699
  list: {
50263
50700
  confirm: "Confirm",
50264
50701
  setStart: "Set number",
@@ -50278,7 +50715,7 @@ ${codeText}
50278
50715
  exitFullscreen: "Exit full screen"
50279
50716
  }
50280
50717
  };
50281
- const jaJP$t = {
50718
+ const jaJP$s = {
50282
50719
  list: {
50283
50720
  confirm: "OK",
50284
50721
  setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
@@ -50299,12 +50736,12 @@ ${codeText}
50299
50736
  }
50300
50737
  };
50301
50738
  i18n$1.mergeLang({
50302
- "zh-CN": zhCN$t,
50303
- "en-US": enUS$t,
50304
- "ja-JP": jaJP$t
50739
+ "zh-CN": zhCN$s,
50740
+ "en-US": enUS$s,
50741
+ "ja-JP": jaJP$s
50305
50742
  });
50306
- const style$9 = "";
50307
- const logger$1Y = getLogger("list-block:paste-handler");
50743
+ const style$8 = "";
50744
+ const logger$1W = getLogger("list-block:paste-handler");
50308
50745
  class ListPasteHandler {
50309
50746
  constructor() {
50310
50747
  __publicField(this, "fixStartByList", null);
@@ -50358,7 +50795,7 @@ ${codeText}
50358
50795
  startIds.set(newGroupId, 1);
50359
50796
  } else {
50360
50797
  const start = startIds.get(groupId);
50361
- assert(logger$1Y, start, "start is null");
50798
+ assert(logger$1W, start, "start is null");
50362
50799
  block.start = start + 1;
50363
50800
  block.groupId = groupId;
50364
50801
  startIds.set(groupId, start + 1);
@@ -50378,7 +50815,7 @@ ${codeText}
50378
50815
  return false;
50379
50816
  }
50380
50817
  }
50381
- const logger$1X = getLogger("list selection to doc");
50818
+ const logger$1V = getLogger("list selection to doc");
50382
50819
  function convertListToText(data2) {
50383
50820
  const textData = { type: "text" };
50384
50821
  Object.entries(data2).forEach(([key, value]) => {
@@ -50393,7 +50830,7 @@ ${codeText}
50393
50830
  const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
50394
50831
  const start = selectedBlock.start;
50395
50832
  const end = selectedBlock.end;
50396
- assert(logger$1X, data2.text, "no block text");
50833
+ assert(logger$1V, data2.text, "no block text");
50397
50834
  const len = getBlockTextLength$6(editor, selectedBlock.block);
50398
50835
  if (end.offset - start.offset === len) {
50399
50836
  return {
@@ -50969,7 +51406,7 @@ ${codeText}
50969
51406
  toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
50970
51407
  }, 300);
50971
51408
  };
50972
- const logger$1W = getLogger("inline-box-items");
51409
+ const logger$1U = getLogger("inline-box-items");
50973
51410
  function insertEmptyBlockLink(editor, containerId, blockIndex) {
50974
51411
  let block = editor.findBlockByIndex(containerId, blockIndex);
50975
51412
  let placement = "bottom-start";
@@ -50980,7 +51417,7 @@ ${codeText}
50980
51417
  const onFinished = (linkText, linkUrl) => {
50981
51418
  editor.undoManager.runInGroup(() => {
50982
51419
  try {
50983
- assert(logger$1W, block, "block not found");
51420
+ assert(logger$1U, block, "block not found");
50984
51421
  if (!isEmptyTextBlock(editor, block)) {
50985
51422
  block = editor.insertTextBlock([], containerId, blockIndex);
50986
51423
  }
@@ -50991,7 +51428,7 @@ ${codeText}
50991
51428
  editor.selection.selectBlock(block, getTextLength(text2));
50992
51429
  editor.focus();
50993
51430
  } catch (error2) {
50994
- logger$1W.error(error2);
51431
+ logger$1U.error(error2);
50995
51432
  }
50996
51433
  });
50997
51434
  };
@@ -51011,7 +51448,7 @@ ${codeText}
51011
51448
  function insertLink(editor, containerId, blockIndex) {
51012
51449
  const block = editor.getBlockByIndex(containerId, blockIndex);
51013
51450
  const range = editor.selection.range;
51014
- assert(logger$1W, isSimpleBlockPosition(range.start), "invalid block position");
51451
+ assert(logger$1U, isSimpleBlockPosition(range.start), "invalid block position");
51015
51452
  const rects = getBlockClientRects(editor, block, range);
51016
51453
  if (rects.length === 0) {
51017
51454
  return;
@@ -51037,7 +51474,7 @@ ${codeText}
51037
51474
  editor.selection.selectBlock(block, start + linkText.length);
51038
51475
  editor.focus();
51039
51476
  } catch (error2) {
51040
- logger$1W.error(error2);
51477
+ logger$1U.error(error2);
51041
51478
  }
51042
51479
  });
51043
51480
  };
@@ -51255,7 +51692,7 @@ ${codeText}
51255
51692
  function getToolbar(editor) {
51256
51693
  return editor.findCustom("toolbar-handler");
51257
51694
  }
51258
- const logger$1V = getLogger("link-popup");
51695
+ const logger$1T = getLogger("link-popup");
51259
51696
  function getLinkHref(child) {
51260
51697
  var _a, _b;
51261
51698
  return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
@@ -51293,7 +51730,7 @@ ${codeText}
51293
51730
  editor.selection.selectBlock(block, range.start + linkText.length);
51294
51731
  editor.focus();
51295
51732
  } catch (error2) {
51296
- logger$1V.error(error2);
51733
+ logger$1T.error(error2);
51297
51734
  }
51298
51735
  };
51299
51736
  const onClose = () => {
@@ -51532,7 +51969,7 @@ ${codeText}
51532
51969
  this.editProvider = new EditLinkProvider();
51533
51970
  }
51534
51971
  }
51535
- const logger$1U = getLogger("readonly-toolbar");
51972
+ const logger$1S = getLogger("readonly-toolbar");
51536
51973
  const SEP = {
51537
51974
  id: "",
51538
51975
  name: "",
@@ -51595,7 +52032,7 @@ ${codeText}
51595
52032
  });
51596
52033
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
51597
52034
  var _a;
51598
- assert(logger$1U, editor === this.editor, "editor mismatch");
52035
+ assert(logger$1S, editor === this.editor, "editor mismatch");
51599
52036
  if (!editor.readonly) {
51600
52037
  this.toolbar.close("selectionChange");
51601
52038
  return;
@@ -51781,7 +52218,7 @@ ${codeText}
51781
52218
  return visible;
51782
52219
  }
51783
52220
  }
51784
- const logger$1T = getLogger("toolbar-handler");
52221
+ const logger$1R = getLogger("toolbar-handler");
51785
52222
  class OnesEditorToolbar {
51786
52223
  constructor(editor) {
51787
52224
  __publicField(this, "id", "editor-toolbar");
@@ -51868,7 +52305,7 @@ ${codeText}
51868
52305
  });
51869
52306
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
51870
52307
  var _a;
51871
- assert(logger$1T, editor === this.editor, "editor mismatch");
52308
+ assert(logger$1R, editor === this.editor, "editor mismatch");
51872
52309
  if (editor.selection.range.isCollapsed() || this.mouseDown) {
51873
52310
  if (this.toolbarType === "object") {
51874
52311
  const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
@@ -52187,7 +52624,7 @@ ${codeText}
52187
52624
  this.texWidth = [tex, width];
52188
52625
  }
52189
52626
  }
52190
- const logger$1S = getLogger("mathjax-converter");
52627
+ const logger$1Q = getLogger("mathjax-converter");
52191
52628
  const MATHJAX_SCRIPT_ID = "MathJax-script";
52192
52629
  const MATHJAX_BUFFER = 30;
52193
52630
  const REDUCED_UNIT = 8;
@@ -52236,7 +52673,7 @@ ${codeText}
52236
52673
  const svg = result.querySelector("svg");
52237
52674
  return svg.outerHTML;
52238
52675
  } catch (err) {
52239
- logger$1S.error(err);
52676
+ logger$1Q.error(err);
52240
52677
  throw err;
52241
52678
  } finally {
52242
52679
  lockers.release(lockId);
@@ -52284,12 +52721,13 @@ ${codeText}
52284
52721
  ...perfectState
52285
52722
  };
52286
52723
  }
52287
- const logger$1R = getLogger("edit-mathjax");
52724
+ const logger$1P = getLogger("edit-mathjax");
52288
52725
  class MathjaxEditor {
52289
52726
  constructor() {
52290
52727
  __publicField(this, "editMathjaxPopup", null);
52291
52728
  __publicField(this, "onChange", null);
52292
52729
  __publicField(this, "tex", "");
52730
+ __publicField(this, "oldTex", "");
52293
52731
  __publicField(this, "observer", null);
52294
52732
  __publicField(this, "handleClose", (commandBar2) => {
52295
52733
  var _a;
@@ -52313,6 +52751,10 @@ ${codeText}
52313
52751
  });
52314
52752
  __publicField(this, "handleChange", debounce__default.default((text2) => {
52315
52753
  var _a;
52754
+ if (text2 === this.oldTex) {
52755
+ return;
52756
+ }
52757
+ this.oldTex = text2;
52316
52758
  (_a = this.onChange) == null ? void 0 : _a.call(this, text2, false);
52317
52759
  }, 300));
52318
52760
  }
@@ -52325,6 +52767,7 @@ ${codeText}
52325
52767
  const textarea2 = this.getTextarea();
52326
52768
  textarea2.value = tex;
52327
52769
  }
52770
+ this.oldTex = tex;
52328
52771
  this.tex = tex;
52329
52772
  this.editMathjaxPopup.manualShow(elem, { theme: "light", placement: options == null ? void 0 : options.placement });
52330
52773
  this.editMathjaxPopup.removeAllListeners("close");
@@ -52355,9 +52798,9 @@ ${codeText}
52355
52798
  this.observer.observe(textarea2);
52356
52799
  }
52357
52800
  getTextarea() {
52358
- assert(logger$1R, this.editMathjaxPopup, "no exists mathjax editor popup");
52801
+ assert(logger$1P, this.editMathjaxPopup, "no exists mathjax editor popup");
52359
52802
  const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
52360
- assert(logger$1R, textarea2, "no textarea");
52803
+ assert(logger$1P, textarea2, "no textarea");
52361
52804
  return textarea2;
52362
52805
  }
52363
52806
  destroy() {
@@ -52427,7 +52870,7 @@ ${codeText}
52427
52870
  };
52428
52871
  editMathjax(editor, box, data2.tex, update2);
52429
52872
  }
52430
- const logger$1Q = getLogger("mathjax-box");
52873
+ const logger$1O = getLogger("mathjax-box");
52431
52874
  function updateCaret(editor, event) {
52432
52875
  editor.selection.updateSelection(null);
52433
52876
  const target = event.target;
@@ -52532,7 +52975,7 @@ ${codeText}
52532
52975
  };
52533
52976
  editor.updateBoxData(newData);
52534
52977
  }).catch((err) => {
52535
- logger$1Q.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
52978
+ logger$1O.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
52536
52979
  });
52537
52980
  return data2;
52538
52981
  }
@@ -52551,7 +52994,7 @@ ${codeText}
52551
52994
  }
52552
52995
  function handleClickBox$3(editor, box, event) {
52553
52996
  const parentBlock = getParentBlock(box);
52554
- assert(logger$1Q, parentBlock, "failed to get block");
52997
+ assert(logger$1O, parentBlock, "failed to get block");
52555
52998
  if (!editor.isBlockWritable(parentBlock)) {
52556
52999
  return;
52557
53000
  }
@@ -52620,7 +53063,7 @@ ${codeText}
52620
53063
  }
52621
53064
  const data2 = editor.getBlockData(block);
52622
53065
  const embedData = data2.embedData;
52623
- editMathjax(editor, elem, embedData.mathjaxText, async (tex) => {
53066
+ editMathjax(editor, block, embedData.mathjaxText, async (tex) => {
52624
53067
  const { resourceId: src, width, height } = await convertAndUploadMathjaxForEmbed(editor, tex);
52625
53068
  const newData = {
52626
53069
  mathjaxText: tex,
@@ -52748,28 +53191,28 @@ $$${mathData.mathjaxText}$$
52748
53191
  getBlockProperties: getBlockProperties$b
52749
53192
  };
52750
53193
  const mathjaxStyle = "";
52751
- const zhCN$s = {
53194
+ const zhCN$r = {
52752
53195
  mathjax: {
52753
53196
  emptyText: "\u7A7A\u7684\u516C\u5F0F",
52754
53197
  abstract: "\u516C\u5F0F"
52755
53198
  }
52756
53199
  };
52757
- const enUS$s = {
53200
+ const enUS$r = {
52758
53201
  mathjax: {
52759
53202
  emptyText: "Empty formula",
52760
53203
  abstract: "Formula"
52761
53204
  }
52762
53205
  };
52763
- const jaJP$s = {
53206
+ const jaJP$r = {
52764
53207
  mathjax: {
52765
53208
  emptyText: "\u6570\u5F0F\u306A\u3057",
52766
53209
  abstract: "\u6570\u5F0F"
52767
53210
  }
52768
53211
  };
52769
53212
  i18n$1.mergeLang({
52770
- "zh-CN": zhCN$s,
52771
- "en-US": enUS$s,
52772
- "ja-JP": jaJP$s
53213
+ "zh-CN": zhCN$r,
53214
+ "en-US": enUS$r,
53215
+ "ja-JP": jaJP$r
52773
53216
  });
52774
53217
  function convertToMath(editor, containerId, blockIndex, offset) {
52775
53218
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -58303,7 +58746,7 @@ $$${mathData.mathjaxText}$$
58303
58746
  const docBlockText = { insert: " ", attributes: data2 };
58304
58747
  return docBlockText;
58305
58748
  }
58306
- const logger$1P = getLogger("StatusBoxEditor");
58749
+ const logger$1N = getLogger("StatusBoxEditor");
58307
58750
  class StatusBoxEditor {
58308
58751
  constructor(editor) {
58309
58752
  __publicField(this, "linkPopup", null);
@@ -58326,10 +58769,10 @@ $$${mathData.mathjaxText}$$
58326
58769
  });
58327
58770
  __publicField(this, "handClose", () => {
58328
58771
  var _a;
58329
- assert(logger$1P, this.boxElement, "boxElement not found");
58772
+ assert(logger$1N, this.boxElement, "boxElement not found");
58330
58773
  const boxData = this.editor.getBoxData(this.boxElement);
58331
58774
  const block = getParentBlock(this.boxElement);
58332
- assert(logger$1P, block, "block not found");
58775
+ assert(logger$1N, block, "block not found");
58333
58776
  if (!boxData.title) {
58334
58777
  const offset = getChildOffset(block, this.boxElement);
58335
58778
  this.editor.deleteTextFromBlock(block, offset.start, 1);
@@ -58367,7 +58810,7 @@ $$${mathData.mathjaxText}$$
58367
58810
  return;
58368
58811
  }
58369
58812
  const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
58370
- assert(logger$1P, this.boxElement, "boxElement not found");
58813
+ assert(logger$1N, this.boxElement, "boxElement not found");
58371
58814
  const data2 = this.editor.getBoxData(this.boxElement);
58372
58815
  this.statusPalette.changeColor(color);
58373
58816
  const newData = { ...data2, color };
@@ -58384,7 +58827,7 @@ $$${mathData.mathjaxText}$$
58384
58827
  });
58385
58828
  __publicField(this, "onTitleChange", (e2) => {
58386
58829
  const title = e2.target.value;
58387
- assert(logger$1P, this.boxElement, "boxElement not found");
58830
+ assert(logger$1N, this.boxElement, "boxElement not found");
58388
58831
  const data2 = this.editor.getBoxData(this.boxElement);
58389
58832
  const newData = { ...data2, title: title.trim() };
58390
58833
  this.editor.updateBoxData(newData, { noFocus: true });
@@ -58497,7 +58940,7 @@ $$${mathData.mathjaxText}$$
58497
58940
  toStandardText: toStandardText$1,
58498
58941
  matchText: matchText$1
58499
58942
  };
58500
- const logger$1O = getLogger("status-box-command");
58943
+ const logger$1M = getLogger("status-box-command");
58501
58944
  class StatusBoxCommand {
58502
58945
  static get commands() {
58503
58946
  return [
@@ -58516,7 +58959,7 @@ $$${mathData.mathjaxText}$$
58516
58959
  const block = editor.getBlockByIndex(containerId, blockIndex);
58517
58960
  const boxOp = createEmptyStatusBox();
58518
58961
  const { start } = editor.selection.range;
58519
- assert(logger$1O, isSimpleBlockPosition(start), "invalid block position");
58962
+ assert(logger$1M, isSimpleBlockPosition(start), "invalid block position");
58520
58963
  editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
58521
58964
  const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
58522
58965
  editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
@@ -58535,7 +58978,7 @@ $$${mathData.mathjaxText}$$
58535
58978
  }
58536
58979
  }
58537
58980
  __publicField(StatusBoxCommand, "id", "insert-status");
58538
- const enUS$r = {
58981
+ const enUS$q = {
58539
58982
  status: {
58540
58983
  empty: "Set status",
58541
58984
  command: {
@@ -58559,7 +59002,7 @@ $$${mathData.mathjaxText}$$
58559
59002
  }
58560
59003
  }
58561
59004
  };
58562
- const zhCN$r = {
59005
+ const zhCN$q = {
58563
59006
  status: {
58564
59007
  empty: "\u8BBE\u7F6E\u72B6\u6001",
58565
59008
  command: {
@@ -58583,7 +59026,7 @@ $$${mathData.mathjaxText}$$
58583
59026
  }
58584
59027
  }
58585
59028
  };
58586
- const jaJP$r = {
59029
+ const jaJP$q = {
58587
59030
  status: {
58588
59031
  empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
58589
59032
  command: {
@@ -58608,12 +59051,12 @@ $$${mathData.mathjaxText}$$
58608
59051
  }
58609
59052
  };
58610
59053
  const langs$2 = {
58611
- "en-US": enUS$r,
58612
- "zh-CN": zhCN$r,
58613
- "ja-JP": jaJP$r
59054
+ "en-US": enUS$q,
59055
+ "zh-CN": zhCN$q,
59056
+ "ja-JP": jaJP$q
58614
59057
  };
58615
59058
  i18n$1.mergeLang(langs$2);
58616
- const logger$1N = getLogger("inline-box-items");
59059
+ const logger$1L = getLogger("inline-box-items");
58617
59060
  function insertEmptyBlockMath(editor, containerId, blockIndex) {
58618
59061
  return editor.undoManager.runInGroup(() => {
58619
59062
  var _a;
@@ -58624,7 +59067,7 @@ $$${mathData.mathjaxText}$$
58624
59067
  const boxOp = createEmptyMathjaxBox();
58625
59068
  editor.setBlockText(block, [boxOp]);
58626
59069
  const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
58627
- assert(logger$1N, boxId, "mathjax box id is empty");
59070
+ assert(logger$1L, boxId, "mathjax box id is empty");
58628
59071
  setTimeout(() => {
58629
59072
  const box = editor.getBoxById(boxId);
58630
59073
  editMathjaxBox(editor, box);
@@ -58637,11 +59080,11 @@ $$${mathData.mathjaxText}$$
58637
59080
  var _a;
58638
59081
  const block = editor.getBlockByIndex(containerId, blockIndex);
58639
59082
  const range = editor.selection.range;
58640
- assert(logger$1N, isSimpleBlockPosition(range.start), "invalid block position");
59083
+ assert(logger$1L, isSimpleBlockPosition(range.start), "invalid block position");
58641
59084
  const boxOp = createEmptyMathjaxBox();
58642
59085
  editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
58643
59086
  const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
58644
- assert(logger$1N, boxId, "mathjax box id is empty");
59087
+ assert(logger$1L, boxId, "mathjax box id is empty");
58645
59088
  setTimeout(() => {
58646
59089
  const box = editor.getBoxById(boxId);
58647
59090
  editMathjaxBox(editor, box);
@@ -58808,7 +59251,7 @@ $$${mathData.mathjaxText}$$
58808
59251
  }
58809
59252
  }
58810
59253
  };
58811
- const logger$1M = getLogger("insert-menu");
59254
+ const logger$1K = getLogger("insert-menu");
58812
59255
  const injectGroup = (commands, group, startIndex) => {
58813
59256
  commands.forEach((command, index2) => {
58814
59257
  command.group = group;
@@ -58947,7 +59390,7 @@ $$${mathData.mathjaxText}$$
58947
59390
  return true;
58948
59391
  }
58949
59392
  const blockId = getBlockId(block);
58950
- assert(logger$1M, range.isSimple(), "invalid range");
59393
+ assert(logger$1K, range.isSimple(), "invalid range");
58951
59394
  const offset = range.start.offset;
58952
59395
  if (quickItem.commandProvider) {
58953
59396
  const params2 = { from: "quick-menu", blockId, offset };
@@ -58983,7 +59426,7 @@ $$${mathData.mathjaxText}$$
58983
59426
  });
58984
59427
  }
58985
59428
  }
58986
- const logger$1L = getLogger("quick-command-providers");
59429
+ const logger$1J = getLogger("quick-command-providers");
58987
59430
  class QuickCommandProviders extends AbstractProvider {
58988
59431
  constructor(editor) {
58989
59432
  super(editor);
@@ -59003,7 +59446,7 @@ $$${mathData.mathjaxText}$$
59003
59446
  }
59004
59447
  getCommands(range) {
59005
59448
  var _a, _b;
59006
- assert(logger$1L, range.start.blockId === range.end.blockId, "invalid range");
59449
+ assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
59007
59450
  const commandsMap = /* @__PURE__ */ new Map();
59008
59451
  const block = this.editor.getBlockById(range.anchor.blockId);
59009
59452
  const container = getParentContainer(block);
@@ -59408,7 +59851,7 @@ $$${mathData.mathjaxText}$$
59408
59851
  "CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
59409
59852
  ...headingShortcut()
59410
59853
  };
59411
- const zhCN$q = {
59854
+ const zhCN$p = {
59412
59855
  quickMenu: {
59413
59856
  basic: {
59414
59857
  heading: {
@@ -59464,7 +59907,7 @@ $$${mathData.mathjaxText}$$
59464
59907
  selectBlock: "\u9009\u62E9\u533A\u5757"
59465
59908
  }
59466
59909
  };
59467
- const enUS$q = {
59910
+ const enUS$p = {
59468
59911
  quickMenu: {
59469
59912
  basic: {
59470
59913
  heading: {
@@ -59520,7 +59963,7 @@ $$${mathData.mathjaxText}$$
59520
59963
  selectBlock: "Select Block"
59521
59964
  }
59522
59965
  };
59523
- const jaJP$q = {
59966
+ const jaJP$p = {
59524
59967
  quickMenu: {
59525
59968
  basic: {
59526
59969
  heading: {
@@ -59577,9 +60020,9 @@ $$${mathData.mathjaxText}$$
59577
60020
  }
59578
60021
  };
59579
60022
  i18n$1.mergeLang({
59580
- "zh-CN": zhCN$q,
59581
- "en-US": enUS$q,
59582
- "ja-JP": jaJP$q
60023
+ "zh-CN": zhCN$p,
60024
+ "en-US": enUS$p,
60025
+ "ja-JP": jaJP$p
59583
60026
  });
59584
60027
  class TextStylesFixedProvider extends ProxyProvider {
59585
60028
  constructor(editor, afterCommandCallback) {
@@ -59784,7 +60227,7 @@ $$${mathData.mathjaxText}$$
59784
60227
  return false;
59785
60228
  }
59786
60229
  }
59787
- const logger$1K = getLogger("block-command-providers");
60230
+ const logger$1I = getLogger("block-command-providers");
59788
60231
  class BlockCommandProviders extends AbstractProvider {
59789
60232
  constructor(editor, afterCommandCallback) {
59790
60233
  super(editor);
@@ -59805,7 +60248,7 @@ $$${mathData.mathjaxText}$$
59805
60248
  this.registerCommandProvider(new InsertGroupProvider(editor));
59806
60249
  }
59807
60250
  getCommands(range) {
59808
- assert(logger$1K, range.start.blockId === range.end.blockId, "invalid range");
60251
+ assert(logger$1I, range.start.blockId === range.end.blockId, "invalid range");
59809
60252
  const block = this.editor.getBlockById(range.anchor.blockId);
59810
60253
  const commandsMap = /* @__PURE__ */ new Map();
59811
60254
  let startIndex = 100;
@@ -59819,7 +60262,7 @@ $$${mathData.mathjaxText}$$
59819
60262
  return this.filterItems(range, commands);
59820
60263
  }
59821
60264
  }
59822
- const logger$1J = getLogger("standard-block-actions");
60265
+ const logger$1H = getLogger("standard-block-actions");
59823
60266
  class StandardBlockActionHook {
59824
60267
  constructor() {
59825
60268
  __publicField(this, "executeCommand", (editor, bloockElement, item) => {
@@ -59838,7 +60281,7 @@ $$${mathData.mathjaxText}$$
59838
60281
  this.deleteBlock(editor, block);
59839
60282
  }
59840
60283
  } catch (err) {
59841
- logger$1J.error(`failed to execute block command: ${JSON.stringify(err)}`);
60284
+ logger$1H.error(`failed to execute block command: ${JSON.stringify(err)}`);
59842
60285
  }
59843
60286
  });
59844
60287
  }
@@ -59906,7 +60349,7 @@ $$${mathData.mathjaxText}$$
59906
60349
  }
59907
60350
  }
59908
60351
  }
59909
- const logger$1I = getLogger("block-menu");
60352
+ const logger$1G = getLogger("block-menu");
59910
60353
  class BlockMenu {
59911
60354
  constructor(editor) {
59912
60355
  __publicField(this, "menu");
@@ -59914,7 +60357,7 @@ $$${mathData.mathjaxText}$$
59914
60357
  __publicField(this, "commandBlock", null);
59915
60358
  __publicField(this, "blockCommandProviders");
59916
60359
  __publicField(this, "handleShow", () => {
59917
- assert(logger$1I, this.currentBlock, "no target block before show block menu");
60360
+ assert(logger$1G, this.currentBlock, "no target block before show block menu");
59918
60361
  const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
59919
60362
  this.menu.updateItems(items);
59920
60363
  this.commandBlock = this.currentBlock;
@@ -59925,7 +60368,7 @@ $$${mathData.mathjaxText}$$
59925
60368
  }
59926
60369
  });
59927
60370
  __publicField(this, "handleItemClick", (bar2, item) => {
59928
- assert(logger$1I, this.commandBlock, "no command block before show block menu");
60371
+ assert(logger$1G, this.commandBlock, "no command block before show block menu");
59929
60372
  this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
59930
60373
  if (!item.element) {
59931
60374
  this.close();
@@ -59968,7 +60411,7 @@ $$${mathData.mathjaxText}$$
59968
60411
  this.menu.destroy();
59969
60412
  }
59970
60413
  }
59971
- const logger$1H = getLogger("text-styles");
60414
+ const logger$1F = getLogger("text-styles");
59972
60415
  function getIntersectionStyles(text2) {
59973
60416
  const getOpStyle = (op) => {
59974
60417
  if (!op.attributes) {
@@ -60002,10 +60445,10 @@ $$${mathData.mathjaxText}$$
60002
60445
  return new Map(Object.entries(attributes));
60003
60446
  }
60004
60447
  function applyTextStyle(editor, block, range, style2, value) {
60005
- assert(logger$1H, range.isSimple(), "invalid range");
60448
+ assert(logger$1F, range.isSimple(), "invalid range");
60006
60449
  const { start, end } = range;
60007
- assert(logger$1H, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
60008
- assert(logger$1H, style2.startsWith("style-"), "invalid style");
60450
+ assert(logger$1F, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
60451
+ assert(logger$1F, style2.startsWith("style-"), "invalid style");
60009
60452
  const oldText = editor.getBlockText(block);
60010
60453
  let newText = oldText;
60011
60454
  if (style2 === "style-sub") {
@@ -60051,13 +60494,13 @@ $$${mathData.mathjaxText}$$
60051
60494
  return standardItems;
60052
60495
  }
60053
60496
  function getSubText(editor, block, range) {
60054
- assert(logger$1H, range.isSimple(), "nor a simple range");
60497
+ assert(logger$1F, range.isSimple(), "nor a simple range");
60055
60498
  const { start, end } = range;
60056
- assert(logger$1H, start.isSimple(), "is not a simple block position");
60057
- assert(logger$1H, end.isSimple(), "is not a simple block position");
60058
- assert(logger$1H, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
60499
+ assert(logger$1F, start.isSimple(), "is not a simple block position");
60500
+ assert(logger$1F, end.isSimple(), "is not a simple block position");
60501
+ assert(logger$1F, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
60059
60502
  const blockId = getBlockId(block);
60060
- assert(logger$1H, start.blockId === blockId && end.blockId === blockId, "invalid range");
60503
+ assert(logger$1F, start.blockId === blockId && end.blockId === blockId, "invalid range");
60061
60504
  const text2 = editor.getBlockText(block);
60062
60505
  let subText2 = [];
60063
60506
  if (start.offset === end.offset) {
@@ -60069,7 +60512,7 @@ $$${mathData.mathjaxText}$$
60069
60512
  }
60070
60513
  return subText2;
60071
60514
  }
60072
- const logger$1G = getLogger("text-commands");
60515
+ const logger$1E = getLogger("text-commands");
60073
60516
  function getCommands$1(editor, text2) {
60074
60517
  const StandardTextStyles = {
60075
60518
  "style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
@@ -60087,13 +60530,13 @@ $$${mathData.mathjaxText}$$
60087
60530
  }
60088
60531
  function executeStyleCommand(editor, block, range, command, params, result) {
60089
60532
  if (!command.startsWith("style-")) {
60090
- logger$1G.warn(`unknown command: ${command}`);
60533
+ logger$1E.warn(`unknown command: ${command}`);
60091
60534
  return false;
60092
60535
  }
60093
60536
  const value = params == null ? void 0 : params.value;
60094
60537
  const type = typeof value;
60095
60538
  if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
60096
- logger$1G.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
60539
+ logger$1E.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
60097
60540
  return false;
60098
60541
  }
60099
60542
  const newText = applyTextStyle(editor, block, range, command, value);
@@ -60318,7 +60761,7 @@ $$${mathData.mathjaxText}$$
60318
60761
  this.providers = [new TextScriptProvider(editor)];
60319
60762
  }
60320
60763
  }
60321
- const logger$1F = getLogger("text-command-provider");
60764
+ const logger$1D = getLogger("text-command-provider");
60322
60765
  class TextCommandProvider {
60323
60766
  constructor(editor, options) {
60324
60767
  __publicField(this, "id", "TextCommandProvider");
@@ -60438,7 +60881,7 @@ $$${mathData.mathjaxText}$$
60438
60881
  }
60439
60882
  static fromTextCommandId(id) {
60440
60883
  const prefix = "text/";
60441
- assert(logger$1F, id.startsWith(prefix), `invalid item id: ${id}`);
60884
+ assert(logger$1D, id.startsWith(prefix), `invalid item id: ${id}`);
60442
60885
  return id.substring(prefix.length);
60443
60886
  }
60444
60887
  }
@@ -60554,7 +60997,7 @@ $$${mathData.mathjaxText}$$
60554
60997
  };
60555
60998
  editor.updateBlockData(block, newData);
60556
60999
  }
60557
- function addCommentToBlock$1(editor, block, provider) {
61000
+ function addCommentToBlock(editor, block, provider) {
60558
61001
  const abstract = getCommentAbstract(editor, [block]);
60559
61002
  const comment = createComment({
60560
61003
  editor,
@@ -60565,7 +61008,7 @@ $$${mathData.mathjaxText}$$
60565
61008
  provider.localCreateComment(comment, doc2);
60566
61009
  return comment;
60567
61010
  }
60568
- const logger$1E = getLogger("standard-block-actions");
61011
+ const logger$1C = getLogger("standard-block-actions");
60569
61012
  class CommentBlockHook {
60570
61013
  constructor(provider, editorComments) {
60571
61014
  __publicField(this, "executeCommand", (editor, block, item) => {
@@ -60573,9 +61016,9 @@ $$${mathData.mathjaxText}$$
60573
61016
  try {
60574
61017
  this.editorComments.showCommentList();
60575
61018
  const block2 = editor.getBlockById(blockId);
60576
- addCommentToBlock$1(editor, block2, this.provider);
61019
+ addCommentToBlock(editor, block2, this.provider);
60577
61020
  } catch (err) {
60578
- logger$1E.error(`failed to execute block command: ${JSON.stringify(err)}`);
61021
+ logger$1C.error(`failed to execute block command: ${JSON.stringify(err)}`);
60579
61022
  }
60580
61023
  });
60581
61024
  this.provider = provider;
@@ -60679,7 +61122,7 @@ $$${mathData.mathjaxText}$$
60679
61122
  const attributes = Array.from(element.attributes).map((c) => c.name);
60680
61123
  return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
60681
61124
  }
60682
- const logger$1D = getLogger("doc-comments");
61125
+ const logger$1B = getLogger("doc-comments");
60683
61126
  function addBlockComments(doc2, block, result, resultSet) {
60684
61127
  if (block.comments) {
60685
61128
  const blockComments = block.comments;
@@ -60774,8 +61217,8 @@ $$${mathData.mathjaxText}$$
60774
61217
  const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
60775
61218
  const index1 = commentsMap.get(group1.groupId);
60776
61219
  const index2 = commentsMap.get(group2.groupId);
60777
- assert(logger$1D, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
60778
- assert(logger$1D, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
61220
+ assert(logger$1B, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
61221
+ assert(logger$1B, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
60779
61222
  return index1 - index2;
60780
61223
  });
60781
61224
  return result;
@@ -60836,7 +61279,7 @@ $$${mathData.mathjaxText}$$
60836
61279
  const commentIds = intersection__default.default(comments1, comments2);
60837
61280
  return commentIds;
60838
61281
  }
60839
- const logger$1C = getLogger("active-comments");
61282
+ const logger$1A = getLogger("active-comments");
60840
61283
  function inactiveComment(editor, commentId) {
60841
61284
  const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
60842
61285
  activeCommentElements.forEach((el) => {
@@ -60872,13 +61315,12 @@ $$${mathData.mathjaxText}$$
60872
61315
  const commentIds = getCommentsFromSelection(editor);
60873
61316
  if (commentIds.indexOf(commentId) === -1) {
60874
61317
  const block = getParentBlock(targetElement);
60875
- assert(logger$1C, block, "block not found");
61318
+ assert(logger$1A, block, "block not found");
60876
61319
  const offset = getChildOffset(block, targetElement);
60877
61320
  const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
60878
61321
  editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
60879
61322
  }
60880
61323
  }
60881
- editor.focus();
60882
61324
  if (direction === "next") {
60883
61325
  const targetElementRect = targetElement.getBoundingClientRect();
60884
61326
  const clientHeight = editor.scrollContainer.clientHeight;
@@ -60915,7 +61357,7 @@ $$${mathData.mathjaxText}$$
60915
61357
  function isValidSize(size) {
60916
61358
  return typeof size === "number";
60917
61359
  }
60918
- const logger$1B = getLogger("image-data");
61360
+ const logger$1z = getLogger("image-data");
60919
61361
  const md5Cache = /* @__PURE__ */ new Map();
60920
61362
  const DEFAULT_WIDTH$1 = 1e3;
60921
61363
  const DEFAULT_HEIGHT = 400;
@@ -61047,7 +61489,7 @@ $$${mathData.mathjaxText}$$
61047
61489
  if (heightKey && isValidSize(image.height)) {
61048
61490
  result[heightKey] = image.height;
61049
61491
  }
61050
- assert(logger$1B, image.flex, "no image flex");
61492
+ assert(logger$1z, image.flex, "no image flex");
61051
61493
  const flexKey = getImageFlexKeyFromSrc(index2);
61052
61494
  result[flexKey] = image.flex;
61053
61495
  });
@@ -61103,224 +61545,7 @@ $$${mathData.mathjaxText}$$
61103
61545
  const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
61104
61546
  return totalFlex;
61105
61547
  }
61106
- function createResizeGripper(parent, type) {
61107
- const elem = createElement("div", ["resize-gripper", type], parent);
61108
- elem.setAttribute("data-resize-type", type);
61109
- }
61110
- function getExistsResizer(block) {
61111
- const tools = getBlockTools(block);
61112
- return tools.querySelector(".block-resizer");
61113
- }
61114
- function hideResizer(block) {
61115
- const exists = getExistsResizer(block);
61116
- if (exists) {
61117
- removeClass(exists, "active");
61118
- }
61119
- }
61120
- function updateSize(block, element, resizer) {
61121
- const blockRect = block.getBoundingClientRect();
61122
- const elementRect = element.getBoundingClientRect();
61123
- const top = elementRect.top - blockRect.top;
61124
- const left = elementRect.left - blockRect.left;
61125
- const width = elementRect.width;
61126
- const height = elementRect.height;
61127
- resizer.style.top = `${top}px`;
61128
- resizer.style.left = `${left}px`;
61129
- resizer.style.width = `${width}px`;
61130
- resizer.style.height = `${height}px`;
61131
- }
61132
- function createResizer(block, element, options, mouseDownEvent) {
61133
- const exists = getExistsResizer(block);
61134
- if (exists) {
61135
- addClass(exists, "active");
61136
- updateSize(block, element, exists);
61137
- return exists;
61138
- }
61139
- const tools = getBlockTools(block);
61140
- const resizer = createElement("div", ["block-resizer"], tools);
61141
- updateSize(block, element, resizer);
61142
- options.resize.forEach((type) => {
61143
- createResizeGripper(resizer, type);
61144
- });
61145
- resizer.addEventListener("mousedown", mouseDownEvent);
61146
- addClass(resizer, "active");
61147
- return resizer;
61148
- }
61149
- function updateResizer(block, element) {
61150
- const resizer = getExistsResizer(block);
61151
- if (!resizer) {
61152
- return;
61153
- }
61154
- if (!isChildNode(block, element)) {
61155
- return;
61156
- }
61157
- const blockRect = block.getBoundingClientRect();
61158
- const elementRect = element.getBoundingClientRect();
61159
- const top = elementRect.top - blockRect.top;
61160
- const left = elementRect.left - blockRect.left;
61161
- const width = elementRect.width;
61162
- const height = elementRect.height;
61163
- resizer.style.top = `${top}px`;
61164
- resizer.style.left = `${left}px`;
61165
- resizer.style.width = `${width}px`;
61166
- resizer.style.height = `${height}px`;
61167
- }
61168
- const style$8 = "";
61169
- const logger$1A = getLogger("block-resizer");
61170
- class BlockResizer extends tinyTypedEmitter.TypedEmitter {
61171
- constructor(editor, options) {
61172
- super();
61173
- __publicField(this, "resizableElement");
61174
- __publicField(this, "block", null);
61175
- __publicField(this, "startRect", null);
61176
- __publicField(this, "startPos", null);
61177
- __publicField(this, "resizeType", null);
61178
- __publicField(this, "enabled", false);
61179
- __publicField(this, "handleEditorResize", () => {
61180
- if (this.block) {
61181
- this.updateResizer();
61182
- }
61183
- });
61184
- __publicField(this, "handleMouseDown", (event) => {
61185
- event.preventDefault();
61186
- event.stopPropagation();
61187
- const element = this.getResizableElement();
61188
- if (!element) {
61189
- return;
61190
- }
61191
- if (event.button !== 0) {
61192
- return;
61193
- }
61194
- const gripper = event.target;
61195
- if (!gripper) {
61196
- return;
61197
- }
61198
- if (!(gripper instanceof HTMLElement)) {
61199
- return;
61200
- }
61201
- const resizeType = gripper.getAttribute("data-resize-type");
61202
- if (!resizeType) {
61203
- return;
61204
- }
61205
- this.bindEvents();
61206
- this.startRect = element.getBoundingClientRect();
61207
- this.startPos = event;
61208
- this.resizeType = resizeType;
61209
- setDefaultCursor(window.getComputedStyle(gripper).cursor);
61210
- if (this.block) {
61211
- this.editor.selection.selectBlock(this.block, 0);
61212
- }
61213
- });
61214
- __publicField(this, "handleMouseMove", (event) => {
61215
- if (!this.startPos || !this.startRect || !this.resizeType) {
61216
- return;
61217
- }
61218
- const element = this.getResizableElement();
61219
- if (!element || !this.block) {
61220
- return;
61221
- }
61222
- const deltaX = event.x - this.startPos.x;
61223
- const deltaY = event.y - this.startPos.y;
61224
- const oldRect = this.startRect;
61225
- let { top, left, right, bottom } = oldRect;
61226
- if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
61227
- bottom += deltaY;
61228
- }
61229
- if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
61230
- top += deltaY;
61231
- }
61232
- if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
61233
- left += deltaX;
61234
- }
61235
- if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
61236
- right += deltaX;
61237
- }
61238
- const width = right > left ? right - left : 0;
61239
- const height = bottom > top ? bottom - top : 0;
61240
- const newRect = new DOMRect(left, top, width, height);
61241
- this.emit("resizing", this, newRect);
61242
- const newElement = this.getResizableElement();
61243
- if (newElement) {
61244
- updateResizer(this.block, newElement);
61245
- }
61246
- });
61247
- __publicField(this, "handleMouseUp", (event) => {
61248
- if (event.button !== 0) {
61249
- return;
61250
- }
61251
- setDefaultCursor("");
61252
- this.unbindEvents();
61253
- this.emit("resized", this);
61254
- const element = this.getResizableElement();
61255
- if (!element || !this.block) {
61256
- return;
61257
- }
61258
- updateResizer(this.block, element);
61259
- });
61260
- this.editor = editor;
61261
- this.options = options;
61262
- this.editor.addListener("resize", this.handleEditorResize);
61263
- }
61264
- enableResize(block, resizableElement) {
61265
- this.block = block;
61266
- this.resizableElement = resizableElement;
61267
- this.createResizer();
61268
- this.enabled = true;
61269
- }
61270
- disableResize() {
61271
- if (!this.block) {
61272
- return;
61273
- }
61274
- hideResizer(this.block);
61275
- this.enabled = false;
61276
- }
61277
- update(block, resizableElement) {
61278
- this.block = block;
61279
- this.resizableElement = resizableElement;
61280
- const elem = this.getResizableElement();
61281
- if (elem && this.enabled) {
61282
- this.createResizer();
61283
- }
61284
- }
61285
- updateResizer() {
61286
- const newElement = this.getResizableElement();
61287
- if (newElement && this.block) {
61288
- updateResizer(this.block, newElement);
61289
- }
61290
- }
61291
- getBlock() {
61292
- return this.block;
61293
- }
61294
- destroy() {
61295
- this.editor.removeListener("resize", this.handleEditorResize);
61296
- }
61297
- getResizableElement() {
61298
- if (this.resizableElement) {
61299
- return this.resizableElement;
61300
- }
61301
- if (!this.block) {
61302
- return null;
61303
- }
61304
- return getBlockContent(this.block);
61305
- }
61306
- createResizer() {
61307
- const element = this.getResizableElement();
61308
- if (!element || !this.block) {
61309
- return;
61310
- }
61311
- assert(logger$1A, isChildNode(this.block, element), "not a block child element");
61312
- createResizer(this.block, element, this.options, this.handleMouseDown);
61313
- }
61314
- bindEvents() {
61315
- document.addEventListener("mousemove", this.handleMouseMove);
61316
- document.addEventListener("mouseup", this.handleMouseUp);
61317
- }
61318
- unbindEvents() {
61319
- document.removeEventListener("mousemove", this.handleMouseMove);
61320
- document.removeEventListener("mouseup", this.handleMouseUp);
61321
- }
61322
- }
61323
- const logger$1z = getLogger("image-dom");
61548
+ const logger$1y = getLogger("image-dom");
61324
61549
  function getExistsProgressMask(imageContainer) {
61325
61550
  return imageContainer.querySelector(".uploading-progress-mask");
61326
61551
  }
@@ -61337,7 +61562,7 @@ $$${mathData.mathjaxText}$$
61337
61562
  function getImageUploadingProgressValueElement(imageContainer) {
61338
61563
  const bar2 = getImageUploadingProgressMask(imageContainer);
61339
61564
  const value = bar2.querySelector(".uploading-progress-bar-value");
61340
- assert(logger$1z, value, "no progress value");
61565
+ assert(logger$1y, value, "no progress value");
61341
61566
  return value;
61342
61567
  }
61343
61568
  function setImageUploading(imageContainer, progress) {
@@ -61427,7 +61652,7 @@ $$${mathData.mathjaxText}$$
61427
61652
  const images = Array.from(block.querySelectorAll(".image-container"));
61428
61653
  return images;
61429
61654
  }
61430
- const logger$1y = getLogger("table-resize-drag-drop");
61655
+ const logger$1x = getLogger("table-resize-drag-drop");
61431
61656
  class ImageSplitterResizer {
61432
61657
  constructor(editor, elem, data2, mouseDownEvent) {
61433
61658
  __publicField(this, "cursor", "col-resize");
@@ -61440,7 +61665,7 @@ $$${mathData.mathjaxText}$$
61440
61665
  const imageObject = getImageObject(this.editor, block);
61441
61666
  const images = imageObject.getImages();
61442
61667
  const splitterIndex = this.data.splitterIndex;
61443
- assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61668
+ assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61444
61669
  const imageContainers = getImageContainersByBlock(block);
61445
61670
  const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
61446
61671
  this.initWidths = initWidths;
@@ -61458,7 +61683,7 @@ $$${mathData.mathjaxText}$$
61458
61683
  const imageObject = getImageObject(this.editor, block);
61459
61684
  const images = cloneDeep__default.default(imageObject.getImages());
61460
61685
  const splitterIndex = this.data.splitterIndex;
61461
- assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61686
+ assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61462
61687
  const width1 = this.initWidths[splitterIndex];
61463
61688
  const width2 = this.initWidths[splitterIndex + 1];
61464
61689
  if (width1 + width2 < 100) {
@@ -61477,7 +61702,7 @@ $$${mathData.mathjaxText}$$
61477
61702
  newWidths[splitterIndex] += delta;
61478
61703
  newWidths[splitterIndex + 1] -= delta;
61479
61704
  const imageContainers = getImageContainersByBlock(block);
61480
- assert(logger$1y, imageContainers.length === images.length, "invalid image data");
61705
+ assert(logger$1x, imageContainers.length === images.length, "invalid image data");
61481
61706
  const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
61482
61707
  for (let i = 0; i < images.length; i++) {
61483
61708
  const flex = newWidths[i] / totalWidth;
@@ -61550,7 +61775,7 @@ $$${mathData.mathjaxText}$$
61550
61775
  editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
61551
61776
  editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
61552
61777
  }
61553
- const logger$1x = getLogger("image-item");
61778
+ const logger$1w = getLogger("image-item");
61554
61779
  function getParentImageBlock(eventTarget) {
61555
61780
  if (!eventTarget) {
61556
61781
  return null;
@@ -61629,7 +61854,7 @@ $$${mathData.mathjaxText}$$
61629
61854
  if (file2) {
61630
61855
  imageObject.replaceImage(index2, file2);
61631
61856
  } else {
61632
- logger$1x.warn(`failed to download image: ${imageData.src}`);
61857
+ logger$1w.warn(`failed to download image: ${imageData.src}`);
61633
61858
  }
61634
61859
  }
61635
61860
  function createLoadErrorElement(editor, imageContainer, imageData) {
@@ -61852,7 +62077,7 @@ $$${mathData.mathjaxText}$$
61852
62077
  function isImageFile(fileType) {
61853
62078
  return fileType.startsWith("image/");
61854
62079
  }
61855
- const logger$1w = getLogger("image-object");
62080
+ const logger$1v = getLogger("image-object");
61856
62081
  class ImageObject {
61857
62082
  constructor(editor, blockData) {
61858
62083
  __publicField(this, "images", []);
@@ -62143,7 +62368,7 @@ $$${mathData.mathjaxText}$$
62143
62368
  this.editor.updateEmbedData(block2, embedData);
62144
62369
  return true;
62145
62370
  } catch (err) {
62146
- logger$1w.error(err);
62371
+ logger$1v.error(err);
62147
62372
  const block2 = this.editor.findBlockById(this.blockData.id);
62148
62373
  if (!block2) {
62149
62374
  return false;
@@ -62160,7 +62385,7 @@ $$${mathData.mathjaxText}$$
62160
62385
  if (!block) {
62161
62386
  return;
62162
62387
  }
62163
- assert(logger$1w, flex.length === this.images.length, "invalid flex");
62388
+ assert(logger$1v, flex.length === this.images.length, "invalid flex");
62164
62389
  for (let i = 0; i < this.images.length; i++) {
62165
62390
  this.images[i].flex = flex[i];
62166
62391
  }
@@ -62209,7 +62434,7 @@ $$${mathData.mathjaxText}$$
62209
62434
  }
62210
62435
  }
62211
62436
  const imageEmbedStyle = "";
62212
- const logger$1v = getLogger("drop-indicator");
62437
+ const logger$1u = getLogger("drop-indicator");
62213
62438
  const INDICATOR_SIZE$1 = 2;
62214
62439
  class DropIndicator {
62215
62440
  constructor(editor) {
@@ -62254,7 +62479,7 @@ $$${mathData.mathjaxText}$$
62254
62479
  if (insertPos === "before") {
62255
62480
  const beforeBlock = getPrevVisibleBlock(block);
62256
62481
  if (!beforeBlock) {
62257
- assert(logger$1v, isChildContainer(getParentContainer(block)), "block does not in a child container");
62482
+ assert(logger$1u, isChildContainer(getParentContainer(block)), "block does not in a child container");
62258
62483
  const rect = block.getBoundingClientRect();
62259
62484
  const viewRect2 = this.getViewRect(block);
62260
62485
  return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
@@ -62280,14 +62505,14 @@ $$${mathData.mathjaxText}$$
62280
62505
  const PADDING = 5;
62281
62506
  if (insertPos.pos === "left") {
62282
62507
  const parent = getParentContainer(block);
62283
- assert(logger$1v, parent, "block does not in a container");
62508
+ assert(logger$1u, parent, "block does not in a container");
62284
62509
  const rect = block.getBoundingClientRect();
62285
62510
  const viewRect = this.getViewRect(block);
62286
62511
  return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
62287
62512
  }
62288
62513
  if (insertPos.pos === "right") {
62289
62514
  const parent = getParentContainer(block);
62290
- assert(logger$1v, parent, "block does not in a container");
62515
+ assert(logger$1u, parent, "block does not in a container");
62291
62516
  const rect = block.getBoundingClientRect();
62292
62517
  let viewRect;
62293
62518
  if (isEmbedBlock(block)) {
@@ -62384,7 +62609,7 @@ $$${mathData.mathjaxText}$$
62384
62609
  }
62385
62610
  return void 0;
62386
62611
  }
62387
- const logger$1u = getLogger("code-dom");
62612
+ const logger$1t = getLogger("code-dom");
62388
62613
  function isCodeBlock(block) {
62389
62614
  return getBlockType(block) === "code";
62390
62615
  }
@@ -62402,8 +62627,8 @@ $$${mathData.mathjaxText}$$
62402
62627
  }
62403
62628
  function getParentCodeBlock(elem) {
62404
62629
  const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
62405
- assert(logger$1u, codeBlock2, "no parent code block");
62406
- assert(logger$1u, isCodeBlock(codeBlock2), "not a code block");
62630
+ assert(logger$1t, codeBlock2, "no parent code block");
62631
+ assert(logger$1t, isCodeBlock(codeBlock2), "not a code block");
62407
62632
  return codeBlock2;
62408
62633
  }
62409
62634
  const SUPPORTED_LANGUAGES = () => ({
@@ -62494,7 +62719,7 @@ $$${mathData.mathjaxText}$$
62494
62719
  function setDefaultLanguage(editor, lang) {
62495
62720
  return editor.settingsProvider.setItem("editor-code-lang", lang);
62496
62721
  }
62497
- const logger$1t = getLogger("convert-to-code");
62722
+ const logger$1s = getLogger("convert-to-code");
62498
62723
  function convertToCode(editor, srcBlock) {
62499
62724
  if (!isTextKindBlock(editor, srcBlock)) {
62500
62725
  return null;
@@ -62507,7 +62732,7 @@ $$${mathData.mathjaxText}$$
62507
62732
  const textContainerId = genId();
62508
62733
  editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
62509
62734
  const text2 = editor.getBlockData(srcBlock).text;
62510
- assert(logger$1t, text2, "no text");
62735
+ assert(logger$1s, text2, "no text");
62511
62736
  let alias = toPlainText(text2);
62512
62737
  if (alias.startsWith("```")) {
62513
62738
  alias = alias.substring(3);
@@ -62525,16 +62750,16 @@ $$${mathData.mathjaxText}$$
62525
62750
  };
62526
62751
  }
62527
62752
  const codeBlock = "";
62528
- const logger$1s = getLogger("code-block-child-container");
62753
+ const logger$1r = getLogger("code-block-child-container");
62529
62754
  function getTextContainer(codeBlock2) {
62530
- assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
62755
+ assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
62531
62756
  const content = getBlockContent(codeBlock2);
62532
62757
  const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
62533
- assert(logger$1s, textContainer, "no code text container");
62758
+ assert(logger$1r, textContainer, "no code text container");
62534
62759
  return textContainer;
62535
62760
  }
62536
62761
  function getCaptionContainer(codeBlock2) {
62537
- assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
62762
+ assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
62538
62763
  const content = getBlockContent(codeBlock2);
62539
62764
  const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
62540
62765
  if (!textContainer)
@@ -62563,7 +62788,7 @@ $$${mathData.mathjaxText}$$
62563
62788
  }
62564
62789
  return getBlockType(block) === "code";
62565
62790
  }
62566
- const logger$1r = getLogger("code-caption");
62791
+ const logger$1q = getLogger("code-caption");
62567
62792
  function toggleCodeCaption(editor, codeBlock2) {
62568
62793
  if (editor.readonly) {
62569
62794
  return;
@@ -62576,7 +62801,7 @@ $$${mathData.mathjaxText}$$
62576
62801
  }
62577
62802
  const captionContainerId = createEmptyContainer(editor.doc);
62578
62803
  const oldData = editor.getBlockData(codeBlock2);
62579
- assert(logger$1r, oldData.children.length === 1, "code block should have only one child");
62804
+ assert(logger$1q, oldData.children.length === 1, "code block should have only one child");
62580
62805
  const newData = {
62581
62806
  ...oldData,
62582
62807
  children: [oldData.children[0], captionContainerId]
@@ -62592,7 +62817,7 @@ $$${mathData.mathjaxText}$$
62592
62817
  return false;
62593
62818
  }
62594
62819
  const parentBlock = getParentBlock(parentContainer);
62595
- assert(logger$1r, parentBlock, "no parent block");
62820
+ assert(logger$1q, parentBlock, "no parent block");
62596
62821
  if (!isCodeBlock(parentBlock)) {
62597
62822
  return false;
62598
62823
  }
@@ -62612,7 +62837,7 @@ $$${mathData.mathjaxText}$$
62612
62837
  const lastBlock2 = getLastChildBlock(textContainer);
62613
62838
  editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
62614
62839
  const oldData = editor.getBlockData(codeBlock2);
62615
- assert(logger$1r, oldData.children.length === 2, "code block should have only one child");
62840
+ assert(logger$1q, oldData.children.length === 2, "code block should have only one child");
62616
62841
  const captionContainerId = oldData.children[1];
62617
62842
  const newData = {
62618
62843
  ...oldData,
@@ -62621,7 +62846,7 @@ $$${mathData.mathjaxText}$$
62621
62846
  editor.updateBlockData(codeBlock2, newData);
62622
62847
  editor.deleteChildContainers([captionContainerId]);
62623
62848
  }
62624
- const logger$1q = getLogger("paste-in-table-block");
62849
+ const logger$1p = getLogger("paste-in-table-block");
62625
62850
  class PasteEventHandler {
62626
62851
  constructor(editor) {
62627
62852
  this.editor = editor;
@@ -62642,7 +62867,7 @@ $$${mathData.mathjaxText}$$
62642
62867
  return false;
62643
62868
  }
62644
62869
  const parentBlock = getParentBlock(parentContainer);
62645
- assert(logger$1q, parentBlock, "no parent block");
62870
+ assert(logger$1p, parentBlock, "no parent block");
62646
62871
  if (!isCodeBlock(parentBlock)) {
62647
62872
  return false;
62648
62873
  }
@@ -62706,7 +62931,7 @@ $$${mathData.mathjaxText}$$
62706
62931
  function registerCodeBlockCommandProvider(editor) {
62707
62932
  editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
62708
62933
  }
62709
- const logger$1p = getLogger("code-caption-input-handler");
62934
+ const logger$1o = getLogger("code-caption-input-handler");
62710
62935
  function getCurrentCaptionBlock(editor) {
62711
62936
  if (!editor.selection.range.isSimple()) {
62712
62937
  return null;
@@ -62819,7 +63044,7 @@ $$${mathData.mathjaxText}$$
62819
63044
  editor.undoManager.runInGroup(() => {
62820
63045
  editor.clearSelectedContents();
62821
63046
  const start = editor.selection.range.start;
62822
- assert(logger$1p, start.isSimple(), "not simple position");
63047
+ assert(logger$1o, start.isSimple(), "not simple position");
62823
63048
  editor.insertTextToBlock(block, start.offset, text2);
62824
63049
  });
62825
63050
  return true;
@@ -62864,9 +63089,9 @@ $$${mathData.mathjaxText}$$
62864
63089
  };
62865
63090
  editor.updateBlockData(codeBlock2, newData);
62866
63091
  }
62867
- const logger$1o = getLogger("code-block-header");
63092
+ const logger$1n = getLogger("code-block-header");
62868
63093
  function selectCodeBlock(editor, block, options) {
62869
- assert(logger$1o, isCodeBlock(block), "not a code block");
63094
+ assert(logger$1n, isCodeBlock(block), "not a code block");
62870
63095
  const firstBlock = getFirstChildBlock(getTextContainer(block));
62871
63096
  editor.selection.selectBlock(firstBlock, 0);
62872
63097
  if (options.focusToEditor) {
@@ -62908,14 +63133,15 @@ $$${mathData.mathjaxText}$$
62908
63133
  const target = event.target;
62909
63134
  const select2 = target.closest(".language-select");
62910
63135
  const block = getParentBlock(select2);
62911
- assert(logger$1o, block, "no parent block");
62912
- assert(logger$1o, getBlockType(block) === "code", "not a code block");
63136
+ assert(logger$1n, block, "no parent block");
63137
+ assert(logger$1n, getBlockType(block) === "code", "not a code block");
62913
63138
  const codeData = editor2.getBlockData(block);
62914
63139
  const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
62915
63140
  dropdown2.custom = { codeBlock: block, editor: editor2 };
62916
63141
  dropdown2.setSelectedId(codeData.language);
62917
63142
  selectCodeBlock(editor2, block, { focusToEditor: false });
62918
63143
  setTimeout(() => {
63144
+ CommandBar.hideAll();
62919
63145
  dropdown2.show(select2);
62920
63146
  });
62921
63147
  addClass(codeBlock2, "editing-language");
@@ -62931,11 +63157,11 @@ $$${mathData.mathjaxText}$$
62931
63157
  function handleCodeHeaderButtonClick(editor, event) {
62932
63158
  const target = event.target;
62933
63159
  const button2 = target.closest(".code-header-button");
62934
- assert(logger$1o, button2, "no button");
63160
+ assert(logger$1n, button2, "no button");
62935
63161
  const block = getParentBlock(target);
62936
- assert(logger$1o, block, "no parent block");
63162
+ assert(logger$1n, block, "no parent block");
62937
63163
  const id = button2.getAttribute("data-id");
62938
- assert(logger$1o, getBlockType(block) === "code", "not a code block");
63164
+ assert(logger$1n, getBlockType(block) === "code", "not a code block");
62939
63165
  if (id === "wrap") {
62940
63166
  const old = editor.getBlockData(block);
62941
63167
  changeCodeBlockWrap(editor, block, !old.nowrap);
@@ -62961,7 +63187,7 @@ $$${mathData.mathjaxText}$$
62961
63187
  }
62962
63188
  });
62963
63189
  }).catch((err) => {
62964
- logger$1o.error(err.message);
63190
+ logger$1n.error(err.message);
62965
63191
  });
62966
63192
  return;
62967
63193
  }
@@ -63012,7 +63238,7 @@ $$${mathData.mathjaxText}$$
63012
63238
  }
63013
63239
  function getCodeBlockHeader(block) {
63014
63240
  const header = block.querySelector(".code-block-header");
63015
- assert(logger$1o, header, "no code block header");
63241
+ assert(logger$1n, header, "no code block header");
63016
63242
  return header;
63017
63243
  }
63018
63244
  function handleCodeScroll(editor, event) {
@@ -63061,7 +63287,7 @@ $$${mathData.mathjaxText}$$
63061
63287
  focusBlockId: textBlock.id
63062
63288
  };
63063
63289
  }
63064
- const logger$1n = getLogger("code-block");
63290
+ const logger$1m = getLogger("code-block");
63065
63291
  function getPaddingNum(index2) {
63066
63292
  if (index2 <= 2) {
63067
63293
  return 32;
@@ -63088,10 +63314,10 @@ $$${mathData.mathjaxText}$$
63088
63314
  handlePasteInTableEvent(editor);
63089
63315
  registerCodeBlockCommandProvider(editor);
63090
63316
  trackChildBlockEvent(editor, handleDebounceUpdate);
63091
- assert(logger$1n, blockData.type === "code", "invalid block data type");
63317
+ assert(logger$1m, blockData.type === "code", "invalid block data type");
63092
63318
  const codeData = blockData;
63093
- assert(logger$1n, codeData.children, "invalid block data children");
63094
- assert(logger$1n, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
63319
+ assert(logger$1m, codeData.children, "invalid block data children");
63320
+ assert(logger$1m, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
63095
63321
  setTimeout(() => {
63096
63322
  if (isNodeRemoved(blockElement))
63097
63323
  return;
@@ -63142,15 +63368,15 @@ $$${mathData.mathjaxText}$$
63142
63368
  }
63143
63369
  function updateSelection$3(editor, block, from, to) {
63144
63370
  if (from.isSimple()) {
63145
- assert(logger$1n, to.isSimple(), "from is simple position but to is not simple position");
63146
- logger$1n.debug("full select list");
63371
+ assert(logger$1m, to.isSimple(), "from is simple position but to is not simple position");
63372
+ logger$1m.debug("full select list");
63147
63373
  addClass(block, "full-selected");
63148
63374
  return;
63149
63375
  }
63150
- assert(logger$1n, !to.isSimple(), "from is complex position but end is simple position");
63376
+ assert(logger$1m, !to.isSimple(), "from is complex position but end is simple position");
63151
63377
  const f = from;
63152
63378
  const t2 = to;
63153
- assert(logger$1n, f.blockId === t2.blockId, "only allow update one table selection");
63379
+ assert(logger$1m, f.blockId === t2.blockId, "only allow update one table selection");
63154
63380
  const containers = getCodeChildContainers(block);
63155
63381
  containers.forEach((container) => {
63156
63382
  const containerId = getContainerId(container);
@@ -63185,8 +63411,8 @@ $$${mathData.mathjaxText}$$
63185
63411
  const containersIds = childContainers.map(getContainerId);
63186
63412
  const startIndex = containersIds.indexOf(start.childContainerId);
63187
63413
  const endIndex = containersIds.indexOf(end.childContainerId);
63188
- assert(logger$1n, startIndex !== -1, "invalid start pos");
63189
- assert(logger$1n, endIndex !== -1, "invalid end pos");
63414
+ assert(logger$1m, startIndex !== -1, "invalid start pos");
63415
+ assert(logger$1m, endIndex !== -1, "invalid end pos");
63190
63416
  const ret = [childContainers[startIndex]];
63191
63417
  if (startIndex !== endIndex) {
63192
63418
  ret.push(childContainers[endIndex]);
@@ -63194,7 +63420,7 @@ $$${mathData.mathjaxText}$$
63194
63420
  return ret;
63195
63421
  }
63196
63422
  function handleBlockElementUpdated(editor, block, blockData) {
63197
- assert(logger$1n, isCodeBlock(block), "invalid block type");
63423
+ assert(logger$1m, isCodeBlock(block), "invalid block type");
63198
63424
  const codeData = blockData;
63199
63425
  updateCodeBlockElementStyles(editor, block, codeData);
63200
63426
  }
@@ -63386,10 +63612,10 @@ ${codeText}
63386
63612
  "Shift+Tab": handleShiftTab$1,
63387
63613
  "CtrlOrCmd+A": selectCode
63388
63614
  };
63389
- const logger$1m = getLogger("code-text-decorate");
63615
+ const logger$1l = getLogger("code-text-decorate");
63390
63616
  class CodeTextDecorator {
63391
63617
  decorateText(editor, path, blockText) {
63392
- assert(logger$1m, path.length > 0, "invalid path");
63618
+ assert(logger$1l, path.length > 0, "invalid path");
63393
63619
  if (path.length === 1) {
63394
63620
  return {};
63395
63621
  }
@@ -63414,7 +63640,7 @@ ${codeText}
63414
63640
  const grammar = getProsmGrammar(codeData.language);
63415
63641
  const tokens = Prism__default.default.tokenize(code, grammar);
63416
63642
  const tokenToText = (token, attributes) => {
63417
- assert(logger$1m, token, "no token");
63643
+ assert(logger$1l, token, "no token");
63418
63644
  if (typeof token === "string") {
63419
63645
  const ret = {
63420
63646
  insert: token,
@@ -63422,7 +63648,7 @@ ${codeText}
63422
63648
  };
63423
63649
  return [ret];
63424
63650
  }
63425
- assert(logger$1m, token instanceof Prism__default.default.Token, "invalid token type");
63651
+ assert(logger$1l, token instanceof Prism__default.default.Token, "invalid token type");
63426
63652
  const content = token.content;
63427
63653
  const newAttributes = cloneDeep__default.default(attributes);
63428
63654
  newAttributes[`style-code-${token.type}`] = true;
@@ -63438,18 +63664,18 @@ ${codeText}
63438
63664
  const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
63439
63665
  return ret;
63440
63666
  }
63441
- assert(logger$1m, content instanceof Prism__default.default.Token, "invalid token");
63667
+ assert(logger$1l, content instanceof Prism__default.default.Token, "invalid token");
63442
63668
  return tokenToText(content, newAttributes);
63443
63669
  };
63444
63670
  const ops = tokens.map((token) => tokenToText(token, {}));
63445
63671
  const newText = ops.flat();
63446
- assert(logger$1m, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
63672
+ assert(logger$1l, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
63447
63673
  return {
63448
63674
  text: newText
63449
63675
  };
63450
63676
  }
63451
63677
  }
63452
- const zhCN$p = {
63678
+ const zhCN$o = {
63453
63679
  code: {
63454
63680
  title: "\u4EE3\u7801",
63455
63681
  abstract: "\u4EE3\u7801",
@@ -63461,7 +63687,7 @@ ${codeText}
63461
63687
  plainText: "Plain Text"
63462
63688
  }
63463
63689
  };
63464
- const enUS$p = {
63690
+ const enUS$o = {
63465
63691
  code: {
63466
63692
  title: "Code",
63467
63693
  abstract: "Code",
@@ -63473,7 +63699,7 @@ ${codeText}
63473
63699
  plainText: "Plain Text"
63474
63700
  }
63475
63701
  };
63476
- const jaJP$p = {
63702
+ const jaJP$o = {
63477
63703
  code: {
63478
63704
  title: "\u30B3\u30FC\u30C9",
63479
63705
  abstract: "\u30B3\u30FC\u30C9",
@@ -63486,9 +63712,9 @@ ${codeText}
63486
63712
  }
63487
63713
  };
63488
63714
  i18n$1.mergeLang({
63489
- "zh-CN": zhCN$p,
63490
- "en-US": enUS$p,
63491
- "ja-JP": jaJP$p
63715
+ "zh-CN": zhCN$o,
63716
+ "en-US": enUS$o,
63717
+ "ja-JP": jaJP$o
63492
63718
  });
63493
63719
  function convertToTable(editor, containerId, blockIndex, offset) {
63494
63720
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -63749,7 +63975,7 @@ ${codeText}
63749
63975
  }
63750
63976
  return false;
63751
63977
  }
63752
- const logger$1l = getLogger("match-text-style");
63978
+ const logger$1k = getLogger("match-text-style");
63753
63979
  function matchTextPair(text2, find) {
63754
63980
  if (text2.length < find.length * 2 + 1) {
63755
63981
  return -1;
@@ -63819,7 +64045,7 @@ ${codeText}
63819
64045
  editor.insertBoxToBlock(block, start, boxData);
63820
64046
  });
63821
64047
  } catch (err) {
63822
- logger$1l.warn(`failed to convert to box, ${err.message}`);
64048
+ logger$1k.warn(`failed to convert to box, ${err.message}`);
63823
64049
  continue;
63824
64050
  }
63825
64051
  }
@@ -63882,7 +64108,7 @@ ${codeText}
63882
64108
  return false;
63883
64109
  }
63884
64110
  }
63885
- const enUS$o = {
64111
+ const enUS$n = {
63886
64112
  placeholder: {
63887
64113
  default: "Type / for commands",
63888
64114
  heading: "Heading {heading}",
@@ -63893,7 +64119,7 @@ ${codeText}
63893
64119
  mobileDefault: "Type to add content"
63894
64120
  }
63895
64121
  };
63896
- const zhCN$o = {
64122
+ const zhCN$n = {
63897
64123
  placeholder: {
63898
64124
  default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
63899
64125
  heading: "\u6807\u9898{heading}",
@@ -63904,7 +64130,7 @@ ${codeText}
63904
64130
  mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
63905
64131
  }
63906
64132
  };
63907
- const jaJP$o = {
64133
+ const jaJP$n = {
63908
64134
  placeholder: {
63909
64135
  default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
63910
64136
  heading: "\u898B\u51FA\u3057{heading}",
@@ -63916,9 +64142,9 @@ ${codeText}
63916
64142
  }
63917
64143
  };
63918
64144
  const langs$1 = {
63919
- "en-US": enUS$o,
63920
- "zh-CN": zhCN$o,
63921
- "ja-JP": jaJP$o
64145
+ "en-US": enUS$n,
64146
+ "zh-CN": zhCN$n,
64147
+ "ja-JP": jaJP$n
63922
64148
  };
63923
64149
  i18n$1.mergeLang(langs$1);
63924
64150
  function isEmptyTextBlockWithoutCompositionText(editor, block) {
@@ -64085,7 +64311,7 @@ ${codeText}
64085
64311
  }
64086
64312
  return false;
64087
64313
  }
64088
- const logger$1k = getLogger("enforce-title");
64314
+ const logger$1j = getLogger("enforce-title");
64089
64315
  class EnforceWithDocumentTitleHandler {
64090
64316
  constructor(editor, options = {
64091
64317
  headingLevel: 1
@@ -64157,7 +64383,7 @@ ${codeText}
64157
64383
  var _a, _b;
64158
64384
  try {
64159
64385
  const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
64160
- assert(logger$1k, blocks.length > 0, "root container is empty");
64386
+ assert(logger$1j, blocks.length > 0, "root container is empty");
64161
64387
  const firstBlock = blocks[0];
64162
64388
  if (firstBlock.type !== "text" && !this.options.hideTitle) {
64163
64389
  const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
@@ -64166,7 +64392,7 @@ ${codeText}
64166
64392
  return;
64167
64393
  }
64168
64394
  if (!this.options.hideTitle) {
64169
- assert(logger$1k, firstBlock.text, "invalid text block");
64395
+ assert(logger$1j, firstBlock.text, "invalid text block");
64170
64396
  const block = editor.getBlockById(firstBlock.id);
64171
64397
  if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
64172
64398
  const text2 = editor.getBlockString(block);
@@ -64251,7 +64477,7 @@ ${codeText}
64251
64477
  });
64252
64478
  return orgDataUrl;
64253
64479
  }
64254
- const logger$1j = getLogger("drag-preview-image");
64480
+ const logger$1i = getLogger("drag-preview-image");
64255
64481
  class DragPreviewImage {
64256
64482
  constructor(editor) {
64257
64483
  __publicField(this, "startPosition", null);
@@ -64259,7 +64485,7 @@ ${codeText}
64259
64485
  __publicField(this, "handleDragStart", async (e2, preview) => {
64260
64486
  var _a, _b, _c, _d, _e, _f;
64261
64487
  const target = e2.target;
64262
- assert(logger$1j, target instanceof Element, `Invalid Drag target:${target}`);
64488
+ assert(logger$1i, target instanceof Element, `Invalid Drag target:${target}`);
64263
64489
  const { x: startX, y: startY } = e2;
64264
64490
  this.startPosition = {
64265
64491
  x: startX,
@@ -64345,7 +64571,7 @@ ${codeText}
64345
64571
  }
64346
64572
  return block;
64347
64573
  }
64348
- const logger$1i = getLogger("block-menu-drag-handler");
64574
+ const logger$1h = getLogger("block-menu-drag-handler");
64349
64575
  function createDragEventFromMouseEvent$2(event, type) {
64350
64576
  const dragEvent = new DragEvent(type, {
64351
64577
  bubbles: true,
@@ -64366,7 +64592,7 @@ ${codeText}
64366
64592
  __publicField(this, "oldPos", { x: 0, y: 0 });
64367
64593
  __publicField(this, "handleMouseDown", (event) => {
64368
64594
  const block = this.button.blockMenu.currentBlock;
64369
- assert(logger$1i, block, "no dragged block");
64595
+ assert(logger$1h, block, "no dragged block");
64370
64596
  if (event.button !== 0) {
64371
64597
  return;
64372
64598
  }
@@ -64394,7 +64620,7 @@ ${codeText}
64394
64620
  });
64395
64621
  }
64396
64622
  const block = this.button.blockMenu.currentBlock;
64397
- assert(logger$1i, block, "no dragged block");
64623
+ assert(logger$1h, block, "no dragged block");
64398
64624
  (_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
64399
64625
  const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
64400
64626
  registerStandardDraggedObject(this.editor, dragEvent, block);
@@ -64414,7 +64640,7 @@ ${codeText}
64414
64640
  this.handleDragStart(event);
64415
64641
  }
64416
64642
  this.oldPos = { x, y };
64417
- assert(logger$1i, target instanceof Element, "target is invalid");
64643
+ assert(logger$1h, target instanceof Element, "target is invalid");
64418
64644
  this.dragPreview.handleDrag(event);
64419
64645
  const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
64420
64646
  this.editor.contentElement.dispatchEvent(dragEvent);
@@ -64422,7 +64648,7 @@ ${codeText}
64422
64648
  __publicField(this, "handleDragEnd", (event) => {
64423
64649
  var _a;
64424
64650
  const block = this.button.blockMenu.currentBlock;
64425
- assert(logger$1i, block, "no dragged block");
64651
+ assert(logger$1h, block, "no dragged block");
64426
64652
  window.isDragging = false;
64427
64653
  this.dragPreview.handleDragEnd();
64428
64654
  (_a = this.autoScroll) == null ? void 0 : _a.inactive();
@@ -64645,7 +64871,7 @@ ${codeText}
64645
64871
  this.rootButton.destroy();
64646
64872
  }
64647
64873
  }
64648
- const zhCN$n = {
64874
+ const zhCN$m = {
64649
64875
  blockMenu: {
64650
64876
  section: {
64651
64877
  basics: "\u57FA\u7840",
@@ -64669,7 +64895,7 @@ ${codeText}
64669
64895
  }
64670
64896
  }
64671
64897
  };
64672
- const enUS$n = {
64898
+ const enUS$m = {
64673
64899
  blockMenu: {
64674
64900
  section: {
64675
64901
  basics: "Basic",
@@ -64693,7 +64919,7 @@ ${codeText}
64693
64919
  }
64694
64920
  }
64695
64921
  };
64696
- const jaJP$n = {
64922
+ const jaJP$m = {
64697
64923
  blockMenu: {
64698
64924
  section: {
64699
64925
  basics: "\u4E00\u822C",
@@ -64718,9 +64944,9 @@ ${codeText}
64718
64944
  }
64719
64945
  };
64720
64946
  i18n$1.mergeLang({
64721
- "zh-CN": zhCN$n,
64722
- "en-US": enUS$n,
64723
- "ja-JP": jaJP$n
64947
+ "zh-CN": zhCN$m,
64948
+ "en-US": enUS$m,
64949
+ "ja-JP": jaJP$m
64724
64950
  });
64725
64951
  const style$6 = "";
64726
64952
  class DragData {
@@ -64800,7 +65026,7 @@ ${codeText}
64800
65026
  function clearDraggedObject(editor) {
64801
65027
  getDragData(editor).clearData();
64802
65028
  }
64803
- const logger$1h = getLogger("find-drop-target");
65029
+ const logger$1g = getLogger("find-drop-target");
64804
65030
  function childContainerFromPoint(x, y) {
64805
65031
  const elem = getElementFromPoint(x, y);
64806
65032
  if (!elem) {
@@ -64913,13 +65139,13 @@ ${codeText}
64913
65139
  return true;
64914
65140
  }
64915
65141
  const parentBlock = getParentBlock(container);
64916
- assert(logger$1h, parentBlock, "no parent block");
65142
+ assert(logger$1g, parentBlock, "no parent block");
64917
65143
  if (!editor.isBlockWritable(parentBlock)) {
64918
65144
  return false;
64919
65145
  }
64920
65146
  return canInsertAsSibling(editor, parentBlock);
64921
65147
  }
64922
- const logger$1g = getLogger("drop-target");
65148
+ const logger$1f = getLogger("drop-target");
64923
65149
  function getEmbedClassByFile(editor, file2) {
64924
65150
  let embedClass = {};
64925
65151
  if (/image/.test(file2.type)) {
@@ -64929,7 +65155,7 @@ ${codeText}
64929
65155
  } else if (/video/.test(file2.type)) {
64930
65156
  embedClass = editor.editorEmbeds.getEmbedClass("video");
64931
65157
  }
64932
- assert(logger$1g, embedClass, `unSupport file type ${file2.type}`);
65158
+ assert(logger$1f, embedClass, `unSupport file type ${file2.type}`);
64933
65159
  return embedClass;
64934
65160
  }
64935
65161
  async function patchInsertFile(editor, files, containerId, blockIndex) {
@@ -65676,7 +65902,7 @@ ${codeText}
65676
65902
  }
65677
65903
  }
65678
65904
  }
65679
- const zhCN$m = {
65905
+ const zhCN$l = {
65680
65906
  image: {
65681
65907
  title: "\u56FE\u7247",
65682
65908
  upload: {
@@ -65692,7 +65918,7 @@ ${codeText}
65692
65918
  abstract: "\u56FE\u7247"
65693
65919
  }
65694
65920
  };
65695
- const enUS$m = {
65921
+ const enUS$l = {
65696
65922
  image: {
65697
65923
  title: "Image",
65698
65924
  upload: {
@@ -65708,7 +65934,7 @@ ${codeText}
65708
65934
  abstract: "Image"
65709
65935
  }
65710
65936
  };
65711
- const jaJP$m = {
65937
+ const jaJP$l = {
65712
65938
  image: {
65713
65939
  title: "\u753B\u50CF",
65714
65940
  upload: {
@@ -65725,9 +65951,9 @@ ${codeText}
65725
65951
  }
65726
65952
  };
65727
65953
  i18n$1.mergeLang({
65728
- "zh-CN": zhCN$m,
65729
- "en-US": enUS$m,
65730
- "ja-JP": jaJP$m
65954
+ "zh-CN": zhCN$l,
65955
+ "en-US": enUS$l,
65956
+ "ja-JP": jaJP$l
65731
65957
  });
65732
65958
  function convertToImage(editor, containerId, blockIndex, offset) {
65733
65959
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -65781,7 +66007,7 @@ ${codeText}
65781
66007
  return false;
65782
66008
  }
65783
66009
  }
65784
- const logger$1f = getLogger("copy-image");
66010
+ const logger$1e = getLogger("copy-image");
65785
66011
  function getImageClipboardData(editor, img, imageObject, index2) {
65786
66012
  const imageData = imageObject.getImages()[index2];
65787
66013
  const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
@@ -65822,7 +66048,7 @@ ${codeText}
65822
66048
  });
65823
66049
  clipboardData["image/png"] = fileBlob;
65824
66050
  } catch (error2) {
65825
- logger$1f.error(error2);
66051
+ logger$1e.error(error2);
65826
66052
  }
65827
66053
  addMetaToDoc(editor, doc2);
65828
66054
  const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
@@ -66095,195 +66321,6 @@ ${codeText}
66095
66321
  }
66096
66322
  return getDragInsertPos(editor, block, images, x);
66097
66323
  }
66098
- const zhCN$l = {
66099
- embedProperties: {
66100
- edit: "\u7F16\u8F91",
66101
- addComment: "\u6DFB\u52A0\u6279\u6CE8"
66102
- }
66103
- };
66104
- const enUS$l = {
66105
- embedProperties: {
66106
- edit: "Edit",
66107
- addComment: "Add annotation"
66108
- }
66109
- };
66110
- const jaJP$l = {
66111
- embedProperties: {
66112
- edit: "\u7DE8\u96C6",
66113
- addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
66114
- }
66115
- };
66116
- i18n$1.mergeLang({
66117
- "zh-CN": zhCN$l,
66118
- "en-US": enUS$l,
66119
- "ja-JP": jaJP$l
66120
- });
66121
- const logger$1e = getLogger("embed-block-properties");
66122
- function addCommentToBlock(editor, block) {
66123
- var _a;
66124
- for (const hook of editor.blockHooks) {
66125
- const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
66126
- if (!commands) {
66127
- continue;
66128
- }
66129
- if (commands.group === "block-comment-actions") {
66130
- const command = commands.commands[0];
66131
- if (!command) {
66132
- continue;
66133
- }
66134
- commands.executeCommand(editor, block, commands.commands[0], null);
66135
- return true;
66136
- }
66137
- }
66138
- return false;
66139
- }
66140
- class StandardEmbedBlockCommands {
66141
- constructor(editor, block, properties) {
66142
- __publicField(this, "group", "hovering-toolbar");
66143
- __publicField(this, "_commands", [{
66144
- id: "edit",
66145
- name: i18n$1.t("embedProperties.edit"),
66146
- icon: EditIcon
66147
- }, {
66148
- id: "separator",
66149
- name: "",
66150
- type: "separator"
66151
- }]);
66152
- this.editor = editor;
66153
- this.block = block;
66154
- this.properties = properties;
66155
- }
66156
- get commands() {
66157
- var _a, _b, _c, _d;
66158
- if (clientType.isMobile) {
66159
- return [];
66160
- }
66161
- let standardCommands = [];
66162
- if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
66163
- this.properties.presetIds.forEach((id) => {
66164
- const command = this._commands.find((item) => item.id === id);
66165
- if (command) {
66166
- standardCommands.push(command);
66167
- }
66168
- });
66169
- }
66170
- if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
66171
- standardCommands.push(...this.properties.extCommands);
66172
- }
66173
- if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
66174
- standardCommands.push(...this.properties.extCommands(this.editor, this.block));
66175
- }
66176
- if ((_d = this.properties) == null ? void 0 : _d.extIds) {
66177
- this.properties.extIds.forEach((id) => {
66178
- const command = this._commands.find((item) => item.id === id);
66179
- if (command) {
66180
- standardCommands.push(command);
66181
- }
66182
- });
66183
- }
66184
- const { enableComments = true } = this.editor.options;
66185
- if (!enableComments || this.editor.readonly) {
66186
- standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
66187
- }
66188
- if (this.editor.readonly) {
66189
- standardCommands = standardCommands.filter((command) => command.id !== "edit");
66190
- }
66191
- standardCommands.forEach((item) => {
66192
- if (item.id === "add-comment" || item.id === "edit") {
66193
- item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
66194
- }
66195
- });
66196
- return standardCommands;
66197
- }
66198
- executeCommand(editor, block, item) {
66199
- var _a, _b;
66200
- if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
66201
- return;
66202
- }
66203
- if (item.id === "add-comment") {
66204
- if (!addCommentToBlock(editor, block)) {
66205
- logger$1e.error("failed to add comment to block");
66206
- }
66207
- return;
66208
- }
66209
- logger$1e.error(`unknown command: ${JSON.stringify(item)}`);
66210
- }
66211
- }
66212
- function getStandardEmbedBlockProperties(editor, block, properties) {
66213
- return {
66214
- blockCommands: {
66215
- "hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
66216
- }
66217
- };
66218
- }
66219
- class EmbedBlockResizer {
66220
- constructor(editor) {
66221
- __publicField(this, "resizing", false);
66222
- __publicField(this, "blockResizer");
66223
- __publicField(this, "handleResized", () => {
66224
- this.resizing = false;
66225
- });
66226
- __publicField(this, "handleResizing", (resizer, rect) => {
66227
- var _a, _b;
66228
- this.resizing = true;
66229
- const block = resizer.getBlock();
66230
- if (block) {
66231
- if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
66232
- return;
66233
- }
66234
- const blockType = getEmbedType(block);
66235
- const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
66236
- const height = Math.max(rect.height, adjustableMinHeight || 100);
66237
- const oldData = this.editor.getBlockData(block);
66238
- const oldEmbedData = oldData.embedData;
66239
- const newEmbedData = {
66240
- ...oldEmbedData,
66241
- height
66242
- };
66243
- this.editor.updateEmbedData(block, newEmbedData);
66244
- }
66245
- });
66246
- __publicField(this, "handleHoveringBlockChange", (block, old) => {
66247
- if (this.resizing) {
66248
- return;
66249
- }
66250
- if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
66251
- this.disableResizer();
66252
- }
66253
- if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
66254
- this.tryEnableResizer(block);
66255
- }
66256
- });
66257
- __publicField(this, "handleEditorResize", () => {
66258
- this.blockResizer.updateResizer();
66259
- });
66260
- this.editor = editor;
66261
- OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
66262
- this.blockResizer = new BlockResizer(this.editor, {
66263
- resize: ["bottom"]
66264
- });
66265
- this.blockResizer.addListener("resizing", this.handleResizing);
66266
- this.blockResizer.addListener("resized", this.handleResized);
66267
- this.editor.addListener("resize", this.handleEditorResize);
66268
- }
66269
- destroy() {
66270
- this.editor.removeListener("resize", this.handleEditorResize);
66271
- OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
66272
- }
66273
- tryEnableResizer(block) {
66274
- this.blockResizer.enableResize(block);
66275
- }
66276
- disableResizer() {
66277
- this.blockResizer.disableResize();
66278
- }
66279
- static get(editor) {
66280
- return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
66281
- }
66282
- static register(editor, block) {
66283
- addClass(block, "resizable");
66284
- return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
66285
- }
66286
- }
66287
66324
  class ImageHoveringToolbarCommands$1 {
66288
66325
  constructor(editor, block) {
66289
66326
  __publicField(this, "group", "hovering-toolbar");
@@ -66355,7 +66392,7 @@ ${codeText}
66355
66392
  executeCommand(editor, block, item) {
66356
66393
  switch (item.id) {
66357
66394
  case "addComment":
66358
- addCommentToBlock(editor, block);
66395
+ addCommentToBlock$1(editor, block);
66359
66396
  break;
66360
66397
  case "left":
66361
66398
  case "center":
@@ -67735,7 +67772,7 @@ ${codeText}
67735
67772
  this.editor.addListener("selectionChanged", this.handleSelectionChanged);
67736
67773
  this.editor.addListener("resize", this.handleEditorResize);
67737
67774
  this.editor.addListener("docChanged", this.handleDocChanged);
67738
- this.editor.scrollContainer.addEventListener("wheel", this.handleScroll, { passive: false });
67775
+ this.editor.domEvents.addEventListener(this.editor.scrollContainer, "wheel", (ed, e2) => this.handleScroll(e2), { passive: false });
67739
67776
  this.items.forEach((item) => item.addListener("resize", this.handleItemResize));
67740
67777
  this.groupItemHandlers = new CommentGroupItemHandlers(this, commentsProvider);
67741
67778
  document.addEventListener("click", this.handleDocumentClick);
@@ -67744,7 +67781,6 @@ ${codeText}
67744
67781
  this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
67745
67782
  this.editor.removeListener("resize", this.handleEditorResize);
67746
67783
  this.editor.removeListener("docChanged", this.handleDocChanged);
67747
- this.editor.scrollContainer.removeEventListener("wheel", this.handleScroll);
67748
67784
  super.destroy();
67749
67785
  this.unbindEvents();
67750
67786
  this.removeAllListeners();
@@ -68619,7 +68655,7 @@ ${codeText}
68619
68655
  const types2 = ["table", "layout"];
68620
68656
  if (types2.includes(getBlockType(block))) {
68621
68657
  editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
68622
- comment = addCommentToBlock$1(editor, block, this.provider);
68658
+ comment = addCommentToBlock(editor, block, this.provider);
68623
68659
  }
68624
68660
  }
68625
68661
  comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
@@ -68640,7 +68676,7 @@ ${codeText}
68640
68676
  try {
68641
68677
  this.editorComments.showCommentList();
68642
68678
  const block2 = editor.getBlockById(blockId);
68643
- addCommentToBlock$1(editor, block2, this.provider);
68679
+ addCommentToBlock(editor, block2, this.provider);
68644
68680
  } catch (err) {
68645
68681
  logger$13.error(`failed to execute block command: ${JSON.stringify(err)}`);
68646
68682
  }
@@ -68976,11 +69012,11 @@ ${codeText}
68976
69012
  const { containerId } = path[path.length - 1];
68977
69013
  const targetBlock = getParentBlock(getContainerById(editor, containerId));
68978
69014
  if (targetBlock && getBlockType(targetBlock) === "code") {
68979
- addCommentToBlock$1(editor, targetBlock, editorComments.commentProvider);
69015
+ addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
68980
69016
  return;
68981
69017
  }
68982
69018
  }
68983
- addCommentToBlock$1(editor, block, editorComments.commentProvider);
69019
+ addCommentToBlock(editor, block, editorComments.commentProvider);
68984
69020
  return;
68985
69021
  }
68986
69022
  const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
@@ -69217,7 +69253,7 @@ ${codeText}
69217
69253
  editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
69218
69254
  const editorComments = editor2.getCustom("editor-comments");
69219
69255
  editorComments.showCommentList();
69220
- addCommentToBlock$1(editor2, block, editorComments.commentProvider);
69256
+ addCommentToBlock(editor2, block, editorComments.commentProvider);
69221
69257
  }
69222
69258
  }
69223
69259
  };
@@ -69251,7 +69287,7 @@ ${codeText}
69251
69287
  const selectedBlock = range.getSelectedBlocks()[0];
69252
69288
  if (selectedBlock) {
69253
69289
  const editorComments = editor.getCustom("editor-comments");
69254
- addCommentToBlock$1(editor, selectedBlock.block, editorComments.commentProvider);
69290
+ addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
69255
69291
  }
69256
69292
  return;
69257
69293
  }
@@ -76512,7 +76548,7 @@ ${content}
76512
76548
  } else if (item.id === "download") {
76513
76549
  downloadFile$1(editor, box);
76514
76550
  } else if (item.id === "add-comment") {
76515
- addCommentToBlock(editor, block);
76551
+ addCommentToBlock$1(editor, block);
76516
76552
  }
76517
76553
  }
76518
76554
  }
@@ -76804,7 +76840,7 @@ ${content}
76804
76840
  } else if (item.id === "download") {
76805
76841
  downloadFile(editor, block);
76806
76842
  } else if (item.id === "add-comment") {
76807
- addCommentToBlock(editor, block);
76843
+ addCommentToBlock$1(editor, block);
76808
76844
  }
76809
76845
  }
76810
76846
  }
@@ -79562,6 +79598,7 @@ ${content}
79562
79598
  }
79563
79599
  destroy() {
79564
79600
  this.editor.doc.unregisterCallback(this);
79601
+ this.removeAllListeners();
79565
79602
  }
79566
79603
  isHeadingBlock(blockData) {
79567
79604
  return !!blockData.heading;
@@ -80323,22 +80360,22 @@ ${content}
80323
80360
  const image = createElement("img", ["editor-template-thumb"], imageContaniner);
80324
80361
  image.src = imageSrc;
80325
80362
  image.style.display = "none";
80326
- image.onerror = () => {
80363
+ editor.domEvents.addEventListener(image, "error", () => {
80327
80364
  var _a2;
80328
80365
  const placeholder2 = (_a2 = options == null ? void 0 : options.placeHolderImageSrc) != null ? _a2 : TEMPLATE_PLACEHOLDER;
80329
80366
  if (image.src !== placeholder2) {
80330
80367
  image.src = placeholder2;
80331
80368
  }
80332
- };
80333
- image.onload = () => {
80369
+ });
80370
+ editor.domEvents.addEventListener(image, "load", () => {
80334
80371
  image.style.display = "";
80335
- };
80372
+ });
80336
80373
  const nameDiv = createElement("div", ["editor-template-name"], card);
80337
80374
  const span = createElement("span", [], nameDiv, name);
80338
80375
  if (options == null ? void 0 : options.showTemplateTitleAttr) {
80339
80376
  span.setAttribute("title", name);
80340
80377
  }
80341
- card.onclick = () => clickHandler(card);
80378
+ editor.domEvents.addEventListener(card, "click", () => clickHandler(card));
80342
80379
  return card;
80343
80380
  }
80344
80381
  function getDocThumbImage(editor, template) {
@@ -86310,7 +86347,7 @@ ${data2.flowchartText}
86310
86347
  executeCommand(editor, block, item) {
86311
86348
  switch (item.id) {
86312
86349
  case "addComment":
86313
- addCommentToBlock(editor, block);
86350
+ addCommentToBlock$1(editor, block);
86314
86351
  break;
86315
86352
  case "left":
86316
86353
  case "center":
@@ -88080,20 +88117,32 @@ ${data2.flowchartText}
88080
88117
  return docx.Packer.toBlob(doc2);
88081
88118
  }
88082
88119
  }
88120
+ class ExportImageError extends Error {
88121
+ constructor(message) {
88122
+ super(message);
88123
+ this.name = this.constructor.name;
88124
+ }
88125
+ }
88083
88126
  const logger$1 = getLogger("editor-to-docx");
88127
+ const ERROR_MESSAGE = "editor-to-docx: read image error";
88084
88128
  async function readImage(editor, _appId, _docId, _src) {
88085
- const url = editor.doc.buildResourceUrl(_src, { withToken: true });
88086
- let file2 = await downloadImageToFile$1(url);
88087
- if (!file2)
88088
- return [void 0, url];
88089
- if (file2.type.indexOf("/svg") !== -1) {
88090
- const pngFile = await convertImageFileToPng(file2);
88091
- if (pngFile) {
88092
- file2 = new File([pngFile], file2.name);
88129
+ try {
88130
+ const url = editor.doc.buildResourceUrl(_src, { withToken: true });
88131
+ let file2 = await downloadImageToFile$1(url);
88132
+ if (!file2) {
88133
+ throw new Error(ERROR_MESSAGE);
88134
+ }
88135
+ if (file2.type.indexOf("/svg") !== -1) {
88136
+ const pngFile = await convertImageFileToPng(file2);
88137
+ if (pngFile) {
88138
+ file2 = new File([pngFile], file2.name);
88139
+ }
88093
88140
  }
88141
+ const arrayBuffer = await file2.arrayBuffer();
88142
+ return [arrayBuffer, url];
88143
+ } catch (error2) {
88144
+ throw new ExportImageError(error2.message || ERROR_MESSAGE);
88094
88145
  }
88095
- const arrayBuffer = await file2.arrayBuffer();
88096
- return [arrayBuffer, url];
88097
88146
  }
88098
88147
  async function getDocByBlock(editor, doc2, block) {
88099
88148
  const blockClass = editor.editorBlocks.getBlockClass(block.type);
@@ -88327,13 +88376,7 @@ ${data2.flowchartText}
88327
88376
  }
88328
88377
  }
88329
88378
  });
88330
- editor.version = "2.2.8-beta.6";
88331
- if (Logger$2.level === LogLevel.DEBUG) {
88332
- window.setReauthFail = (fail) => {
88333
- window.isReauthError = fail;
88334
- };
88335
- window.reConnect = (token) => editor.doc.externalDoc.client.connection.reConnect(token);
88336
- }
88379
+ editor.version = "2.2.8-beta.8";
88337
88380
  return editor;
88338
88381
  }
88339
88382
  function isDoc(doc2) {
@@ -88428,7 +88471,7 @@ ${data2.flowchartText}
88428
88471
  });
88429
88472
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88430
88473
  OnesEditorToolbar.register(editor);
88431
- editor.version = "2.2.8-beta.6";
88474
+ editor.version = "2.2.8-beta.8";
88432
88475
  return editor;
88433
88476
  }
88434
88477
  async function showDocVersions(editor, options, serverUrl) {
@@ -134207,6 +134250,7 @@ ${data2.flowchartText}
134207
134250
  exports2.EmbedBlockResizer = EmbedBlockResizer;
134208
134251
  exports2.EnforceWithDocumentTitleHandler = EnforceWithDocumentTitleHandler;
134209
134252
  exports2.EventCallbacks = EventCallbacks;
134253
+ exports2.ExportImageError = ExportImageError;
134210
134254
  exports2.FILL_CHAR = FILL_CHAR;
134211
134255
  exports2.FileExtError = FileExtError;
134212
134256
  exports2.FixedToolbar = FixedToolbar;
@@ -134270,6 +134314,7 @@ ${data2.flowchartText}
134270
134314
  exports2.ShareDBLocalDoc = ShareDBLocalDoc;
134271
134315
  exports2.ShareDBServer = ShareDBServer;
134272
134316
  exports2.SimpleCache = SimpleCache;
134317
+ exports2.StandardBoxCommands = StandardBoxCommands;
134273
134318
  exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
134274
134319
  exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
134275
134320
  exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
@@ -134288,7 +134333,7 @@ ${data2.flowchartText}
134288
134333
  exports2.addAttribute = addAttribute;
134289
134334
  exports2.addClass = addClass;
134290
134335
  exports2.addColor = addColor;
134291
- exports2.addCommentToBlock = addCommentToBlock;
134336
+ exports2.addCommentToBlock = addCommentToBlock$1;
134292
134337
  exports2.addDays = addDays;
134293
134338
  exports2.addMetaToDoc = addMetaToDoc;
134294
134339
  exports2.addMonths = addMonths;