@ones-editor/editor 2.2.12 → 2.2.13-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -859,10 +859,10 @@ div.tippy-box[data-theme=menu] .tippy-arrow::after {
859
859
  transform: rotate(45deg);
860
860
  }
861
861
  div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar-root, div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root {
862
- box-shadow: 0px 0px 1px rgba(48, 48, 48, 0.25), 0px 12px 24px rgba(48, 48, 48, 0.15);
862
+ box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(45, 45, 46, 0.15) 0px 8px 16px -4px, rgba(45, 45, 46, 0.2) 0px 0px 1px 0px;
863
863
  }
864
864
  div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root {
865
- overflow: initial;
865
+ border-radius: 3px;
866
866
  }
867
867
  div.tippy-box button {
868
868
  outline: none;
@@ -880,8 +880,7 @@ div.tippy-box button {
880
880
  overflow-y: auto;
881
881
  }
882
882
  .editor-command-bar.toolbar {
883
- max-width: 90vw;
884
- overflow-x: auto;
883
+ width: max-content;
885
884
  }
886
885
  .editor-command-bar.fixed.mobile, .editor-command-bar.toolbar.mobile {
887
886
  gap: 16px;
@@ -902,7 +901,7 @@ div.tippy-box button {
902
901
  }
903
902
  .editor-command-bar.fixed.mobile .command-item.checked, .editor-command-bar.toolbar.mobile .command-item.checked {
904
903
  border-radius: 3px;
905
- background: #F0F6FF;
904
+ background: #f0f6ff;
906
905
  }
907
906
  .editor-command-bar {
908
907
  pointer-events: all;
@@ -1020,8 +1019,6 @@ div.tippy-box button {
1020
1019
  gap: 5px;
1021
1020
  padding: 5px 10px;
1022
1021
  background: #ffffff;
1023
- box-shadow: 0px 0px 1px rgba(48, 48, 48, 0.2), 0px 8px 16px rgba(48, 48, 48, 0.15);
1024
- border-radius: 3px;
1025
1022
  }
1026
1023
  .editor-command-bar.toolbar .command-item {
1027
1024
  background: transparent;
@@ -1114,6 +1111,7 @@ div.tippy-box button {
1114
1111
  .editor-command-bar.footer {
1115
1112
  width: 100%;
1116
1113
  }
1114
+ .reference-hidden[data-tippy-hidden],
1117
1115
  .reference-hidden .tippy-box[data-reference-hidden] {
1118
1116
  opacity: 0;
1119
1117
  pointer-events: none;
@@ -2054,11 +2052,6 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
2054
2052
  border-radius: 8px;
2055
2053
  background: none;
2056
2054
  }
2057
- [data-command-bar-id=cursor-toolbar].mobile .tippy-box .tippy-content .editor-command-bar-root,
2058
- [data-command-bar-id=paste-special-button].mobile .tippy-box .tippy-content .editor-command-bar-root,
2059
- [data-command-bar-id=editor-toolbar].mobile .tippy-box .tippy-content .editor-command-bar-root {
2060
- box-shadow: none;
2061
- }
2062
2055
  [data-command-bar-id=cursor-toolbar].mobile .tippy-content,
2063
2056
  [data-command-bar-id=cursor-toolbar].mobile .editor-command-bar-root,
2064
2057
  [data-command-bar-id=cursor-toolbar].mobile .editor-command-bar,
@@ -2091,6 +2084,61 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
2091
2084
  height: 40px;
2092
2085
  transform: scaleX(0.5);
2093
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;
2094
2142
  }div[data-type=editor-block].block-exclusive:after {
2095
2143
  content: attr(data-exclusive-tips);
2096
2144
  position: absolute;
@@ -2896,61 +2944,6 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] div[data
2896
2944
  }
2897
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 {
2898
2946
  outline: none;
2899
- }div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer {
2900
- position: absolute;
2901
- background-color: transparent;
2902
- border: 1px solid #0064ff;
2903
- pointer-events: none;
2904
- z-index: 1;
2905
- display: none;
2906
- }
2907
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active {
2908
- display: block;
2909
- }
2910
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper {
2911
- position: absolute;
2912
- width: 10px;
2913
- height: 10px;
2914
- background-color: #0064ff;
2915
- border-radius: 50%;
2916
- pointer-events: all;
2917
- outline: 2px solid #fff;
2918
- }
2919
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper::before {
2920
- content: "";
2921
- position: absolute;
2922
- top: -3px;
2923
- left: -3px;
2924
- width: 16px;
2925
- height: 16px;
2926
- }
2927
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom {
2928
- left: calc(50% - 5px);
2929
- bottom: -5px;
2930
- cursor: ns-resize;
2931
- }
2932
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left {
2933
- left: -5px;
2934
- top: -5px;
2935
- cursor: nwse-resize;
2936
- }
2937
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right {
2938
- right: -5px;
2939
- top: -5px;
2940
- cursor: nesw-resize;
2941
- }
2942
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left {
2943
- left: -5px;
2944
- bottom: -5px;
2945
- cursor: nesw-resize;
2946
- }
2947
- div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right {
2948
- right: -5px;
2949
- bottom: -5px;
2950
- cursor: nwse-resize;
2951
- }
2952
- div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-type=block-tools] .block-resizer {
2953
- display: none;
2954
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 {
2955
2948
  content: " ";
2956
2949
  position: absolute;
@@ -25670,7 +25663,8 @@ var __publicField = (obj, key, value) => {
25670
25663
  if (enableHorizontal) {
25671
25664
  animateScrollTo(target, {
25672
25665
  elementToScroll: getScrollContainer$1(target, { horizontal: true }),
25673
- disableHorizontal: false
25666
+ disableHorizontal: false,
25667
+ speed: options.speed
25674
25668
  });
25675
25669
  }
25676
25670
  const mobileClient = editor.options.componentsOptions.mobile;
@@ -25678,7 +25672,8 @@ var __publicField = (obj, key, value) => {
25678
25672
  elementToScroll: (_a = options.elementToScroll) != null ? _a : getScrollContainer$1(target),
25679
25673
  disableHorizontal: true,
25680
25674
  verticalOffset: options == null ? void 0 : options.verticalOffset,
25681
- getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0
25675
+ getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0,
25676
+ speed: options.speed
25682
25677
  });
25683
25678
  } else if (target.scrollIntoView) {
25684
25679
  target.scrollIntoView({
@@ -40071,24 +40066,51 @@ ${codeText}
40071
40066
  click(item, target) {
40072
40067
  this.emit("click", this, item, target);
40073
40068
  }
40074
- createPopperOptions() {
40075
- var _a, _b;
40069
+ createPopperOptions(flip = false) {
40070
+ var _a, _b, _c, _d;
40076
40071
  const popperOptions = { modifiers: [] };
40077
40072
  const overflowBoundary = this.options.overflowBoundary;
40073
+ const padding = this.options.padding;
40078
40074
  if (overflowBoundary) {
40079
- (_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
40080
- name: "flip",
40081
- options: {
40082
- boundary: overflowBoundary,
40083
- fallbackPlacements: ["top", "bottom"]
40084
- }
40085
- });
40075
+ if (flip) {
40076
+ (_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
40077
+ name: "flip",
40078
+ options: {
40079
+ boundary: overflowBoundary,
40080
+ fallbackPlacements: ["top", "bottom"]
40081
+ }
40082
+ });
40083
+ } else {
40084
+ (_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
40085
+ name: "hide",
40086
+ enabled: true,
40087
+ phase: "main",
40088
+ fn: debounce__default.default(({ state }) => {
40089
+ const popper = state.elements.popper;
40090
+ const popperRect = popper.getBoundingClientRect();
40091
+ const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
40092
+ const topCheck = popperRect.top < overflowBoundaryRect.top;
40093
+ const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
40094
+ const leftCheck = popperRect.left < overflowBoundaryRect.left;
40095
+ const rightCheck = popperRect.right > overflowBoundaryRect.right;
40096
+ if (topCheck || bottomCheck || leftCheck || rightCheck) {
40097
+ popper.setAttribute("data-tippy-hidden", "");
40098
+ } else {
40099
+ popper.removeAttribute("data-tippy-hidden");
40100
+ }
40101
+ }, 10)
40102
+ });
40103
+ (_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
40104
+ name: "flip",
40105
+ enabled: false
40106
+ });
40107
+ }
40086
40108
  }
40087
- if (this.options.padding) {
40088
- (_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
40109
+ if (padding) {
40110
+ (_d = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _d.push({
40089
40111
  name: "preventOverflow",
40090
40112
  options: {
40091
- padding: this.options.padding
40113
+ padding
40092
40114
  }
40093
40115
  });
40094
40116
  }
@@ -40455,7 +40477,7 @@ ${codeText}
40455
40477
  });
40456
40478
  }
40457
40479
  manualShow(target, options) {
40458
- var _a, _b, _c;
40480
+ var _a, _b, _c, _d;
40459
40481
  if (this.isVisible) {
40460
40482
  return;
40461
40483
  }
@@ -40470,15 +40492,15 @@ ${codeText}
40470
40492
  triggerTarget: null,
40471
40493
  hideOnClick: false,
40472
40494
  placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
40473
- maxWidth: 650,
40474
- arrow: (_b = options == null ? void 0 : options.arrow) != null ? _b : this.options.tippyArrow,
40495
+ maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
40496
+ arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
40475
40497
  appendTo: document.body,
40476
40498
  onShow: this.handleShow,
40477
40499
  onHidden: this.handleHidden,
40478
40500
  onShown: this.handleShown,
40479
40501
  theme: options == null ? void 0 : options.theme,
40480
40502
  getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
40481
- offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
40503
+ offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
40482
40504
  popperOptions: this.createPopperOptions()
40483
40505
  });
40484
40506
  if (options == null ? void 0 : options.point) {
@@ -40965,6 +40987,7 @@ ${codeText}
40965
40987
  super(items, closeable, {
40966
40988
  itemElementTag: "button",
40967
40989
  tippyArrow: false,
40990
+ maxWidth: clientType.isMobile ? "90vw" : "max-content",
40968
40991
  ...options
40969
40992
  });
40970
40993
  }
@@ -41229,7 +41252,7 @@ ${codeText}
41229
41252
  theme: options == null ? void 0 : options.theme,
41230
41253
  getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
41231
41254
  offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
41232
- popperOptions: this.createPopperOptions()
41255
+ popperOptions: this.createPopperOptions(true)
41233
41256
  });
41234
41257
  this.clearSelectedItem();
41235
41258
  document.addEventListener("keydown", this.handleDocumentKeydown);
@@ -41366,9 +41389,7 @@ ${codeText}
41366
41389
  if (this.options.placeholder) {
41367
41390
  this.showPlaceholder();
41368
41391
  }
41369
- const items = await this.options.queryItems(this, "");
41370
- this.highlightText("", items);
41371
- this.setItems(items);
41392
+ this.handleSearchTextPure("");
41372
41393
  }
41373
41394
  showLoading() {
41374
41395
  if (!this.options.showLoading) {
@@ -46936,7 +46957,413 @@ ${codeText}
46936
46957
  }
46937
46958
  return rects[0];
46938
46959
  }
46939
- const logger$24 = getLogger("exclusive-block");
46960
+ const zhCN$v = {
46961
+ embedProperties: {
46962
+ edit: "\u7F16\u8F91",
46963
+ addComment: "\u6DFB\u52A0\u6279\u6CE8"
46964
+ }
46965
+ };
46966
+ const enUS$v = {
46967
+ embedProperties: {
46968
+ edit: "Edit",
46969
+ addComment: "Add annotation"
46970
+ }
46971
+ };
46972
+ const jaJP$v = {
46973
+ embedProperties: {
46974
+ edit: "\u7DE8\u96C6",
46975
+ addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
46976
+ }
46977
+ };
46978
+ i18n$1.mergeLang({
46979
+ "zh-CN": zhCN$v,
46980
+ "en-US": enUS$v,
46981
+ "ja-JP": jaJP$v
46982
+ });
46983
+ const logger$24 = getLogger("embed-block-properties");
46984
+ function addCommentToBlock$1(editor, block) {
46985
+ var _a;
46986
+ for (const hook of editor.blockHooks) {
46987
+ const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
46988
+ if (!commands) {
46989
+ continue;
46990
+ }
46991
+ if (commands.group === "block-comment-actions") {
46992
+ const command = commands.commands[0];
46993
+ if (!command) {
46994
+ continue;
46995
+ }
46996
+ commands.executeCommand(editor, block, commands.commands[0], null);
46997
+ return true;
46998
+ }
46999
+ }
47000
+ return false;
47001
+ }
47002
+ class StandardEmbedBlockCommands {
47003
+ constructor(editor, block, properties) {
47004
+ __publicField(this, "group", "hovering-toolbar");
47005
+ __publicField(this, "_commands", [{
47006
+ id: "edit",
47007
+ name: i18n$1.t("embedProperties.edit"),
47008
+ icon: EditIcon
47009
+ }, {
47010
+ id: "separator",
47011
+ name: "",
47012
+ type: "separator"
47013
+ }]);
47014
+ this.editor = editor;
47015
+ this.block = block;
47016
+ this.properties = properties;
47017
+ }
47018
+ get commands() {
47019
+ var _a, _b, _c, _d;
47020
+ if (clientType.isMobile) {
47021
+ return [];
47022
+ }
47023
+ let standardCommands = [];
47024
+ if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
47025
+ this.properties.presetIds.forEach((id) => {
47026
+ const command = this._commands.find((item) => item.id === id);
47027
+ if (command) {
47028
+ standardCommands.push(command);
47029
+ }
47030
+ });
47031
+ }
47032
+ if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
47033
+ standardCommands.push(...this.properties.extCommands);
47034
+ }
47035
+ if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
47036
+ standardCommands.push(...this.properties.extCommands(this.editor, this.block));
47037
+ }
47038
+ if ((_d = this.properties) == null ? void 0 : _d.extIds) {
47039
+ this.properties.extIds.forEach((id) => {
47040
+ const command = this._commands.find((item) => item.id === id);
47041
+ if (command) {
47042
+ standardCommands.push(command);
47043
+ }
47044
+ });
47045
+ }
47046
+ const { enableComments = true } = this.editor.options;
47047
+ if (!enableComments || this.editor.readonly) {
47048
+ standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
47049
+ }
47050
+ if (this.editor.readonly) {
47051
+ standardCommands = standardCommands.filter((command) => command.id !== "edit");
47052
+ }
47053
+ standardCommands.forEach((item) => {
47054
+ if (item.id === "add-comment" || item.id === "edit") {
47055
+ item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
47056
+ }
47057
+ });
47058
+ return standardCommands;
47059
+ }
47060
+ executeCommand(editor, block, item) {
47061
+ var _a, _b;
47062
+ if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
47063
+ return;
47064
+ }
47065
+ if (item.id === "add-comment") {
47066
+ if (!addCommentToBlock$1(editor, block)) {
47067
+ logger$24.error("failed to add comment to block");
47068
+ }
47069
+ return;
47070
+ }
47071
+ logger$24.error(`unknown command: ${JSON.stringify(item)}`);
47072
+ }
47073
+ }
47074
+ function getStandardEmbedBlockProperties(editor, block, properties) {
47075
+ return {
47076
+ blockCommands: {
47077
+ "hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
47078
+ }
47079
+ };
47080
+ }
47081
+ function createResizeGripper(parent, type) {
47082
+ const elem = createElement("div", ["resize-gripper", type], parent);
47083
+ elem.setAttribute("data-resize-type", type);
47084
+ }
47085
+ function getExistsResizer(block) {
47086
+ const tools = getBlockTools(block);
47087
+ return tools.querySelector(".block-resizer");
47088
+ }
47089
+ function hideResizer(block) {
47090
+ const exists = getExistsResizer(block);
47091
+ if (exists) {
47092
+ removeClass(exists, "active");
47093
+ }
47094
+ }
47095
+ function updateSize(block, element, resizer) {
47096
+ const blockRect = block.getBoundingClientRect();
47097
+ const elementRect = element.getBoundingClientRect();
47098
+ const top = elementRect.top - blockRect.top;
47099
+ const left = elementRect.left - blockRect.left;
47100
+ const width = elementRect.width;
47101
+ const height = elementRect.height;
47102
+ resizer.style.top = `${top}px`;
47103
+ resizer.style.left = `${left}px`;
47104
+ resizer.style.width = `${width}px`;
47105
+ resizer.style.height = `${height}px`;
47106
+ }
47107
+ function createResizer(block, element, options, mouseDownEvent) {
47108
+ const exists = getExistsResizer(block);
47109
+ if (exists) {
47110
+ addClass(exists, "active");
47111
+ updateSize(block, element, exists);
47112
+ return exists;
47113
+ }
47114
+ const tools = getBlockTools(block);
47115
+ const resizer = createElement("div", ["block-resizer"], tools);
47116
+ updateSize(block, element, resizer);
47117
+ options.resize.forEach((type) => {
47118
+ createResizeGripper(resizer, type);
47119
+ });
47120
+ resizer.addEventListener("mousedown", mouseDownEvent);
47121
+ addClass(resizer, "active");
47122
+ return resizer;
47123
+ }
47124
+ function updateResizer(block, element) {
47125
+ const resizer = getExistsResizer(block);
47126
+ if (!resizer) {
47127
+ return;
47128
+ }
47129
+ if (!isChildNode(block, element)) {
47130
+ return;
47131
+ }
47132
+ const blockRect = block.getBoundingClientRect();
47133
+ const elementRect = element.getBoundingClientRect();
47134
+ const top = elementRect.top - blockRect.top;
47135
+ const left = elementRect.left - blockRect.left;
47136
+ const width = elementRect.width;
47137
+ const height = elementRect.height;
47138
+ resizer.style.top = `${top}px`;
47139
+ resizer.style.left = `${left}px`;
47140
+ resizer.style.width = `${width}px`;
47141
+ resizer.style.height = `${height}px`;
47142
+ }
47143
+ const style$a = "";
47144
+ const logger$23 = getLogger("block-resizer");
47145
+ class BlockResizer extends tinyTypedEmitter.TypedEmitter {
47146
+ constructor(editor, options) {
47147
+ super();
47148
+ __publicField(this, "resizableElement");
47149
+ __publicField(this, "block", null);
47150
+ __publicField(this, "startRect", null);
47151
+ __publicField(this, "startPos", null);
47152
+ __publicField(this, "resizeType", null);
47153
+ __publicField(this, "enabled", false);
47154
+ __publicField(this, "handleEditorResize", () => {
47155
+ if (this.block) {
47156
+ this.updateResizer();
47157
+ }
47158
+ });
47159
+ __publicField(this, "handleMouseDown", (event) => {
47160
+ event.preventDefault();
47161
+ event.stopPropagation();
47162
+ const element = this.getResizableElement();
47163
+ if (!element) {
47164
+ return;
47165
+ }
47166
+ if (event.button !== 0) {
47167
+ return;
47168
+ }
47169
+ const gripper = event.target;
47170
+ if (!gripper) {
47171
+ return;
47172
+ }
47173
+ if (!(gripper instanceof HTMLElement)) {
47174
+ return;
47175
+ }
47176
+ const resizeType = gripper.getAttribute("data-resize-type");
47177
+ if (!resizeType) {
47178
+ return;
47179
+ }
47180
+ this.bindEvents();
47181
+ this.startRect = element.getBoundingClientRect();
47182
+ this.startPos = event;
47183
+ this.resizeType = resizeType;
47184
+ setDefaultCursor(window.getComputedStyle(gripper).cursor);
47185
+ if (this.block) {
47186
+ this.editor.selection.selectBlock(this.block, 0);
47187
+ }
47188
+ });
47189
+ __publicField(this, "handleMouseMove", (event) => {
47190
+ if (!this.startPos || !this.startRect || !this.resizeType) {
47191
+ return;
47192
+ }
47193
+ const element = this.getResizableElement();
47194
+ if (!element || !this.block) {
47195
+ return;
47196
+ }
47197
+ const deltaX = event.x - this.startPos.x;
47198
+ const deltaY = event.y - this.startPos.y;
47199
+ const oldRect = this.startRect;
47200
+ let { top, left, right, bottom } = oldRect;
47201
+ if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
47202
+ bottom += deltaY;
47203
+ }
47204
+ if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
47205
+ top += deltaY;
47206
+ }
47207
+ if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
47208
+ left += deltaX;
47209
+ }
47210
+ if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
47211
+ right += deltaX;
47212
+ }
47213
+ const width = right > left ? right - left : 0;
47214
+ const height = bottom > top ? bottom - top : 0;
47215
+ const newRect = new DOMRect(left, top, width, height);
47216
+ this.emit("resizing", this, newRect);
47217
+ const newElement = this.getResizableElement();
47218
+ if (newElement) {
47219
+ updateResizer(this.block, newElement);
47220
+ }
47221
+ });
47222
+ __publicField(this, "handleMouseUp", (event) => {
47223
+ if (event.button !== 0) {
47224
+ return;
47225
+ }
47226
+ setDefaultCursor("");
47227
+ this.unbindEvents();
47228
+ this.emit("resized", this);
47229
+ const element = this.getResizableElement();
47230
+ if (!element || !this.block) {
47231
+ return;
47232
+ }
47233
+ updateResizer(this.block, element);
47234
+ });
47235
+ this.editor = editor;
47236
+ this.options = options;
47237
+ this.editor.addListener("resize", this.handleEditorResize);
47238
+ }
47239
+ enableResize(block, resizableElement) {
47240
+ this.block = block;
47241
+ this.resizableElement = resizableElement;
47242
+ this.createResizer();
47243
+ this.enabled = true;
47244
+ }
47245
+ disableResize() {
47246
+ if (!this.block) {
47247
+ return;
47248
+ }
47249
+ hideResizer(this.block);
47250
+ this.enabled = false;
47251
+ }
47252
+ update(block, resizableElement) {
47253
+ this.block = block;
47254
+ this.resizableElement = resizableElement;
47255
+ const elem = this.getResizableElement();
47256
+ if (elem && this.enabled) {
47257
+ this.createResizer();
47258
+ }
47259
+ }
47260
+ updateResizer() {
47261
+ const newElement = this.getResizableElement();
47262
+ if (newElement && this.block) {
47263
+ updateResizer(this.block, newElement);
47264
+ }
47265
+ }
47266
+ getBlock() {
47267
+ return this.block;
47268
+ }
47269
+ destroy() {
47270
+ this.editor.removeListener("resize", this.handleEditorResize);
47271
+ }
47272
+ getResizableElement() {
47273
+ if (this.resizableElement) {
47274
+ return this.resizableElement;
47275
+ }
47276
+ if (!this.block) {
47277
+ return null;
47278
+ }
47279
+ return getBlockContent(this.block);
47280
+ }
47281
+ createResizer() {
47282
+ const element = this.getResizableElement();
47283
+ if (!element || !this.block) {
47284
+ return;
47285
+ }
47286
+ assert(logger$23, isChildNode(this.block, element), "not a block child element");
47287
+ createResizer(this.block, element, this.options, this.handleMouseDown);
47288
+ }
47289
+ bindEvents() {
47290
+ document.addEventListener("mousemove", this.handleMouseMove);
47291
+ document.addEventListener("mouseup", this.handleMouseUp);
47292
+ }
47293
+ unbindEvents() {
47294
+ document.removeEventListener("mousemove", this.handleMouseMove);
47295
+ document.removeEventListener("mouseup", this.handleMouseUp);
47296
+ }
47297
+ }
47298
+ class EmbedBlockResizer {
47299
+ constructor(editor) {
47300
+ __publicField(this, "resizing", false);
47301
+ __publicField(this, "blockResizer");
47302
+ __publicField(this, "handleResized", () => {
47303
+ this.resizing = false;
47304
+ });
47305
+ __publicField(this, "handleResizing", (resizer, rect) => {
47306
+ var _a, _b;
47307
+ this.resizing = true;
47308
+ const block = resizer.getBlock();
47309
+ if (block) {
47310
+ if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
47311
+ return;
47312
+ }
47313
+ const blockType = getEmbedType(block);
47314
+ const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
47315
+ const height = Math.max(rect.height, adjustableMinHeight || 100);
47316
+ const oldData = this.editor.getBlockData(block);
47317
+ const oldEmbedData = oldData.embedData;
47318
+ const newEmbedData = {
47319
+ ...oldEmbedData,
47320
+ height
47321
+ };
47322
+ this.editor.updateEmbedData(block, newEmbedData);
47323
+ }
47324
+ });
47325
+ __publicField(this, "handleHoveringBlockChange", (block, old) => {
47326
+ if (this.resizing) {
47327
+ return;
47328
+ }
47329
+ if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
47330
+ this.disableResizer();
47331
+ }
47332
+ if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
47333
+ this.tryEnableResizer(block);
47334
+ }
47335
+ });
47336
+ __publicField(this, "handleEditorResize", () => {
47337
+ this.blockResizer.updateResizer();
47338
+ });
47339
+ this.editor = editor;
47340
+ OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
47341
+ this.blockResizer = new BlockResizer(this.editor, {
47342
+ resize: ["bottom"]
47343
+ });
47344
+ this.blockResizer.addListener("resizing", this.handleResizing);
47345
+ this.blockResizer.addListener("resized", this.handleResized);
47346
+ this.editor.addListener("resize", this.handleEditorResize);
47347
+ }
47348
+ destroy() {
47349
+ this.editor.removeListener("resize", this.handleEditorResize);
47350
+ OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
47351
+ }
47352
+ tryEnableResizer(block) {
47353
+ this.blockResizer.enableResize(block);
47354
+ }
47355
+ disableResizer() {
47356
+ this.blockResizer.disableResize();
47357
+ }
47358
+ static get(editor) {
47359
+ return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
47360
+ }
47361
+ static register(editor, block) {
47362
+ addClass(block, "resizable");
47363
+ return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
47364
+ }
47365
+ }
47366
+ const logger$22 = getLogger("exclusive-block");
46940
47367
  function addExclusiveStyle(editor, block, userId, displayName) {
46941
47368
  var _a;
46942
47369
  addClass(block, "block-exclusive");
@@ -46954,7 +47381,7 @@ ${codeText}
46954
47381
  block.removeAttribute("data-exclusive-tips");
46955
47382
  }
46956
47383
  function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
46957
- logger$24.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
47384
+ logger$22.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
46958
47385
  if (exclusive) {
46959
47386
  addExclusiveStyle(editor, block, userId, displayName);
46960
47387
  } else {
@@ -47111,28 +47538,28 @@ ${codeText}
47111
47538
  }
47112
47539
  }
47113
47540
  const exclusiveBlockStyles = "";
47114
- const zhCN$v = {
47541
+ const zhCN$u = {
47115
47542
  exclusive: {
47116
47543
  tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
47117
47544
  fallbackAbstract: "\u8BE5 Block"
47118
47545
  }
47119
47546
  };
47120
- const enUS$v = {
47547
+ const enUS$u = {
47121
47548
  exclusive: {
47122
47549
  tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
47123
47550
  fallbackAbstract: "This Block"
47124
47551
  }
47125
47552
  };
47126
- const jaJP$v = {
47553
+ const jaJP$u = {
47127
47554
  exclusive: {
47128
47555
  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",
47129
47556
  fallbackAbstract: "\u3053\u306E\u8981\u7D20"
47130
47557
  }
47131
47558
  };
47132
47559
  i18n$1.mergeLang({
47133
- "zh-CN": zhCN$v,
47134
- "en-US": enUS$v,
47135
- "ja-JP": jaJP$v
47560
+ "zh-CN": zhCN$u,
47561
+ "en-US": enUS$u,
47562
+ "ja-JP": jaJP$u
47136
47563
  });
47137
47564
  function getBlockInfo(editor, block) {
47138
47565
  const data2 = editor.getBlockData(block);
@@ -47308,22 +47735,22 @@ ${codeText}
47308
47735
  };
47309
47736
  }
47310
47737
  }
47311
- const style$a = "";
47312
- const zhCN$u = {
47738
+ const style$9 = "";
47739
+ const zhCN$t = {
47313
47740
  locker: {
47314
47741
  lock: "\u9501\u5B9A",
47315
47742
  unlock: "\u89E3\u9664\u9501\u5B9A",
47316
47743
  lockedBy: "\u88AB {name} \u9501\u5B9A"
47317
47744
  }
47318
47745
  };
47319
- const enUS$u = {
47746
+ const enUS$t = {
47320
47747
  locker: {
47321
47748
  lock: "Lock",
47322
47749
  unlock: "Unlock",
47323
47750
  lockedBy: "Locked by {name}"
47324
47751
  }
47325
47752
  };
47326
- const jaJP$u = {
47753
+ const jaJP$t = {
47327
47754
  locker: {
47328
47755
  lock: "\u30ED\u30C3\u30AF",
47329
47756
  unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
@@ -47331,9 +47758,9 @@ ${codeText}
47331
47758
  }
47332
47759
  };
47333
47760
  i18n$1.mergeLang({
47334
- "zh-CN": zhCN$u,
47335
- "en-US": enUS$u,
47336
- "ja-JP": jaJP$u
47761
+ "zh-CN": zhCN$t,
47762
+ "en-US": enUS$t,
47763
+ "ja-JP": jaJP$t
47337
47764
  });
47338
47765
  class BlockLockerPasteHandler {
47339
47766
  async handleBeforePasteDoc(editor, doc2) {
@@ -47345,7 +47772,7 @@ ${codeText}
47345
47772
  return false;
47346
47773
  }
47347
47774
  }
47348
- const logger$23 = getLogger("context-menu-utils");
47775
+ const logger$21 = getLogger("context-menu-utils");
47349
47776
  function blobToString(blob) {
47350
47777
  return new Promise((resolve, reject) => {
47351
47778
  const reader = new FileReader();
@@ -47366,7 +47793,7 @@ ${codeText}
47366
47793
  const types2 = items[0].types;
47367
47794
  return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
47368
47795
  } catch (error2) {
47369
- logger$23.warn(`Failed to read clipboard data: ${error2}`);
47796
+ logger$21.warn(`Failed to read clipboard data: ${error2}`);
47370
47797
  return true;
47371
47798
  }
47372
47799
  }
@@ -47415,7 +47842,7 @@ ${codeText}
47415
47842
  }
47416
47843
  return dataTransfer;
47417
47844
  }
47418
- const logger$22 = getLogger("ClipboardProvider");
47845
+ const logger$20 = getLogger("ClipboardProvider");
47419
47846
  class ClipboardProvider {
47420
47847
  constructor(editor, options) {
47421
47848
  __publicField(this, "id", "ClipboardProvider");
@@ -47501,7 +47928,7 @@ ${codeText}
47501
47928
  }
47502
47929
  }).catch((err) => {
47503
47930
  this.clipboardPermission.read = "denied";
47504
- logger$22.log(err);
47931
+ logger$20.log(err);
47505
47932
  });
47506
47933
  } catch (error2) {
47507
47934
  this.clipboardPermission = {
@@ -47562,13 +47989,14 @@ ${codeText}
47562
47989
  }
47563
47990
  }
47564
47991
  class StandardBoxCommands {
47565
- constructor(editor) {
47992
+ constructor(editor, extIds) {
47566
47993
  __publicField(this, "group", "standard-box-commands");
47567
47994
  __publicField(this, "providers", []);
47568
47995
  this.editor = editor;
47569
- if (clientType.isMobile) {
47570
- this.providers.push(new ClipboardProvider(this.editor, { withPaste: false }));
47571
- }
47996
+ this.extIds = extIds;
47997
+ }
47998
+ addProvider(provider) {
47999
+ this.providers.push(provider);
47572
48000
  }
47573
48001
  get commands() {
47574
48002
  if (this.editor.readonly) {
@@ -47576,8 +48004,17 @@ ${codeText}
47576
48004
  }
47577
48005
  const items = [];
47578
48006
  const focusedBlock = this.editor.selection.focusedBlock;
48007
+ const hoveringTextChild = OnesEditorHoveringBlock.get(this.editor).hoveringTextChild;
47579
48008
  for (const provider of this.providers) {
47580
- items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
48009
+ items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range, { child: hoveringTextChild }));
48010
+ }
48011
+ for (const extId of this.extIds || []) {
48012
+ if (extId === "separator") {
48013
+ items.push({ id: "sep", name: "", type: "separator" });
48014
+ }
48015
+ if (extId === "add-comment") {
48016
+ items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
48017
+ }
47581
48018
  }
47582
48019
  return items;
47583
48020
  }
@@ -47586,19 +48023,27 @@ ${codeText}
47586
48023
  const { start, end } = getChildOffset(block, box);
47587
48024
  const range = createBlockSimpleRange(editor, block, start, end);
47588
48025
  for (const provider of this.providers) {
47589
- if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
48026
+ if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, { child: box })) {
47590
48027
  return;
47591
48028
  }
47592
- if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
48029
+ if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, { child: box })) {
47593
48030
  return;
47594
48031
  }
47595
48032
  }
48033
+ if (item.id === "add-comment") {
48034
+ addCommentToBlock$1(editor, block);
48035
+ }
48036
+ }
48037
+ static create(editor, extIds) {
48038
+ return new StandardBoxCommands(editor, extIds);
47596
48039
  }
47597
- static create(editor) {
47598
- return new StandardBoxCommands(editor);
48040
+ static mobileCreate(editor, extIds) {
48041
+ const instance = new StandardBoxCommands(editor, extIds);
48042
+ instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
48043
+ return instance;
47599
48044
  }
47600
48045
  }
47601
- const logger$21 = getLogger("object-commands");
48046
+ const logger$1$ = getLogger("object-commands");
47602
48047
  const SEP$1 = {
47603
48048
  id: "",
47604
48049
  name: "",
@@ -47654,7 +48099,7 @@ ${codeText}
47654
48099
  let element = null;
47655
48100
  const commands = [];
47656
48101
  if (clientType.isMobile && child && isBox(child)) {
47657
- boxCommands.push(new StandardBoxCommands(editor));
48102
+ boxCommands.push(StandardBoxCommands.mobileCreate(editor));
47658
48103
  }
47659
48104
  if (boxCommands.length > 0) {
47660
48105
  element = child;
@@ -47666,7 +48111,7 @@ ${codeText}
47666
48111
  if (blockCommands.length > 0) {
47667
48112
  for (let i = 0; i < blockCommands.length; i++) {
47668
48113
  const blockCommand = blockCommands[i];
47669
- element = element || targetElement || null;
48114
+ element = blockCommand.element || element || targetElement || null;
47670
48115
  commands.push(...blockCommand.commands);
47671
48116
  }
47672
48117
  }
@@ -47684,10 +48129,10 @@ ${codeText}
47684
48129
  const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
47685
48130
  const { boxCommands, blockCommands } = result;
47686
48131
  if (clientType.isMobile && child && isBox(child)) {
47687
- boxCommands.push(new StandardBoxCommands(editor));
48132
+ boxCommands.push(StandardBoxCommands.mobileCreate(editor));
47688
48133
  }
47689
48134
  if (boxCommands.length > 0) {
47690
- assert(logger$21, child, "child is null");
48135
+ assert(logger$1$, child, "child is null");
47691
48136
  for (let i = 0; i < boxCommands.length; i++) {
47692
48137
  if (boxCommands[i].commands.find((c) => c.id === item.id)) {
47693
48138
  boxCommands[i].executeCommand(editor, block, child, item);
@@ -47954,18 +48399,18 @@ ${codeText}
47954
48399
  }
47955
48400
  }
47956
48401
  const LIST_MAX_LEVEL = 8;
47957
- const logger$20 = getLogger("list-block");
47958
- const logger$1$ = getLogger("list-block");
48402
+ const logger$1_ = getLogger("list-block");
48403
+ const logger$1Z = getLogger("list-block");
47959
48404
  function isListBlock(block) {
47960
48405
  return getBlockType(block) === "list";
47961
48406
  }
47962
48407
  function ensureIsListBlock(block) {
47963
- assert(logger$1$, isListBlock(block), "not a list block");
48408
+ assert(logger$1Z, isListBlock(block), "not a list block");
47964
48409
  }
47965
48410
  function getListBlockType(block) {
47966
48411
  ensureIsListBlock(block);
47967
48412
  const type = block.getAttribute("data-list-type");
47968
- assert(logger$1$, type, "no list type");
48413
+ assert(logger$1Z, type, "no list type");
47969
48414
  return type;
47970
48415
  }
47971
48416
  function isTextOnlyListBlock(block) {
@@ -47984,7 +48429,7 @@ ${codeText}
47984
48429
  function getListBlockGroupId(block) {
47985
48430
  ensureIsListBlock(block);
47986
48431
  const groupId = block.getAttribute("data-list-group-id");
47987
- assert(logger$1$, groupId, "no group id");
48432
+ assert(logger$1Z, groupId, "no group id");
47988
48433
  return groupId;
47989
48434
  }
47990
48435
  function getListBlockProperties(block) {
@@ -47994,7 +48439,7 @@ ${codeText}
47994
48439
  const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
47995
48440
  const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
47996
48441
  const groupId = block.getAttribute("data-list-group-id");
47997
- assert(logger$1$, groupId, "no group id");
48442
+ assert(logger$1Z, groupId, "no group id");
47998
48443
  return {
47999
48444
  type,
48000
48445
  start,
@@ -48263,7 +48708,7 @@ ${codeText}
48263
48708
  this.nodeMap.set(block, node);
48264
48709
  if (parentBlock) {
48265
48710
  const parentNode = this.nodeMap.get(parentBlock);
48266
- assert(logger$20, parentNode, "no parent node");
48711
+ assert(logger$1_, parentNode, "no parent node");
48267
48712
  parentNode.children.push(node);
48268
48713
  } else {
48269
48714
  this.rootNodes.push(node);
@@ -48331,7 +48776,7 @@ ${codeText}
48331
48776
  return hasClass(block, "editor-in-mindmap-first");
48332
48777
  }
48333
48778
  function isViewingAsMindmap(block) {
48334
- assert(logger$20, isListBlock(block), "not a list block");
48779
+ assert(logger$1_, isListBlock(block), "not a list block");
48335
48780
  if (hasClass(block, "editor-in-mindmap-first")) {
48336
48781
  return true;
48337
48782
  }
@@ -48352,12 +48797,12 @@ ${codeText}
48352
48797
  const container = getParentContainer(from);
48353
48798
  if (to) {
48354
48799
  const container2 = getParentContainer(to);
48355
- assert(logger$20, container === container2, "invalid block container");
48800
+ assert(logger$1_, container === container2, "invalid block container");
48356
48801
  }
48357
48802
  const fromIndex = getBlockIndex(from);
48358
48803
  if (to) {
48359
48804
  const toIndex = getBlockIndex(to);
48360
- assert(logger$20, fromIndex <= toIndex, "invalid block index");
48805
+ assert(logger$1_, fromIndex <= toIndex, "invalid block index");
48361
48806
  }
48362
48807
  addClass(from, ...styles);
48363
48808
  if (!to || to === from) {
@@ -48365,7 +48810,7 @@ ${codeText}
48365
48810
  }
48366
48811
  let next2 = getNextBlock(from);
48367
48812
  while (next2 !== to) {
48368
- assert(logger$20, next2, "no next button");
48813
+ assert(logger$1_, next2, "no next button");
48369
48814
  addClass(next2, ...styles);
48370
48815
  next2 = getNextBlock(next2);
48371
48816
  }
@@ -48376,7 +48821,7 @@ ${codeText}
48376
48821
  async function requestMindmapFullscreen(editor, block, mindmapTools) {
48377
48822
  const tools = getBlockTools(block);
48378
48823
  const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
48379
- assert(logger$20, exitFullscreenButton, "no full screen button");
48824
+ assert(logger$1_, exitFullscreenButton, "no full screen button");
48380
48825
  const resetMindmap = () => {
48381
48826
  setTimeout(() => {
48382
48827
  mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
@@ -48396,7 +48841,7 @@ ${codeText}
48396
48841
  try {
48397
48842
  await exitFullscreen();
48398
48843
  } catch (err) {
48399
- logger$20.error(err);
48844
+ logger$1_.error(err);
48400
48845
  }
48401
48846
  onExitFullscreen();
48402
48847
  } else {
@@ -48405,7 +48850,7 @@ ${codeText}
48405
48850
  await requestFullscreen(tools);
48406
48851
  resetMindmap();
48407
48852
  } catch (err) {
48408
- logger$20.error(err);
48853
+ logger$1_.error(err);
48409
48854
  }
48410
48855
  exitFullscreenButton.innerHTML = ExitFullScreenIcon;
48411
48856
  exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
@@ -48686,7 +49131,7 @@ ${codeText}
48686
49131
  if (!svg) {
48687
49132
  return;
48688
49133
  }
48689
- assert(logger$20, svg, "no mindmap svg");
49134
+ assert(logger$1_, svg, "no mindmap svg");
48690
49135
  svg.remove();
48691
49136
  editor.domEvents.removeAllListeners(svg);
48692
49137
  destroyMindmapButtons(editor, block);
@@ -48738,7 +49183,7 @@ ${codeText}
48738
49183
  });
48739
49184
  __publicField(this, "handleMouseEnter", () => {
48740
49185
  const block = getParentBlock(this.toMindmapButton);
48741
- assert(logger$20, block && isListBlock(block), "no parent list");
49186
+ assert(logger$1_, block && isListBlock(block), "no parent list");
48742
49187
  highlightEntireList(this.editor, block, true);
48743
49188
  this.currentBlock = block;
48744
49189
  });
@@ -48750,7 +49195,7 @@ ${codeText}
48750
49195
  });
48751
49196
  __publicField(this, "handleClick", () => {
48752
49197
  const block = getParentBlock(this.toMindmapButton);
48753
- assert(logger$20, block && isListBlock(block), "no parent list");
49198
+ assert(logger$1_, block && isListBlock(block), "no parent list");
48754
49199
  toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
48755
49200
  });
48756
49201
  this.editor = editor;
@@ -48878,11 +49323,11 @@ ${codeText}
48878
49323
  }
48879
49324
  }
48880
49325
  function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
48881
- logger$20.debug("drag a block on a list block");
49326
+ logger$1_.debug("drag a block on a list block");
48882
49327
  if (!isTextKindBlock(editor, draggedBlock)) {
48883
49328
  return false;
48884
49329
  }
48885
- assert(logger$20, isListBlock(targetListBlock), "target is not a list block");
49330
+ assert(logger$1_, isListBlock(targetListBlock), "target is not a list block");
48886
49331
  const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
48887
49332
  const newStart = insertPos === "after" ? start + 1 : start;
48888
49333
  const oldData = editor.getBlockData(draggedBlock);
@@ -48915,7 +49360,7 @@ ${codeText}
48915
49360
  return true;
48916
49361
  }
48917
49362
  function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
48918
- logger$20.debug("drag a list between text blocks");
49363
+ logger$1_.debug("drag a list between text blocks");
48919
49364
  if (insertPos === "after") {
48920
49365
  const nextBlock = getNextBlock(targetBlock);
48921
49366
  if (nextBlock && isListBlock(nextBlock)) {
@@ -48952,11 +49397,11 @@ ${codeText}
48952
49397
  }
48953
49398
  const { blockId } = dragData;
48954
49399
  const draggedBlock = editor.getBlockById(blockId);
48955
- assert(logger$20, draggedBlock, "no dragged block");
49400
+ assert(logger$1_, draggedBlock, "no dragged block");
48956
49401
  const { isSourceBlock, targetBlock } = options;
48957
49402
  if (!isSourceBlock && targetBlock) {
48958
- assert(logger$20, block === targetBlock, "block !== target block");
48959
- assert(logger$20, isListBlock(targetBlock), "target is not a list block");
49403
+ assert(logger$1_, block === targetBlock, "block !== target block");
49404
+ assert(logger$1_, isListBlock(targetBlock), "target is not a list block");
48960
49405
  return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
48961
49406
  }
48962
49407
  return handleDragList(editor, draggedBlock, targetBlock, insertPos);
@@ -49458,7 +49903,7 @@ ${codeText}
49458
49903
  }
49459
49904
  const nextBrother = getListNextBrother(block);
49460
49905
  while (nextBlock !== nextBrother) {
49461
- assert(logger$20, nextBlock, "no next block");
49906
+ assert(logger$1_, nextBlock, "no next block");
49462
49907
  if (isListBlock(nextBlock)) {
49463
49908
  if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
49464
49909
  return nextBlock;
@@ -49557,9 +50002,9 @@ ${codeText}
49557
50002
  }
49558
50003
  return true;
49559
50004
  }
49560
- const logger$1_ = getLogger("list-block");
50005
+ const logger$1Y = getLogger("list-block");
49561
50006
  function cloneListData(editor, block, options) {
49562
- assert(logger$1_, isListBlock(block), "not a list block");
50007
+ assert(logger$1Y, isListBlock(block), "not a list block");
49563
50008
  const blockData = {
49564
50009
  ...editor.getBlockData(block),
49565
50010
  id: genId()
@@ -49634,7 +50079,7 @@ ${codeText}
49634
50079
  return true;
49635
50080
  }
49636
50081
  function findPrevBrotherAsParent(block) {
49637
- assert(logger$20, isListBlock(block), "not a list block");
50082
+ assert(logger$1_, isListBlock(block), "not a list block");
49638
50083
  const { level } = getListBlockProperties(block);
49639
50084
  let prevBlock = getPrevBlock(block);
49640
50085
  while (prevBlock) {
@@ -49661,7 +50106,7 @@ ${codeText}
49661
50106
  }
49662
50107
  function findPrevBrother(editor, fromBlock, toParentBlock) {
49663
50108
  let prevBlock = getPrevBlock(fromBlock);
49664
- assert(logger$20, prevBlock, "no prev brother");
50109
+ assert(logger$1_, prevBlock, "no prev brother");
49665
50110
  const parentLevel = getListBlockLevel(toParentBlock);
49666
50111
  while (prevBlock) {
49667
50112
  if (prevBlock === toParentBlock) {
@@ -49682,7 +50127,7 @@ ${codeText}
49682
50127
  }
49683
50128
  ensureIsListBlock(block);
49684
50129
  const prevBrother = findPrevBrotherAsParent(block);
49685
- assert(logger$20, prevBrother, "no list prev brother");
50130
+ assert(logger$1_, prevBrother, "no list prev brother");
49686
50131
  const newParent = prevBrother;
49687
50132
  const newBrother = findPrevBrother(editor, block, newParent);
49688
50133
  const level = getListBlockLevel(newParent) + 1;
@@ -49881,14 +50326,14 @@ ${codeText}
49881
50326
  this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
49882
50327
  }
49883
50328
  }
49884
- const logger$1Z = getLogger("customize-list-start-menu");
50329
+ const logger$1X = getLogger("customize-list-start-menu");
49885
50330
  class CustomizeListStartDialog {
49886
50331
  constructor(editor) {
49887
50332
  __publicField(this, "popup");
49888
50333
  __publicField(this, "block", null);
49889
50334
  __publicField(this, "show", (editor, block) => {
49890
50335
  const listBlockMarker = block.querySelector("div.list-container");
49891
- assert(logger$1Z, listBlockMarker, "list-block mark does not exist");
50336
+ assert(logger$1X, listBlockMarker, "list-block mark does not exist");
49892
50337
  this.block = block;
49893
50338
  this.popup.manualShow(listBlockMarker, {
49894
50339
  theme: "light"
@@ -50046,7 +50491,7 @@ ${codeText}
50046
50491
  const listContainer = findTarget(event, "div.list-container");
50047
50492
  if (listContainer && this.editor.isWritable()) {
50048
50493
  const block = getParentBlock(listContainer);
50049
- assert(logger$20, block, "no parent block");
50494
+ assert(logger$1_, block, "no parent block");
50050
50495
  ensureIsListBlock(block);
50051
50496
  const blockData = editor.getBlockData(block);
50052
50497
  if (blockData && blockData.checkbox) {
@@ -50186,7 +50631,7 @@ ${codeText}
50186
50631
  }
50187
50632
  return blockContent;
50188
50633
  }
50189
- const zhCN$t = {
50634
+ const zhCN$s = {
50190
50635
  list: {
50191
50636
  confirm: "\u786E\u5B9A",
50192
50637
  setStart: "\u8BBE\u7F6E\u7F16\u53F7",
@@ -50206,7 +50651,7 @@ ${codeText}
50206
50651
  exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
50207
50652
  }
50208
50653
  };
50209
- const enUS$t = {
50654
+ const enUS$s = {
50210
50655
  list: {
50211
50656
  confirm: "Confirm",
50212
50657
  setStart: "Set number",
@@ -50226,7 +50671,7 @@ ${codeText}
50226
50671
  exitFullscreen: "Exit full screen"
50227
50672
  }
50228
50673
  };
50229
- const jaJP$t = {
50674
+ const jaJP$s = {
50230
50675
  list: {
50231
50676
  confirm: "OK",
50232
50677
  setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
@@ -50247,12 +50692,12 @@ ${codeText}
50247
50692
  }
50248
50693
  };
50249
50694
  i18n$1.mergeLang({
50250
- "zh-CN": zhCN$t,
50251
- "en-US": enUS$t,
50252
- "ja-JP": jaJP$t
50695
+ "zh-CN": zhCN$s,
50696
+ "en-US": enUS$s,
50697
+ "ja-JP": jaJP$s
50253
50698
  });
50254
- const style$9 = "";
50255
- const logger$1Y = getLogger("list-block:paste-handler");
50699
+ const style$8 = "";
50700
+ const logger$1W = getLogger("list-block:paste-handler");
50256
50701
  class ListPasteHandler {
50257
50702
  constructor() {
50258
50703
  __publicField(this, "fixStartByList", null);
@@ -50306,7 +50751,7 @@ ${codeText}
50306
50751
  startIds.set(newGroupId, 1);
50307
50752
  } else {
50308
50753
  const start = startIds.get(groupId);
50309
- assert(logger$1Y, start, "start is null");
50754
+ assert(logger$1W, start, "start is null");
50310
50755
  block.start = start + 1;
50311
50756
  block.groupId = groupId;
50312
50757
  startIds.set(groupId, start + 1);
@@ -50326,7 +50771,7 @@ ${codeText}
50326
50771
  return false;
50327
50772
  }
50328
50773
  }
50329
- const logger$1X = getLogger("list selection to doc");
50774
+ const logger$1V = getLogger("list selection to doc");
50330
50775
  function convertListToText(data2) {
50331
50776
  const textData = { type: "text" };
50332
50777
  Object.entries(data2).forEach(([key, value]) => {
@@ -50341,7 +50786,7 @@ ${codeText}
50341
50786
  const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
50342
50787
  const start = selectedBlock.start;
50343
50788
  const end = selectedBlock.end;
50344
- assert(logger$1X, data2.text, "no block text");
50789
+ assert(logger$1V, data2.text, "no block text");
50345
50790
  const len = getBlockTextLength$6(editor, selectedBlock.block);
50346
50791
  if (end.offset - start.offset === len) {
50347
50792
  return {
@@ -50917,7 +51362,7 @@ ${codeText}
50917
51362
  toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
50918
51363
  }, 300);
50919
51364
  };
50920
- const logger$1W = getLogger("inline-box-items");
51365
+ const logger$1U = getLogger("inline-box-items");
50921
51366
  function insertEmptyBlockLink(editor, containerId, blockIndex) {
50922
51367
  let block = editor.findBlockByIndex(containerId, blockIndex);
50923
51368
  let placement = "bottom-start";
@@ -50928,7 +51373,7 @@ ${codeText}
50928
51373
  const onFinished = (linkText, linkUrl) => {
50929
51374
  editor.undoManager.runInGroup(() => {
50930
51375
  try {
50931
- assert(logger$1W, block, "block not found");
51376
+ assert(logger$1U, block, "block not found");
50932
51377
  if (!isEmptyTextBlock(editor, block)) {
50933
51378
  block = editor.insertTextBlock([], containerId, blockIndex);
50934
51379
  }
@@ -50939,7 +51384,7 @@ ${codeText}
50939
51384
  editor.selection.selectBlock(block, getTextLength(text2));
50940
51385
  editor.focus();
50941
51386
  } catch (error2) {
50942
- logger$1W.error(error2);
51387
+ logger$1U.error(error2);
50943
51388
  }
50944
51389
  });
50945
51390
  };
@@ -50959,7 +51404,7 @@ ${codeText}
50959
51404
  function insertLink(editor, containerId, blockIndex) {
50960
51405
  const block = editor.getBlockByIndex(containerId, blockIndex);
50961
51406
  const range = editor.selection.range;
50962
- assert(logger$1W, isSimpleBlockPosition(range.start), "invalid block position");
51407
+ assert(logger$1U, isSimpleBlockPosition(range.start), "invalid block position");
50963
51408
  const rects = getBlockClientRects(editor, block, range);
50964
51409
  if (rects.length === 0) {
50965
51410
  return;
@@ -50985,7 +51430,7 @@ ${codeText}
50985
51430
  editor.selection.selectBlock(block, start + linkText.length);
50986
51431
  editor.focus();
50987
51432
  } catch (error2) {
50988
- logger$1W.error(error2);
51433
+ logger$1U.error(error2);
50989
51434
  }
50990
51435
  });
50991
51436
  };
@@ -51203,7 +51648,7 @@ ${codeText}
51203
51648
  function getToolbar(editor) {
51204
51649
  return editor.findCustom("toolbar-handler");
51205
51650
  }
51206
- const logger$1V = getLogger("link-popup");
51651
+ const logger$1T = getLogger("link-popup");
51207
51652
  function getLinkHref(child) {
51208
51653
  var _a, _b;
51209
51654
  return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
@@ -51241,7 +51686,7 @@ ${codeText}
51241
51686
  editor.selection.selectBlock(block, range.start + linkText.length);
51242
51687
  editor.focus();
51243
51688
  } catch (error2) {
51244
- logger$1V.error(error2);
51689
+ logger$1T.error(error2);
51245
51690
  }
51246
51691
  };
51247
51692
  const onClose = () => {
@@ -51480,7 +51925,7 @@ ${codeText}
51480
51925
  this.editProvider = new EditLinkProvider();
51481
51926
  }
51482
51927
  }
51483
- const logger$1U = getLogger("readonly-toolbar");
51928
+ const logger$1S = getLogger("readonly-toolbar");
51484
51929
  const SEP = {
51485
51930
  id: "",
51486
51931
  name: "",
@@ -51543,7 +51988,7 @@ ${codeText}
51543
51988
  });
51544
51989
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
51545
51990
  var _a;
51546
- assert(logger$1U, editor === this.editor, "editor mismatch");
51991
+ assert(logger$1S, editor === this.editor, "editor mismatch");
51547
51992
  if (!editor.readonly) {
51548
51993
  this.toolbar.close("selectionChange");
51549
51994
  return;
@@ -51725,7 +52170,7 @@ ${codeText}
51725
52170
  return visible;
51726
52171
  }
51727
52172
  }
51728
- const logger$1T = getLogger("toolbar-handler");
52173
+ const logger$1R = getLogger("toolbar-handler");
51729
52174
  class OnesEditorToolbar {
51730
52175
  constructor(editor) {
51731
52176
  __publicField(this, "id", "editor-toolbar");
@@ -51812,7 +52257,7 @@ ${codeText}
51812
52257
  });
51813
52258
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
51814
52259
  var _a;
51815
- assert(logger$1T, editor === this.editor, "editor mismatch");
52260
+ assert(logger$1R, editor === this.editor, "editor mismatch");
51816
52261
  if (editor.selection.range.isCollapsed() || this.mouseDown) {
51817
52262
  if (this.toolbarType === "object") {
51818
52263
  const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
@@ -52032,8 +52477,15 @@ ${codeText}
52032
52477
  }
52033
52478
  }
52034
52479
  const getReferenceClientRectByCaret = () => {
52480
+ if (!this.hoveringBlock) {
52481
+ return new DOMRect();
52482
+ }
52483
+ const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
52484
+ if (!element2) {
52485
+ return new DOMRect();
52486
+ }
52035
52487
  let rect;
52036
- const clientRects = element.getClientRects();
52488
+ const clientRects = element2.getClientRects();
52037
52489
  const lineRects = [];
52038
52490
  Array.from(clientRects).forEach((clientRect) => {
52039
52491
  const { y } = clientRect;
@@ -52043,7 +52495,7 @@ ${codeText}
52043
52495
  lineRects.push(y);
52044
52496
  });
52045
52497
  if (lineRects.length > 1) {
52046
- rect = child ? clientRects[clientRects.length - 1] : clientRects[0];
52498
+ rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
52047
52499
  if (event) {
52048
52500
  for (let i = 0; i < clientRects.length; i++) {
52049
52501
  const clientRect = clientRects[i];
@@ -52055,21 +52507,15 @@ ${codeText}
52055
52507
  }
52056
52508
  }
52057
52509
  } else {
52058
- rect = element.getBoundingClientRect();
52059
- if (child) {
52060
- const childRect = child.getBoundingClientRect();
52510
+ rect = element2.getBoundingClientRect();
52511
+ if (!isBlock$1(element2)) {
52512
+ const childRect = element2.getBoundingClientRect();
52061
52513
  return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
52062
52514
  }
52063
52515
  if (clientRects.length === 1) {
52064
52516
  return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
52065
52517
  }
52066
52518
  }
52067
- if (this.hoveringBlock) {
52068
- const blockContent = getBlockContent(this.hoveringBlock);
52069
- if (blockContent !== element) {
52070
- return blockContent.getBoundingClientRect();
52071
- }
52072
- }
52073
52519
  if (event) {
52074
52520
  const y = rect.y;
52075
52521
  const x = event.clientX;
@@ -52079,8 +52525,9 @@ ${codeText}
52079
52525
  };
52080
52526
  this.toolbar.updateItems(commands);
52081
52527
  if (!this.toolbar.isVisible) {
52528
+ const isText = element === child && !isTextBlockContentBoxChild(element);
52082
52529
  this.toolbar.manualShow(element, {
52083
- placement: child && !isTextBlockContentBoxChild(child) && !clientType.isMobile ? "bottom" : "top",
52530
+ placement: isText && !clientType.isMobile ? "bottom" : "top",
52084
52531
  getReferenceClientRect: getReferenceClientRectByCaret
52085
52532
  });
52086
52533
  if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
@@ -52131,7 +52578,7 @@ ${codeText}
52131
52578
  this.texWidth = [tex, width];
52132
52579
  }
52133
52580
  }
52134
- const logger$1S = getLogger("mathjax-converter");
52581
+ const logger$1Q = getLogger("mathjax-converter");
52135
52582
  const MATHJAX_SCRIPT_ID = "MathJax-script";
52136
52583
  const MATHJAX_BUFFER = 30;
52137
52584
  const REDUCED_UNIT = 8;
@@ -52180,7 +52627,7 @@ ${codeText}
52180
52627
  const svg = result.querySelector("svg");
52181
52628
  return svg.outerHTML;
52182
52629
  } catch (err) {
52183
- logger$1S.error(err);
52630
+ logger$1Q.error(err);
52184
52631
  throw err;
52185
52632
  } finally {
52186
52633
  lockers.release(lockId);
@@ -52228,7 +52675,7 @@ ${codeText}
52228
52675
  ...perfectState
52229
52676
  };
52230
52677
  }
52231
- const logger$1R = getLogger("edit-mathjax");
52678
+ const logger$1P = getLogger("edit-mathjax");
52232
52679
  class MathjaxEditor {
52233
52680
  constructor() {
52234
52681
  __publicField(this, "editMathjaxPopup", null);
@@ -52305,9 +52752,9 @@ ${codeText}
52305
52752
  this.observer.observe(textarea2);
52306
52753
  }
52307
52754
  getTextarea() {
52308
- assert(logger$1R, this.editMathjaxPopup, "no exists mathjax editor popup");
52755
+ assert(logger$1P, this.editMathjaxPopup, "no exists mathjax editor popup");
52309
52756
  const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
52310
- assert(logger$1R, textarea2, "no textarea");
52757
+ assert(logger$1P, textarea2, "no textarea");
52311
52758
  return textarea2;
52312
52759
  }
52313
52760
  destroy() {
@@ -52377,7 +52824,7 @@ ${codeText}
52377
52824
  };
52378
52825
  editMathjax(editor, box, data2.tex, update2);
52379
52826
  }
52380
- const logger$1Q = getLogger("mathjax-box");
52827
+ const logger$1O = getLogger("mathjax-box");
52381
52828
  function updateCaret(editor, event) {
52382
52829
  editor.selection.updateSelection(null);
52383
52830
  const target = event.target;
@@ -52482,7 +52929,7 @@ ${codeText}
52482
52929
  };
52483
52930
  editor.updateBoxData(newData);
52484
52931
  }).catch((err) => {
52485
- logger$1Q.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
52932
+ logger$1O.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
52486
52933
  });
52487
52934
  return data2;
52488
52935
  }
@@ -52501,7 +52948,7 @@ ${codeText}
52501
52948
  }
52502
52949
  function handleClickBox$3(editor, box, event) {
52503
52950
  const parentBlock = getParentBlock(box);
52504
- assert(logger$1Q, parentBlock, "failed to get block");
52951
+ assert(logger$1O, parentBlock, "failed to get block");
52505
52952
  if (!editor.isBlockWritable(parentBlock)) {
52506
52953
  return;
52507
52954
  }
@@ -52698,28 +53145,28 @@ $$${mathData.mathjaxText}$$
52698
53145
  getBlockProperties: getBlockProperties$b
52699
53146
  };
52700
53147
  const mathjaxStyle = "";
52701
- const zhCN$s = {
53148
+ const zhCN$r = {
52702
53149
  mathjax: {
52703
53150
  emptyText: "\u7A7A\u7684\u516C\u5F0F",
52704
53151
  abstract: "\u516C\u5F0F"
52705
53152
  }
52706
53153
  };
52707
- const enUS$s = {
53154
+ const enUS$r = {
52708
53155
  mathjax: {
52709
53156
  emptyText: "Empty formula",
52710
53157
  abstract: "Formula"
52711
53158
  }
52712
53159
  };
52713
- const jaJP$s = {
53160
+ const jaJP$r = {
52714
53161
  mathjax: {
52715
53162
  emptyText: "\u6570\u5F0F\u306A\u3057",
52716
53163
  abstract: "\u6570\u5F0F"
52717
53164
  }
52718
53165
  };
52719
53166
  i18n$1.mergeLang({
52720
- "zh-CN": zhCN$s,
52721
- "en-US": enUS$s,
52722
- "ja-JP": jaJP$s
53167
+ "zh-CN": zhCN$r,
53168
+ "en-US": enUS$r,
53169
+ "ja-JP": jaJP$r
52723
53170
  });
52724
53171
  function convertToMath(editor, containerId, blockIndex, offset) {
52725
53172
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -58253,7 +58700,7 @@ $$${mathData.mathjaxText}$$
58253
58700
  const docBlockText = { insert: " ", attributes: data2 };
58254
58701
  return docBlockText;
58255
58702
  }
58256
- const logger$1P = getLogger("StatusBoxEditor");
58703
+ const logger$1N = getLogger("StatusBoxEditor");
58257
58704
  class StatusBoxEditor {
58258
58705
  constructor(editor) {
58259
58706
  __publicField(this, "linkPopup", null);
@@ -58276,10 +58723,10 @@ $$${mathData.mathjaxText}$$
58276
58723
  });
58277
58724
  __publicField(this, "handClose", () => {
58278
58725
  var _a;
58279
- assert(logger$1P, this.boxElement, "boxElement not found");
58726
+ assert(logger$1N, this.boxElement, "boxElement not found");
58280
58727
  const boxData = this.editor.getBoxData(this.boxElement);
58281
58728
  const block = getParentBlock(this.boxElement);
58282
- assert(logger$1P, block, "block not found");
58729
+ assert(logger$1N, block, "block not found");
58283
58730
  if (!boxData.title) {
58284
58731
  const offset = getChildOffset(block, this.boxElement);
58285
58732
  this.editor.deleteTextFromBlock(block, offset.start, 1);
@@ -58317,7 +58764,7 @@ $$${mathData.mathjaxText}$$
58317
58764
  return;
58318
58765
  }
58319
58766
  const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
58320
- assert(logger$1P, this.boxElement, "boxElement not found");
58767
+ assert(logger$1N, this.boxElement, "boxElement not found");
58321
58768
  const data2 = this.editor.getBoxData(this.boxElement);
58322
58769
  this.statusPalette.changeColor(color);
58323
58770
  const newData = { ...data2, color };
@@ -58334,7 +58781,7 @@ $$${mathData.mathjaxText}$$
58334
58781
  });
58335
58782
  __publicField(this, "onTitleChange", (e2) => {
58336
58783
  const title = e2.target.value;
58337
- assert(logger$1P, this.boxElement, "boxElement not found");
58784
+ assert(logger$1N, this.boxElement, "boxElement not found");
58338
58785
  const data2 = this.editor.getBoxData(this.boxElement);
58339
58786
  const newData = { ...data2, title: title.trim() };
58340
58787
  this.editor.updateBoxData(newData, { noFocus: true });
@@ -58415,7 +58862,7 @@ $$${mathData.mathjaxText}$$
58415
58862
  toStandardText: toStandardText$1,
58416
58863
  matchText: matchText$1
58417
58864
  };
58418
- const logger$1O = getLogger("status-box-command");
58865
+ const logger$1M = getLogger("status-box-command");
58419
58866
  class StatusBoxCommand {
58420
58867
  static get commands() {
58421
58868
  return [
@@ -58434,7 +58881,7 @@ $$${mathData.mathjaxText}$$
58434
58881
  const block = editor.getBlockByIndex(containerId, blockIndex);
58435
58882
  const boxOp = createEmptyStatusBox();
58436
58883
  const { start } = editor.selection.range;
58437
- assert(logger$1O, isSimpleBlockPosition(start), "invalid block position");
58884
+ assert(logger$1M, isSimpleBlockPosition(start), "invalid block position");
58438
58885
  editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
58439
58886
  const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
58440
58887
  editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
@@ -58453,7 +58900,7 @@ $$${mathData.mathjaxText}$$
58453
58900
  }
58454
58901
  }
58455
58902
  __publicField(StatusBoxCommand, "id", "insert-status");
58456
- const enUS$r = {
58903
+ const enUS$q = {
58457
58904
  status: {
58458
58905
  empty: "Set status",
58459
58906
  command: {
@@ -58477,7 +58924,7 @@ $$${mathData.mathjaxText}$$
58477
58924
  }
58478
58925
  }
58479
58926
  };
58480
- const zhCN$r = {
58927
+ const zhCN$q = {
58481
58928
  status: {
58482
58929
  empty: "\u8BBE\u7F6E\u72B6\u6001",
58483
58930
  command: {
@@ -58501,7 +58948,7 @@ $$${mathData.mathjaxText}$$
58501
58948
  }
58502
58949
  }
58503
58950
  };
58504
- const jaJP$r = {
58951
+ const jaJP$q = {
58505
58952
  status: {
58506
58953
  empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
58507
58954
  command: {
@@ -58526,12 +58973,12 @@ $$${mathData.mathjaxText}$$
58526
58973
  }
58527
58974
  };
58528
58975
  const langs$2 = {
58529
- "en-US": enUS$r,
58530
- "zh-CN": zhCN$r,
58531
- "ja-JP": jaJP$r
58976
+ "en-US": enUS$q,
58977
+ "zh-CN": zhCN$q,
58978
+ "ja-JP": jaJP$q
58532
58979
  };
58533
58980
  i18n$1.mergeLang(langs$2);
58534
- const logger$1N = getLogger("inline-box-items");
58981
+ const logger$1L = getLogger("inline-box-items");
58535
58982
  function insertEmptyBlockMath(editor, containerId, blockIndex) {
58536
58983
  return editor.undoManager.runInGroup(() => {
58537
58984
  var _a;
@@ -58542,7 +58989,7 @@ $$${mathData.mathjaxText}$$
58542
58989
  const boxOp = createEmptyMathjaxBox();
58543
58990
  editor.setBlockText(block, [boxOp]);
58544
58991
  const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
58545
- assert(logger$1N, boxId, "mathjax box id is empty");
58992
+ assert(logger$1L, boxId, "mathjax box id is empty");
58546
58993
  setTimeout(() => {
58547
58994
  const box = editor.getBoxById(boxId);
58548
58995
  editMathjaxBox(editor, box);
@@ -58555,11 +59002,11 @@ $$${mathData.mathjaxText}$$
58555
59002
  var _a;
58556
59003
  const block = editor.getBlockByIndex(containerId, blockIndex);
58557
59004
  const range = editor.selection.range;
58558
- assert(logger$1N, isSimpleBlockPosition(range.start), "invalid block position");
59005
+ assert(logger$1L, isSimpleBlockPosition(range.start), "invalid block position");
58559
59006
  const boxOp = createEmptyMathjaxBox();
58560
59007
  editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
58561
59008
  const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
58562
- assert(logger$1N, boxId, "mathjax box id is empty");
59009
+ assert(logger$1L, boxId, "mathjax box id is empty");
58563
59010
  setTimeout(() => {
58564
59011
  const box = editor.getBoxById(boxId);
58565
59012
  editMathjaxBox(editor, box);
@@ -58726,7 +59173,7 @@ $$${mathData.mathjaxText}$$
58726
59173
  }
58727
59174
  }
58728
59175
  };
58729
- const logger$1M = getLogger("insert-menu");
59176
+ const logger$1K = getLogger("insert-menu");
58730
59177
  const injectGroup = (commands, group, startIndex) => {
58731
59178
  commands.forEach((command, index2) => {
58732
59179
  command.group = group;
@@ -58865,7 +59312,7 @@ $$${mathData.mathjaxText}$$
58865
59312
  return true;
58866
59313
  }
58867
59314
  const blockId = getBlockId(block);
58868
- assert(logger$1M, range.isSimple(), "invalid range");
59315
+ assert(logger$1K, range.isSimple(), "invalid range");
58869
59316
  const offset = range.start.offset;
58870
59317
  if (quickItem.commandProvider) {
58871
59318
  const params2 = { from: "quick-menu", blockId, offset };
@@ -58901,7 +59348,7 @@ $$${mathData.mathjaxText}$$
58901
59348
  });
58902
59349
  }
58903
59350
  }
58904
- const logger$1L = getLogger("quick-command-providers");
59351
+ const logger$1J = getLogger("quick-command-providers");
58905
59352
  class QuickCommandProviders extends AbstractProvider {
58906
59353
  constructor(editor) {
58907
59354
  super(editor);
@@ -58921,7 +59368,7 @@ $$${mathData.mathjaxText}$$
58921
59368
  }
58922
59369
  getCommands(range) {
58923
59370
  var _a, _b;
58924
- assert(logger$1L, range.start.blockId === range.end.blockId, "invalid range");
59371
+ assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
58925
59372
  const commandsMap = /* @__PURE__ */ new Map();
58926
59373
  const block = this.editor.getBlockById(range.anchor.blockId);
58927
59374
  const container = getParentContainer(block);
@@ -59358,7 +59805,7 @@ $$${mathData.mathjaxText}$$
59358
59805
  "CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
59359
59806
  ...headingShortcut()
59360
59807
  };
59361
- const zhCN$q = {
59808
+ const zhCN$p = {
59362
59809
  quickMenu: {
59363
59810
  basic: {
59364
59811
  heading: {
@@ -59414,7 +59861,7 @@ $$${mathData.mathjaxText}$$
59414
59861
  selectBlock: "\u9009\u62E9\u533A\u5757"
59415
59862
  }
59416
59863
  };
59417
- const enUS$q = {
59864
+ const enUS$p = {
59418
59865
  quickMenu: {
59419
59866
  basic: {
59420
59867
  heading: {
@@ -59470,7 +59917,7 @@ $$${mathData.mathjaxText}$$
59470
59917
  selectBlock: "Select Block"
59471
59918
  }
59472
59919
  };
59473
- const jaJP$q = {
59920
+ const jaJP$p = {
59474
59921
  quickMenu: {
59475
59922
  basic: {
59476
59923
  heading: {
@@ -59527,9 +59974,9 @@ $$${mathData.mathjaxText}$$
59527
59974
  }
59528
59975
  };
59529
59976
  i18n$1.mergeLang({
59530
- "zh-CN": zhCN$q,
59531
- "en-US": enUS$q,
59532
- "ja-JP": jaJP$q
59977
+ "zh-CN": zhCN$p,
59978
+ "en-US": enUS$p,
59979
+ "ja-JP": jaJP$p
59533
59980
  });
59534
59981
  class TextStylesFixedProvider extends ProxyProvider {
59535
59982
  constructor(editor, afterCommandCallback) {
@@ -59734,7 +60181,7 @@ $$${mathData.mathjaxText}$$
59734
60181
  return false;
59735
60182
  }
59736
60183
  }
59737
- const logger$1K = getLogger("block-command-providers");
60184
+ const logger$1I = getLogger("block-command-providers");
59738
60185
  class BlockCommandProviders extends AbstractProvider {
59739
60186
  constructor(editor, afterCommandCallback) {
59740
60187
  super(editor);
@@ -59755,7 +60202,7 @@ $$${mathData.mathjaxText}$$
59755
60202
  this.registerCommandProvider(new InsertGroupProvider(editor));
59756
60203
  }
59757
60204
  getCommands(range) {
59758
- assert(logger$1K, range.start.blockId === range.end.blockId, "invalid range");
60205
+ assert(logger$1I, range.start.blockId === range.end.blockId, "invalid range");
59759
60206
  const block = this.editor.getBlockById(range.anchor.blockId);
59760
60207
  const commandsMap = /* @__PURE__ */ new Map();
59761
60208
  let startIndex = 100;
@@ -59769,7 +60216,7 @@ $$${mathData.mathjaxText}$$
59769
60216
  return this.filterItems(range, commands);
59770
60217
  }
59771
60218
  }
59772
- const logger$1J = getLogger("standard-block-actions");
60219
+ const logger$1H = getLogger("standard-block-actions");
59773
60220
  class StandardBlockActionHook {
59774
60221
  constructor() {
59775
60222
  __publicField(this, "executeCommand", (editor, bloockElement, item) => {
@@ -59788,7 +60235,7 @@ $$${mathData.mathjaxText}$$
59788
60235
  this.deleteBlock(editor, block);
59789
60236
  }
59790
60237
  } catch (err) {
59791
- logger$1J.error(`failed to execute block command: ${JSON.stringify(err)}`);
60238
+ logger$1H.error(`failed to execute block command: ${JSON.stringify(err)}`);
59792
60239
  }
59793
60240
  });
59794
60241
  }
@@ -59856,7 +60303,7 @@ $$${mathData.mathjaxText}$$
59856
60303
  }
59857
60304
  }
59858
60305
  }
59859
- const logger$1I = getLogger("block-menu");
60306
+ const logger$1G = getLogger("block-menu");
59860
60307
  class BlockMenu {
59861
60308
  constructor(editor) {
59862
60309
  __publicField(this, "menu");
@@ -59864,7 +60311,7 @@ $$${mathData.mathjaxText}$$
59864
60311
  __publicField(this, "commandBlock", null);
59865
60312
  __publicField(this, "blockCommandProviders");
59866
60313
  __publicField(this, "handleShow", () => {
59867
- assert(logger$1I, this.currentBlock, "no target block before show block menu");
60314
+ assert(logger$1G, this.currentBlock, "no target block before show block menu");
59868
60315
  const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
59869
60316
  this.menu.updateItems(items);
59870
60317
  this.commandBlock = this.currentBlock;
@@ -59875,7 +60322,7 @@ $$${mathData.mathjaxText}$$
59875
60322
  }
59876
60323
  });
59877
60324
  __publicField(this, "handleItemClick", (bar2, item) => {
59878
- assert(logger$1I, this.commandBlock, "no command block before show block menu");
60325
+ assert(logger$1G, this.commandBlock, "no command block before show block menu");
59879
60326
  this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
59880
60327
  if (!item.element) {
59881
60328
  this.close();
@@ -59918,7 +60365,7 @@ $$${mathData.mathjaxText}$$
59918
60365
  this.menu.destroy();
59919
60366
  }
59920
60367
  }
59921
- const logger$1H = getLogger("text-styles");
60368
+ const logger$1F = getLogger("text-styles");
59922
60369
  function getIntersectionStyles(text2) {
59923
60370
  const getOpStyle = (op) => {
59924
60371
  if (!op.attributes) {
@@ -59952,10 +60399,10 @@ $$${mathData.mathjaxText}$$
59952
60399
  return new Map(Object.entries(attributes));
59953
60400
  }
59954
60401
  function applyTextStyle(editor, block, range, style2, value) {
59955
- assert(logger$1H, range.isSimple(), "invalid range");
60402
+ assert(logger$1F, range.isSimple(), "invalid range");
59956
60403
  const { start, end } = range;
59957
- assert(logger$1H, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
59958
- assert(logger$1H, style2.startsWith("style-"), "invalid style");
60404
+ assert(logger$1F, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
60405
+ assert(logger$1F, style2.startsWith("style-"), "invalid style");
59959
60406
  const oldText = editor.getBlockText(block);
59960
60407
  let newText = oldText;
59961
60408
  if (style2 === "style-sub") {
@@ -60001,13 +60448,13 @@ $$${mathData.mathjaxText}$$
60001
60448
  return standardItems;
60002
60449
  }
60003
60450
  function getSubText(editor, block, range) {
60004
- assert(logger$1H, range.isSimple(), "nor a simple range");
60451
+ assert(logger$1F, range.isSimple(), "nor a simple range");
60005
60452
  const { start, end } = range;
60006
- assert(logger$1H, start.isSimple(), "is not a simple block position");
60007
- assert(logger$1H, end.isSimple(), "is not a simple block position");
60008
- assert(logger$1H, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
60453
+ assert(logger$1F, start.isSimple(), "is not a simple block position");
60454
+ assert(logger$1F, end.isSimple(), "is not a simple block position");
60455
+ assert(logger$1F, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
60009
60456
  const blockId = getBlockId(block);
60010
- assert(logger$1H, start.blockId === blockId && end.blockId === blockId, "invalid range");
60457
+ assert(logger$1F, start.blockId === blockId && end.blockId === blockId, "invalid range");
60011
60458
  const text2 = editor.getBlockText(block);
60012
60459
  let subText2 = [];
60013
60460
  if (start.offset === end.offset) {
@@ -60019,7 +60466,7 @@ $$${mathData.mathjaxText}$$
60019
60466
  }
60020
60467
  return subText2;
60021
60468
  }
60022
- const logger$1G = getLogger("text-commands");
60469
+ const logger$1E = getLogger("text-commands");
60023
60470
  function getCommands$1(editor, text2) {
60024
60471
  const StandardTextStyles = {
60025
60472
  "style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
@@ -60037,13 +60484,13 @@ $$${mathData.mathjaxText}$$
60037
60484
  }
60038
60485
  function executeStyleCommand(editor, block, range, command, params, result) {
60039
60486
  if (!command.startsWith("style-")) {
60040
- logger$1G.warn(`unknown command: ${command}`);
60487
+ logger$1E.warn(`unknown command: ${command}`);
60041
60488
  return false;
60042
60489
  }
60043
60490
  const value = params == null ? void 0 : params.value;
60044
60491
  const type = typeof value;
60045
60492
  if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
60046
- logger$1G.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
60493
+ logger$1E.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
60047
60494
  return false;
60048
60495
  }
60049
60496
  const newText = applyTextStyle(editor, block, range, command, value);
@@ -60268,7 +60715,7 @@ $$${mathData.mathjaxText}$$
60268
60715
  this.providers = [new TextScriptProvider(editor)];
60269
60716
  }
60270
60717
  }
60271
- const logger$1F = getLogger("text-command-provider");
60718
+ const logger$1D = getLogger("text-command-provider");
60272
60719
  class TextCommandProvider {
60273
60720
  constructor(editor, options) {
60274
60721
  __publicField(this, "id", "TextCommandProvider");
@@ -60388,7 +60835,7 @@ $$${mathData.mathjaxText}$$
60388
60835
  }
60389
60836
  static fromTextCommandId(id) {
60390
60837
  const prefix = "text/";
60391
- assert(logger$1F, id.startsWith(prefix), `invalid item id: ${id}`);
60838
+ assert(logger$1D, id.startsWith(prefix), `invalid item id: ${id}`);
60392
60839
  return id.substring(prefix.length);
60393
60840
  }
60394
60841
  }
@@ -60493,7 +60940,7 @@ $$${mathData.mathjaxText}$$
60493
60940
  };
60494
60941
  editor.updateBlockData(block, newData);
60495
60942
  }
60496
- function addCommentToBlock$1(editor, block, provider) {
60943
+ function addCommentToBlock(editor, block, provider) {
60497
60944
  const { start, end } = createBlockSimpleRange(editor, block, 0, getBlockTextLength$6(editor, block));
60498
60945
  const selectedBlock = { block, start, end };
60499
60946
  const abstract = getCommentAbstractFromSelectedBlocks(editor, [selectedBlock]);
@@ -60506,7 +60953,7 @@ $$${mathData.mathjaxText}$$
60506
60953
  provider.localCreateComment(comment, doc2);
60507
60954
  return comment;
60508
60955
  }
60509
- const logger$1E = getLogger("standard-block-actions");
60956
+ const logger$1C = getLogger("standard-block-actions");
60510
60957
  class CommentBlockHook {
60511
60958
  constructor(provider, editorComments) {
60512
60959
  __publicField(this, "executeCommand", (editor, block, item) => {
@@ -60514,9 +60961,9 @@ $$${mathData.mathjaxText}$$
60514
60961
  try {
60515
60962
  this.editorComments.showCommentList();
60516
60963
  const block2 = editor.getBlockById(blockId);
60517
- addCommentToBlock$1(editor, block2, this.provider);
60964
+ addCommentToBlock(editor, block2, this.provider);
60518
60965
  } catch (err) {
60519
- logger$1E.error(`failed to execute block command: ${JSON.stringify(err)}`);
60966
+ logger$1C.error(`failed to execute block command: ${JSON.stringify(err)}`);
60520
60967
  }
60521
60968
  });
60522
60969
  this.provider = provider;
@@ -60620,7 +61067,7 @@ $$${mathData.mathjaxText}$$
60620
61067
  const attributes = Array.from(element.attributes).map((c) => c.name);
60621
61068
  return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
60622
61069
  }
60623
- const logger$1D = getLogger("doc-comments");
61070
+ const logger$1B = getLogger("doc-comments");
60624
61071
  function addBlockComments(doc2, block, result, resultSet) {
60625
61072
  if (block.comments) {
60626
61073
  const blockComments = block.comments;
@@ -60715,8 +61162,8 @@ $$${mathData.mathjaxText}$$
60715
61162
  const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
60716
61163
  const index1 = commentsMap.get(group1.groupId);
60717
61164
  const index2 = commentsMap.get(group2.groupId);
60718
- assert(logger$1D, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
60719
- assert(logger$1D, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
61165
+ assert(logger$1B, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
61166
+ assert(logger$1B, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
60720
61167
  return index1 - index2;
60721
61168
  });
60722
61169
  return result;
@@ -60777,7 +61224,7 @@ $$${mathData.mathjaxText}$$
60777
61224
  const commentIds = intersection__default.default(comments1, comments2);
60778
61225
  return commentIds;
60779
61226
  }
60780
- const logger$1C = getLogger("active-comments");
61227
+ const logger$1A = getLogger("active-comments");
60781
61228
  function inactiveComment(editor, commentId) {
60782
61229
  const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
60783
61230
  activeCommentElements.forEach((el) => {
@@ -60813,7 +61260,7 @@ $$${mathData.mathjaxText}$$
60813
61260
  const commentIds = getCommentsFromSelection(editor);
60814
61261
  if (commentIds.indexOf(commentId) === -1) {
60815
61262
  const block = getParentBlock(targetElement);
60816
- assert(logger$1C, block, "block not found");
61263
+ assert(logger$1A, block, "block not found");
60817
61264
  const offset = getChildOffset(block, targetElement);
60818
61265
  const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
60819
61266
  editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
@@ -60855,7 +61302,7 @@ $$${mathData.mathjaxText}$$
60855
61302
  function isValidSize(size) {
60856
61303
  return typeof size === "number";
60857
61304
  }
60858
- const logger$1B = getLogger("image-data");
61305
+ const logger$1z = getLogger("image-data");
60859
61306
  const md5Cache = /* @__PURE__ */ new Map();
60860
61307
  const DEFAULT_WIDTH$1 = 1e3;
60861
61308
  const DEFAULT_HEIGHT = 400;
@@ -60987,7 +61434,7 @@ $$${mathData.mathjaxText}$$
60987
61434
  if (heightKey && isValidSize(image.height)) {
60988
61435
  result[heightKey] = image.height;
60989
61436
  }
60990
- assert(logger$1B, image.flex, "no image flex");
61437
+ assert(logger$1z, image.flex, "no image flex");
60991
61438
  const flexKey = getImageFlexKeyFromSrc(index2);
60992
61439
  result[flexKey] = image.flex;
60993
61440
  });
@@ -61043,224 +61490,7 @@ $$${mathData.mathjaxText}$$
61043
61490
  const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
61044
61491
  return totalFlex;
61045
61492
  }
61046
- function createResizeGripper(parent, type) {
61047
- const elem = createElement("div", ["resize-gripper", type], parent);
61048
- elem.setAttribute("data-resize-type", type);
61049
- }
61050
- function getExistsResizer(block) {
61051
- const tools = getBlockTools(block);
61052
- return tools.querySelector(".block-resizer");
61053
- }
61054
- function hideResizer(block) {
61055
- const exists = getExistsResizer(block);
61056
- if (exists) {
61057
- removeClass(exists, "active");
61058
- }
61059
- }
61060
- function updateSize(block, element, resizer) {
61061
- const blockRect = block.getBoundingClientRect();
61062
- const elementRect = element.getBoundingClientRect();
61063
- const top = elementRect.top - blockRect.top;
61064
- const left = elementRect.left - blockRect.left;
61065
- const width = elementRect.width;
61066
- const height = elementRect.height;
61067
- resizer.style.top = `${top}px`;
61068
- resizer.style.left = `${left}px`;
61069
- resizer.style.width = `${width}px`;
61070
- resizer.style.height = `${height}px`;
61071
- }
61072
- function createResizer(block, element, options, mouseDownEvent) {
61073
- const exists = getExistsResizer(block);
61074
- if (exists) {
61075
- addClass(exists, "active");
61076
- updateSize(block, element, exists);
61077
- return exists;
61078
- }
61079
- const tools = getBlockTools(block);
61080
- const resizer = createElement("div", ["block-resizer"], tools);
61081
- updateSize(block, element, resizer);
61082
- options.resize.forEach((type) => {
61083
- createResizeGripper(resizer, type);
61084
- });
61085
- resizer.addEventListener("mousedown", mouseDownEvent);
61086
- addClass(resizer, "active");
61087
- return resizer;
61088
- }
61089
- function updateResizer(block, element) {
61090
- const resizer = getExistsResizer(block);
61091
- if (!resizer) {
61092
- return;
61093
- }
61094
- if (!isChildNode(block, element)) {
61095
- return;
61096
- }
61097
- const blockRect = block.getBoundingClientRect();
61098
- const elementRect = element.getBoundingClientRect();
61099
- const top = elementRect.top - blockRect.top;
61100
- const left = elementRect.left - blockRect.left;
61101
- const width = elementRect.width;
61102
- const height = elementRect.height;
61103
- resizer.style.top = `${top}px`;
61104
- resizer.style.left = `${left}px`;
61105
- resizer.style.width = `${width}px`;
61106
- resizer.style.height = `${height}px`;
61107
- }
61108
- const style$8 = "";
61109
- const logger$1A = getLogger("block-resizer");
61110
- class BlockResizer extends tinyTypedEmitter.TypedEmitter {
61111
- constructor(editor, options) {
61112
- super();
61113
- __publicField(this, "resizableElement");
61114
- __publicField(this, "block", null);
61115
- __publicField(this, "startRect", null);
61116
- __publicField(this, "startPos", null);
61117
- __publicField(this, "resizeType", null);
61118
- __publicField(this, "enabled", false);
61119
- __publicField(this, "handleEditorResize", () => {
61120
- if (this.block) {
61121
- this.updateResizer();
61122
- }
61123
- });
61124
- __publicField(this, "handleMouseDown", (event) => {
61125
- event.preventDefault();
61126
- event.stopPropagation();
61127
- const element = this.getResizableElement();
61128
- if (!element) {
61129
- return;
61130
- }
61131
- if (event.button !== 0) {
61132
- return;
61133
- }
61134
- const gripper = event.target;
61135
- if (!gripper) {
61136
- return;
61137
- }
61138
- if (!(gripper instanceof HTMLElement)) {
61139
- return;
61140
- }
61141
- const resizeType = gripper.getAttribute("data-resize-type");
61142
- if (!resizeType) {
61143
- return;
61144
- }
61145
- this.bindEvents();
61146
- this.startRect = element.getBoundingClientRect();
61147
- this.startPos = event;
61148
- this.resizeType = resizeType;
61149
- setDefaultCursor(window.getComputedStyle(gripper).cursor);
61150
- if (this.block) {
61151
- this.editor.selection.selectBlock(this.block, 0);
61152
- }
61153
- });
61154
- __publicField(this, "handleMouseMove", (event) => {
61155
- if (!this.startPos || !this.startRect || !this.resizeType) {
61156
- return;
61157
- }
61158
- const element = this.getResizableElement();
61159
- if (!element || !this.block) {
61160
- return;
61161
- }
61162
- const deltaX = event.x - this.startPos.x;
61163
- const deltaY = event.y - this.startPos.y;
61164
- const oldRect = this.startRect;
61165
- let { top, left, right, bottom } = oldRect;
61166
- if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
61167
- bottom += deltaY;
61168
- }
61169
- if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
61170
- top += deltaY;
61171
- }
61172
- if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
61173
- left += deltaX;
61174
- }
61175
- if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
61176
- right += deltaX;
61177
- }
61178
- const width = right > left ? right - left : 0;
61179
- const height = bottom > top ? bottom - top : 0;
61180
- const newRect = new DOMRect(left, top, width, height);
61181
- this.emit("resizing", this, newRect);
61182
- const newElement = this.getResizableElement();
61183
- if (newElement) {
61184
- updateResizer(this.block, newElement);
61185
- }
61186
- });
61187
- __publicField(this, "handleMouseUp", (event) => {
61188
- if (event.button !== 0) {
61189
- return;
61190
- }
61191
- setDefaultCursor("");
61192
- this.unbindEvents();
61193
- this.emit("resized", this);
61194
- const element = this.getResizableElement();
61195
- if (!element || !this.block) {
61196
- return;
61197
- }
61198
- updateResizer(this.block, element);
61199
- });
61200
- this.editor = editor;
61201
- this.options = options;
61202
- this.editor.addListener("resize", this.handleEditorResize);
61203
- }
61204
- enableResize(block, resizableElement) {
61205
- this.block = block;
61206
- this.resizableElement = resizableElement;
61207
- this.createResizer();
61208
- this.enabled = true;
61209
- }
61210
- disableResize() {
61211
- if (!this.block) {
61212
- return;
61213
- }
61214
- hideResizer(this.block);
61215
- this.enabled = false;
61216
- }
61217
- update(block, resizableElement) {
61218
- this.block = block;
61219
- this.resizableElement = resizableElement;
61220
- const elem = this.getResizableElement();
61221
- if (elem && this.enabled) {
61222
- this.createResizer();
61223
- }
61224
- }
61225
- updateResizer() {
61226
- const newElement = this.getResizableElement();
61227
- if (newElement && this.block) {
61228
- updateResizer(this.block, newElement);
61229
- }
61230
- }
61231
- getBlock() {
61232
- return this.block;
61233
- }
61234
- destroy() {
61235
- this.editor.removeListener("resize", this.handleEditorResize);
61236
- }
61237
- getResizableElement() {
61238
- if (this.resizableElement) {
61239
- return this.resizableElement;
61240
- }
61241
- if (!this.block) {
61242
- return null;
61243
- }
61244
- return getBlockContent(this.block);
61245
- }
61246
- createResizer() {
61247
- const element = this.getResizableElement();
61248
- if (!element || !this.block) {
61249
- return;
61250
- }
61251
- assert(logger$1A, isChildNode(this.block, element), "not a block child element");
61252
- createResizer(this.block, element, this.options, this.handleMouseDown);
61253
- }
61254
- bindEvents() {
61255
- document.addEventListener("mousemove", this.handleMouseMove);
61256
- document.addEventListener("mouseup", this.handleMouseUp);
61257
- }
61258
- unbindEvents() {
61259
- document.removeEventListener("mousemove", this.handleMouseMove);
61260
- document.removeEventListener("mouseup", this.handleMouseUp);
61261
- }
61262
- }
61263
- const logger$1z = getLogger("image-dom");
61493
+ const logger$1y = getLogger("image-dom");
61264
61494
  function getExistsProgressMask(imageContainer) {
61265
61495
  return imageContainer.querySelector(".uploading-progress-mask");
61266
61496
  }
@@ -61277,7 +61507,7 @@ $$${mathData.mathjaxText}$$
61277
61507
  function getImageUploadingProgressValueElement(imageContainer) {
61278
61508
  const bar2 = getImageUploadingProgressMask(imageContainer);
61279
61509
  const value = bar2.querySelector(".uploading-progress-bar-value");
61280
- assert(logger$1z, value, "no progress value");
61510
+ assert(logger$1y, value, "no progress value");
61281
61511
  return value;
61282
61512
  }
61283
61513
  function setImageUploading(imageContainer, progress) {
@@ -61367,7 +61597,7 @@ $$${mathData.mathjaxText}$$
61367
61597
  const images = Array.from(block.querySelectorAll(".image-container"));
61368
61598
  return images;
61369
61599
  }
61370
- const logger$1y = getLogger("table-resize-drag-drop");
61600
+ const logger$1x = getLogger("table-resize-drag-drop");
61371
61601
  class ImageSplitterResizer {
61372
61602
  constructor(editor, elem, data2, mouseDownEvent) {
61373
61603
  __publicField(this, "cursor", "col-resize");
@@ -61380,7 +61610,7 @@ $$${mathData.mathjaxText}$$
61380
61610
  const imageObject = getImageObject(this.editor, block);
61381
61611
  const images = imageObject.getImages();
61382
61612
  const splitterIndex = this.data.splitterIndex;
61383
- assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61613
+ assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61384
61614
  const imageContainers = getImageContainersByBlock(block);
61385
61615
  const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
61386
61616
  this.initWidths = initWidths;
@@ -61398,7 +61628,7 @@ $$${mathData.mathjaxText}$$
61398
61628
  const imageObject = getImageObject(this.editor, block);
61399
61629
  const images = cloneDeep__default.default(imageObject.getImages());
61400
61630
  const splitterIndex = this.data.splitterIndex;
61401
- assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61631
+ assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61402
61632
  const width1 = this.initWidths[splitterIndex];
61403
61633
  const width2 = this.initWidths[splitterIndex + 1];
61404
61634
  if (width1 + width2 < 100) {
@@ -61417,7 +61647,7 @@ $$${mathData.mathjaxText}$$
61417
61647
  newWidths[splitterIndex] += delta;
61418
61648
  newWidths[splitterIndex + 1] -= delta;
61419
61649
  const imageContainers = getImageContainersByBlock(block);
61420
- assert(logger$1y, imageContainers.length === images.length, "invalid image data");
61650
+ assert(logger$1x, imageContainers.length === images.length, "invalid image data");
61421
61651
  const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
61422
61652
  for (let i = 0; i < images.length; i++) {
61423
61653
  const flex = newWidths[i] / totalWidth;
@@ -61490,7 +61720,7 @@ $$${mathData.mathjaxText}$$
61490
61720
  editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
61491
61721
  editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
61492
61722
  }
61493
- const logger$1x = getLogger("image-item");
61723
+ const logger$1w = getLogger("image-item");
61494
61724
  function getParentImageBlock(eventTarget) {
61495
61725
  if (!eventTarget) {
61496
61726
  return null;
@@ -61569,7 +61799,7 @@ $$${mathData.mathjaxText}$$
61569
61799
  if (file2) {
61570
61800
  imageObject.replaceImage(index2, file2);
61571
61801
  } else {
61572
- logger$1x.warn(`failed to download image: ${imageData.src}`);
61802
+ logger$1w.warn(`failed to download image: ${imageData.src}`);
61573
61803
  }
61574
61804
  }
61575
61805
  function createLoadErrorElement(editor, imageContainer, imageData) {
@@ -61792,7 +62022,7 @@ $$${mathData.mathjaxText}$$
61792
62022
  function isImageFile(fileType) {
61793
62023
  return fileType.startsWith("image/");
61794
62024
  }
61795
- const logger$1w = getLogger("image-object");
62025
+ const logger$1v = getLogger("image-object");
61796
62026
  class ImageObject {
61797
62027
  constructor(editor, blockData) {
61798
62028
  __publicField(this, "images", []);
@@ -62083,7 +62313,7 @@ $$${mathData.mathjaxText}$$
62083
62313
  this.editor.updateEmbedData(block2, embedData);
62084
62314
  return true;
62085
62315
  } catch (err) {
62086
- logger$1w.error(err);
62316
+ logger$1v.error(err);
62087
62317
  const block2 = this.editor.findBlockById(this.blockData.id);
62088
62318
  if (!block2) {
62089
62319
  return false;
@@ -62100,7 +62330,7 @@ $$${mathData.mathjaxText}$$
62100
62330
  if (!block) {
62101
62331
  return;
62102
62332
  }
62103
- assert(logger$1w, flex.length === this.images.length, "invalid flex");
62333
+ assert(logger$1v, flex.length === this.images.length, "invalid flex");
62104
62334
  for (let i = 0; i < this.images.length; i++) {
62105
62335
  this.images[i].flex = flex[i];
62106
62336
  }
@@ -62149,7 +62379,7 @@ $$${mathData.mathjaxText}$$
62149
62379
  }
62150
62380
  }
62151
62381
  const imageEmbedStyle = "";
62152
- const logger$1v = getLogger("drop-indicator");
62382
+ const logger$1u = getLogger("drop-indicator");
62153
62383
  const INDICATOR_SIZE$1 = 2;
62154
62384
  class DropIndicator {
62155
62385
  constructor(editor) {
@@ -62194,7 +62424,7 @@ $$${mathData.mathjaxText}$$
62194
62424
  if (insertPos === "before") {
62195
62425
  const beforeBlock = getPrevVisibleBlock(block);
62196
62426
  if (!beforeBlock) {
62197
- assert(logger$1v, isChildContainer(getParentContainer(block)), "block does not in a child container");
62427
+ assert(logger$1u, isChildContainer(getParentContainer(block)), "block does not in a child container");
62198
62428
  const rect = block.getBoundingClientRect();
62199
62429
  const viewRect2 = this.getViewRect(block);
62200
62430
  return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
@@ -62220,14 +62450,14 @@ $$${mathData.mathjaxText}$$
62220
62450
  const PADDING = 5;
62221
62451
  if (insertPos.pos === "left") {
62222
62452
  const parent = getParentContainer(block);
62223
- assert(logger$1v, parent, "block does not in a container");
62453
+ assert(logger$1u, parent, "block does not in a container");
62224
62454
  const rect = block.getBoundingClientRect();
62225
62455
  const viewRect = this.getViewRect(block);
62226
62456
  return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
62227
62457
  }
62228
62458
  if (insertPos.pos === "right") {
62229
62459
  const parent = getParentContainer(block);
62230
- assert(logger$1v, parent, "block does not in a container");
62460
+ assert(logger$1u, parent, "block does not in a container");
62231
62461
  const rect = block.getBoundingClientRect();
62232
62462
  let viewRect;
62233
62463
  if (isEmbedBlock(block)) {
@@ -62324,7 +62554,7 @@ $$${mathData.mathjaxText}$$
62324
62554
  }
62325
62555
  return void 0;
62326
62556
  }
62327
- const logger$1u = getLogger("code-dom");
62557
+ const logger$1t = getLogger("code-dom");
62328
62558
  function isCodeBlock(block) {
62329
62559
  return getBlockType(block) === "code";
62330
62560
  }
@@ -62342,8 +62572,8 @@ $$${mathData.mathjaxText}$$
62342
62572
  }
62343
62573
  function getParentCodeBlock(elem) {
62344
62574
  const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
62345
- assert(logger$1u, codeBlock2, "no parent code block");
62346
- assert(logger$1u, isCodeBlock(codeBlock2), "not a code block");
62575
+ assert(logger$1t, codeBlock2, "no parent code block");
62576
+ assert(logger$1t, isCodeBlock(codeBlock2), "not a code block");
62347
62577
  return codeBlock2;
62348
62578
  }
62349
62579
  const SUPPORTED_LANGUAGES = () => ({
@@ -62434,7 +62664,7 @@ $$${mathData.mathjaxText}$$
62434
62664
  function setDefaultLanguage(editor, lang) {
62435
62665
  return editor.settingsProvider.setItem("editor-code-lang", lang);
62436
62666
  }
62437
- const logger$1t = getLogger("convert-to-code");
62667
+ const logger$1s = getLogger("convert-to-code");
62438
62668
  function convertToCode(editor, srcBlock) {
62439
62669
  if (!isTextKindBlock(editor, srcBlock)) {
62440
62670
  return null;
@@ -62447,7 +62677,7 @@ $$${mathData.mathjaxText}$$
62447
62677
  const textContainerId = genId();
62448
62678
  editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
62449
62679
  const text2 = editor.getBlockData(srcBlock).text;
62450
- assert(logger$1t, text2, "no text");
62680
+ assert(logger$1s, text2, "no text");
62451
62681
  let alias = toPlainText(text2);
62452
62682
  if (alias.startsWith("```")) {
62453
62683
  alias = alias.substring(3);
@@ -62465,16 +62695,16 @@ $$${mathData.mathjaxText}$$
62465
62695
  };
62466
62696
  }
62467
62697
  const codeBlock = "";
62468
- const logger$1s = getLogger("code-block-child-container");
62698
+ const logger$1r = getLogger("code-block-child-container");
62469
62699
  function getTextContainer(codeBlock2) {
62470
- assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
62700
+ assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
62471
62701
  const content = getBlockContent(codeBlock2);
62472
62702
  const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
62473
- assert(logger$1s, textContainer, "no code text container");
62703
+ assert(logger$1r, textContainer, "no code text container");
62474
62704
  return textContainer;
62475
62705
  }
62476
62706
  function getCaptionContainer(codeBlock2) {
62477
- assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
62707
+ assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
62478
62708
  const content = getBlockContent(codeBlock2);
62479
62709
  const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
62480
62710
  if (!textContainer)
@@ -62503,7 +62733,7 @@ $$${mathData.mathjaxText}$$
62503
62733
  }
62504
62734
  return getBlockType(block) === "code";
62505
62735
  }
62506
- const logger$1r = getLogger("code-caption");
62736
+ const logger$1q = getLogger("code-caption");
62507
62737
  function toggleCodeCaption(editor, codeBlock2) {
62508
62738
  if (editor.readonly) {
62509
62739
  return;
@@ -62516,7 +62746,7 @@ $$${mathData.mathjaxText}$$
62516
62746
  }
62517
62747
  const captionContainerId = createEmptyContainer(editor.doc);
62518
62748
  const oldData = editor.getBlockData(codeBlock2);
62519
- assert(logger$1r, oldData.children.length === 1, "code block should have only one child");
62749
+ assert(logger$1q, oldData.children.length === 1, "code block should have only one child");
62520
62750
  const newData = {
62521
62751
  ...oldData,
62522
62752
  children: [oldData.children[0], captionContainerId]
@@ -62532,7 +62762,7 @@ $$${mathData.mathjaxText}$$
62532
62762
  return false;
62533
62763
  }
62534
62764
  const parentBlock = getParentBlock(parentContainer);
62535
- assert(logger$1r, parentBlock, "no parent block");
62765
+ assert(logger$1q, parentBlock, "no parent block");
62536
62766
  if (!isCodeBlock(parentBlock)) {
62537
62767
  return false;
62538
62768
  }
@@ -62552,7 +62782,7 @@ $$${mathData.mathjaxText}$$
62552
62782
  const lastBlock2 = getLastChildBlock(textContainer);
62553
62783
  editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
62554
62784
  const oldData = editor.getBlockData(codeBlock2);
62555
- assert(logger$1r, oldData.children.length === 2, "code block should have only one child");
62785
+ assert(logger$1q, oldData.children.length === 2, "code block should have only one child");
62556
62786
  const captionContainerId = oldData.children[1];
62557
62787
  const newData = {
62558
62788
  ...oldData,
@@ -62561,7 +62791,7 @@ $$${mathData.mathjaxText}$$
62561
62791
  editor.updateBlockData(codeBlock2, newData);
62562
62792
  editor.deleteChildContainers([captionContainerId]);
62563
62793
  }
62564
- const logger$1q = getLogger("paste-in-table-block");
62794
+ const logger$1p = getLogger("paste-in-table-block");
62565
62795
  class PasteEventHandler {
62566
62796
  constructor(editor) {
62567
62797
  this.editor = editor;
@@ -62582,7 +62812,7 @@ $$${mathData.mathjaxText}$$
62582
62812
  return false;
62583
62813
  }
62584
62814
  const parentBlock = getParentBlock(parentContainer);
62585
- assert(logger$1q, parentBlock, "no parent block");
62815
+ assert(logger$1p, parentBlock, "no parent block");
62586
62816
  if (!isCodeBlock(parentBlock)) {
62587
62817
  return false;
62588
62818
  }
@@ -62646,7 +62876,7 @@ $$${mathData.mathjaxText}$$
62646
62876
  function registerCodeBlockCommandProvider(editor) {
62647
62877
  editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
62648
62878
  }
62649
- const logger$1p = getLogger("code-caption-input-handler");
62879
+ const logger$1o = getLogger("code-caption-input-handler");
62650
62880
  function getCurrentCaptionBlock(editor) {
62651
62881
  if (!editor.selection.range.isSimple()) {
62652
62882
  return null;
@@ -62759,7 +62989,7 @@ $$${mathData.mathjaxText}$$
62759
62989
  editor.undoManager.runInGroup(() => {
62760
62990
  editor.clearSelectedContents();
62761
62991
  const start = editor.selection.range.start;
62762
- assert(logger$1p, start.isSimple(), "not simple position");
62992
+ assert(logger$1o, start.isSimple(), "not simple position");
62763
62993
  editor.insertTextToBlock(block, start.offset, text2);
62764
62994
  });
62765
62995
  return true;
@@ -62804,9 +63034,9 @@ $$${mathData.mathjaxText}$$
62804
63034
  };
62805
63035
  editor.updateBlockData(codeBlock2, newData);
62806
63036
  }
62807
- const logger$1o = getLogger("code-block-header");
63037
+ const logger$1n = getLogger("code-block-header");
62808
63038
  function selectCodeBlock(editor, block, options) {
62809
- assert(logger$1o, isCodeBlock(block), "not a code block");
63039
+ assert(logger$1n, isCodeBlock(block), "not a code block");
62810
63040
  const firstBlock = getFirstChildBlock(getTextContainer(block));
62811
63041
  editor.selection.selectBlock(firstBlock, 0);
62812
63042
  if (options.focusToEditor) {
@@ -62848,8 +63078,8 @@ $$${mathData.mathjaxText}$$
62848
63078
  const target = event.target;
62849
63079
  const select2 = target.closest(".language-select");
62850
63080
  const block = getParentBlock(select2);
62851
- assert(logger$1o, block, "no parent block");
62852
- assert(logger$1o, getBlockType(block) === "code", "not a code block");
63081
+ assert(logger$1n, block, "no parent block");
63082
+ assert(logger$1n, getBlockType(block) === "code", "not a code block");
62853
63083
  const codeData = editor2.getBlockData(block);
62854
63084
  const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
62855
63085
  dropdown2.custom = { codeBlock: block, editor: editor2 };
@@ -62872,11 +63102,11 @@ $$${mathData.mathjaxText}$$
62872
63102
  function handleCodeHeaderButtonClick(editor, event) {
62873
63103
  const target = event.target;
62874
63104
  const button2 = target.closest(".code-header-button");
62875
- assert(logger$1o, button2, "no button");
63105
+ assert(logger$1n, button2, "no button");
62876
63106
  const block = getParentBlock(target);
62877
- assert(logger$1o, block, "no parent block");
63107
+ assert(logger$1n, block, "no parent block");
62878
63108
  const id = button2.getAttribute("data-id");
62879
- assert(logger$1o, getBlockType(block) === "code", "not a code block");
63109
+ assert(logger$1n, getBlockType(block) === "code", "not a code block");
62880
63110
  if (id === "wrap") {
62881
63111
  const old = editor.getBlockData(block);
62882
63112
  changeCodeBlockWrap(editor, block, !old.nowrap);
@@ -62902,7 +63132,7 @@ $$${mathData.mathjaxText}$$
62902
63132
  }
62903
63133
  });
62904
63134
  }).catch((err) => {
62905
- logger$1o.error(err.message);
63135
+ logger$1n.error(err.message);
62906
63136
  });
62907
63137
  return;
62908
63138
  }
@@ -62953,7 +63183,7 @@ $$${mathData.mathjaxText}$$
62953
63183
  }
62954
63184
  function getCodeBlockHeader(block) {
62955
63185
  const header = block.querySelector(".code-block-header");
62956
- assert(logger$1o, header, "no code block header");
63186
+ assert(logger$1n, header, "no code block header");
62957
63187
  return header;
62958
63188
  }
62959
63189
  function handleCodeScroll(editor, event) {
@@ -63002,7 +63232,7 @@ $$${mathData.mathjaxText}$$
63002
63232
  focusBlockId: textBlock.id
63003
63233
  };
63004
63234
  }
63005
- const logger$1n = getLogger("code-block");
63235
+ const logger$1m = getLogger("code-block");
63006
63236
  function getPaddingNum(index2) {
63007
63237
  if (index2 <= 2) {
63008
63238
  return 32;
@@ -63029,10 +63259,10 @@ $$${mathData.mathjaxText}$$
63029
63259
  handlePasteInTableEvent(editor);
63030
63260
  registerCodeBlockCommandProvider(editor);
63031
63261
  trackChildBlockEvent(editor, handleDebounceUpdate);
63032
- assert(logger$1n, blockData.type === "code", "invalid block data type");
63262
+ assert(logger$1m, blockData.type === "code", "invalid block data type");
63033
63263
  const codeData = blockData;
63034
- assert(logger$1n, codeData.children, "invalid block data children");
63035
- assert(logger$1n, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
63264
+ assert(logger$1m, codeData.children, "invalid block data children");
63265
+ assert(logger$1m, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
63036
63266
  setTimeout(() => {
63037
63267
  if (isNodeRemoved(blockElement))
63038
63268
  return;
@@ -63083,15 +63313,15 @@ $$${mathData.mathjaxText}$$
63083
63313
  }
63084
63314
  function updateSelection$3(editor, block, from, to) {
63085
63315
  if (from.isSimple()) {
63086
- assert(logger$1n, to.isSimple(), "from is simple position but to is not simple position");
63087
- logger$1n.debug("full select list");
63316
+ assert(logger$1m, to.isSimple(), "from is simple position but to is not simple position");
63317
+ logger$1m.debug("full select list");
63088
63318
  addClass(block, "full-selected");
63089
63319
  return;
63090
63320
  }
63091
- assert(logger$1n, !to.isSimple(), "from is complex position but end is simple position");
63321
+ assert(logger$1m, !to.isSimple(), "from is complex position but end is simple position");
63092
63322
  const f = from;
63093
63323
  const t2 = to;
63094
- assert(logger$1n, f.blockId === t2.blockId, "only allow update one table selection");
63324
+ assert(logger$1m, f.blockId === t2.blockId, "only allow update one table selection");
63095
63325
  const containers = getCodeChildContainers(block);
63096
63326
  containers.forEach((container) => {
63097
63327
  const containerId = getContainerId(container);
@@ -63126,8 +63356,8 @@ $$${mathData.mathjaxText}$$
63126
63356
  const containersIds = childContainers.map(getContainerId);
63127
63357
  const startIndex = containersIds.indexOf(start.childContainerId);
63128
63358
  const endIndex = containersIds.indexOf(end.childContainerId);
63129
- assert(logger$1n, startIndex !== -1, "invalid start pos");
63130
- assert(logger$1n, endIndex !== -1, "invalid end pos");
63359
+ assert(logger$1m, startIndex !== -1, "invalid start pos");
63360
+ assert(logger$1m, endIndex !== -1, "invalid end pos");
63131
63361
  const ret = [childContainers[startIndex]];
63132
63362
  if (startIndex !== endIndex) {
63133
63363
  ret.push(childContainers[endIndex]);
@@ -63135,7 +63365,7 @@ $$${mathData.mathjaxText}$$
63135
63365
  return ret;
63136
63366
  }
63137
63367
  function handleBlockElementUpdated(editor, block, blockData) {
63138
- assert(logger$1n, isCodeBlock(block), "invalid block type");
63368
+ assert(logger$1m, isCodeBlock(block), "invalid block type");
63139
63369
  const codeData = blockData;
63140
63370
  updateCodeBlockElementStyles(editor, block, codeData);
63141
63371
  }
@@ -63327,10 +63557,10 @@ ${codeText}
63327
63557
  "Shift+Tab": handleShiftTab$1,
63328
63558
  "CtrlOrCmd+A": selectCode
63329
63559
  };
63330
- const logger$1m = getLogger("code-text-decorate");
63560
+ const logger$1l = getLogger("code-text-decorate");
63331
63561
  class CodeTextDecorator {
63332
63562
  decorateText(editor, path, blockText) {
63333
- assert(logger$1m, path.length > 0, "invalid path");
63563
+ assert(logger$1l, path.length > 0, "invalid path");
63334
63564
  if (path.length === 1) {
63335
63565
  return {};
63336
63566
  }
@@ -63355,7 +63585,7 @@ ${codeText}
63355
63585
  const grammar = getPrismGrammar(codeData.language);
63356
63586
  const tokens = Prism__default.default.tokenize(code, grammar);
63357
63587
  const tokenToText = (token, attributes) => {
63358
- assert(logger$1m, token, "no token");
63588
+ assert(logger$1l, token, "no token");
63359
63589
  if (typeof token === "string") {
63360
63590
  const ret = {
63361
63591
  insert: token,
@@ -63363,7 +63593,7 @@ ${codeText}
63363
63593
  };
63364
63594
  return [ret];
63365
63595
  }
63366
- assert(logger$1m, token instanceof Prism__default.default.Token, "invalid token type");
63596
+ assert(logger$1l, token instanceof Prism__default.default.Token, "invalid token type");
63367
63597
  const content = token.content;
63368
63598
  const newAttributes = cloneDeep__default.default(attributes);
63369
63599
  newAttributes[`style-code-${token.type}`] = true;
@@ -63379,18 +63609,18 @@ ${codeText}
63379
63609
  const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
63380
63610
  return ret;
63381
63611
  }
63382
- assert(logger$1m, content instanceof Prism__default.default.Token, "invalid token");
63612
+ assert(logger$1l, content instanceof Prism__default.default.Token, "invalid token");
63383
63613
  return tokenToText(content, newAttributes);
63384
63614
  };
63385
63615
  const ops = tokens.map((token) => tokenToText(token, {}));
63386
63616
  const newText = ops.flat();
63387
- assert(logger$1m, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
63617
+ assert(logger$1l, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
63388
63618
  return {
63389
63619
  text: newText
63390
63620
  };
63391
63621
  }
63392
63622
  }
63393
- const zhCN$p = {
63623
+ const zhCN$o = {
63394
63624
  code: {
63395
63625
  title: "\u4EE3\u7801",
63396
63626
  abstract: "\u4EE3\u7801",
@@ -63402,7 +63632,7 @@ ${codeText}
63402
63632
  plainText: "Plain Text"
63403
63633
  }
63404
63634
  };
63405
- const enUS$p = {
63635
+ const enUS$o = {
63406
63636
  code: {
63407
63637
  title: "Code",
63408
63638
  abstract: "Code",
@@ -63414,7 +63644,7 @@ ${codeText}
63414
63644
  plainText: "Plain Text"
63415
63645
  }
63416
63646
  };
63417
- const jaJP$p = {
63647
+ const jaJP$o = {
63418
63648
  code: {
63419
63649
  title: "\u30B3\u30FC\u30C9",
63420
63650
  abstract: "\u30B3\u30FC\u30C9",
@@ -63427,9 +63657,9 @@ ${codeText}
63427
63657
  }
63428
63658
  };
63429
63659
  i18n$1.mergeLang({
63430
- "zh-CN": zhCN$p,
63431
- "en-US": enUS$p,
63432
- "ja-JP": jaJP$p
63660
+ "zh-CN": zhCN$o,
63661
+ "en-US": enUS$o,
63662
+ "ja-JP": jaJP$o
63433
63663
  });
63434
63664
  function convertToTable(editor, containerId, blockIndex, offset) {
63435
63665
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -63690,7 +63920,7 @@ ${codeText}
63690
63920
  }
63691
63921
  return false;
63692
63922
  }
63693
- const logger$1l = getLogger("match-text-style");
63923
+ const logger$1k = getLogger("match-text-style");
63694
63924
  function matchTextPair(text2, find) {
63695
63925
  if (text2.length < find.length * 2 + 1) {
63696
63926
  return -1;
@@ -63760,7 +63990,7 @@ ${codeText}
63760
63990
  editor.insertBoxToBlock(block, start, boxData);
63761
63991
  });
63762
63992
  } catch (err) {
63763
- logger$1l.warn(`failed to convert to box, ${err.message}`);
63993
+ logger$1k.warn(`failed to convert to box, ${err.message}`);
63764
63994
  continue;
63765
63995
  }
63766
63996
  }
@@ -63823,7 +64053,7 @@ ${codeText}
63823
64053
  return false;
63824
64054
  }
63825
64055
  }
63826
- const enUS$o = {
64056
+ const enUS$n = {
63827
64057
  placeholder: {
63828
64058
  default: "Type / for commands",
63829
64059
  heading: "Heading {heading}",
@@ -63834,7 +64064,7 @@ ${codeText}
63834
64064
  mobileDefault: "Type to add content"
63835
64065
  }
63836
64066
  };
63837
- const zhCN$o = {
64067
+ const zhCN$n = {
63838
64068
  placeholder: {
63839
64069
  default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
63840
64070
  heading: "\u6807\u9898{heading}",
@@ -63845,7 +64075,7 @@ ${codeText}
63845
64075
  mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
63846
64076
  }
63847
64077
  };
63848
- const jaJP$o = {
64078
+ const jaJP$n = {
63849
64079
  placeholder: {
63850
64080
  default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
63851
64081
  heading: "\u898B\u51FA\u3057{heading}",
@@ -63857,9 +64087,9 @@ ${codeText}
63857
64087
  }
63858
64088
  };
63859
64089
  const langs$1 = {
63860
- "en-US": enUS$o,
63861
- "zh-CN": zhCN$o,
63862
- "ja-JP": jaJP$o
64090
+ "en-US": enUS$n,
64091
+ "zh-CN": zhCN$n,
64092
+ "ja-JP": jaJP$n
63863
64093
  };
63864
64094
  i18n$1.mergeLang(langs$1);
63865
64095
  function isEmptyTextBlockWithoutCompositionText(editor, block) {
@@ -64026,7 +64256,7 @@ ${codeText}
64026
64256
  }
64027
64257
  return false;
64028
64258
  }
64029
- const logger$1k = getLogger("enforce-title");
64259
+ const logger$1j = getLogger("enforce-title");
64030
64260
  class EnforceWithDocumentTitleHandler {
64031
64261
  constructor(editor, options = {
64032
64262
  headingLevel: 1
@@ -64098,7 +64328,7 @@ ${codeText}
64098
64328
  var _a, _b;
64099
64329
  try {
64100
64330
  const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
64101
- assert(logger$1k, blocks.length > 0, "root container is empty");
64331
+ assert(logger$1j, blocks.length > 0, "root container is empty");
64102
64332
  const firstBlock = blocks[0];
64103
64333
  if (firstBlock.type !== "text" && !this.options.hideTitle) {
64104
64334
  const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
@@ -64107,7 +64337,7 @@ ${codeText}
64107
64337
  return;
64108
64338
  }
64109
64339
  if (!this.options.hideTitle) {
64110
- assert(logger$1k, firstBlock.text, "invalid text block");
64340
+ assert(logger$1j, firstBlock.text, "invalid text block");
64111
64341
  const block = editor.getBlockById(firstBlock.id);
64112
64342
  if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
64113
64343
  const text2 = editor.getBlockString(block);
@@ -64192,7 +64422,7 @@ ${codeText}
64192
64422
  });
64193
64423
  return orgDataUrl;
64194
64424
  }
64195
- const logger$1j = getLogger("drag-preview-image");
64425
+ const logger$1i = getLogger("drag-preview-image");
64196
64426
  class DragPreviewImage {
64197
64427
  constructor(editor) {
64198
64428
  __publicField(this, "startPosition", null);
@@ -64200,7 +64430,7 @@ ${codeText}
64200
64430
  __publicField(this, "handleDragStart", async (e2, preview) => {
64201
64431
  var _a, _b, _c, _d, _e, _f;
64202
64432
  const target = e2.target;
64203
- assert(logger$1j, target instanceof Element, `Invalid Drag target:${target}`);
64433
+ assert(logger$1i, target instanceof Element, `Invalid Drag target:${target}`);
64204
64434
  const { x: startX, y: startY } = e2;
64205
64435
  this.startPosition = {
64206
64436
  x: startX,
@@ -64286,7 +64516,7 @@ ${codeText}
64286
64516
  }
64287
64517
  return block;
64288
64518
  }
64289
- const logger$1i = getLogger("block-menu-drag-handler");
64519
+ const logger$1h = getLogger("block-menu-drag-handler");
64290
64520
  const MIN_DISTANCE_THRESHOLD$1 = 3;
64291
64521
  function createDragEventFromMouseEvent$2(event, type) {
64292
64522
  const dragEvent = new DragEvent(type, {
@@ -64308,7 +64538,7 @@ ${codeText}
64308
64538
  __publicField(this, "startPos", { x: 0, y: 0 });
64309
64539
  __publicField(this, "handleMouseDown", (event) => {
64310
64540
  const block = this.button.blockMenu.currentBlock;
64311
- assert(logger$1i, block, "no dragged block");
64541
+ assert(logger$1h, block, "no dragged block");
64312
64542
  if (event.button !== 0) {
64313
64543
  return;
64314
64544
  }
@@ -64336,7 +64566,7 @@ ${codeText}
64336
64566
  });
64337
64567
  }
64338
64568
  const block = this.button.blockMenu.currentBlock;
64339
- assert(logger$1i, block, "no dragged block");
64569
+ assert(logger$1h, block, "no dragged block");
64340
64570
  (_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
64341
64571
  const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
64342
64572
  registerStandardDraggedObject(this.editor, dragEvent, block);
@@ -64357,7 +64587,7 @@ ${codeText}
64357
64587
  if (!window.isDragging) {
64358
64588
  this.handleDragStart(event);
64359
64589
  }
64360
- assert(logger$1i, target instanceof Element, "target is invalid");
64590
+ assert(logger$1h, target instanceof Element, "target is invalid");
64361
64591
  this.dragPreview.handleDrag(event);
64362
64592
  const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
64363
64593
  this.editor.contentElement.dispatchEvent(dragEvent);
@@ -64365,7 +64595,7 @@ ${codeText}
64365
64595
  __publicField(this, "handleDragEnd", (event) => {
64366
64596
  var _a;
64367
64597
  const block = this.button.blockMenu.currentBlock;
64368
- assert(logger$1i, block, "no dragged block");
64598
+ assert(logger$1h, block, "no dragged block");
64369
64599
  window.isDragging = false;
64370
64600
  this.dragPreview.handleDragEnd();
64371
64601
  (_a = this.autoScroll) == null ? void 0 : _a.inactive();
@@ -64588,7 +64818,7 @@ ${codeText}
64588
64818
  this.rootButton.destroy();
64589
64819
  }
64590
64820
  }
64591
- const zhCN$n = {
64821
+ const zhCN$m = {
64592
64822
  blockMenu: {
64593
64823
  section: {
64594
64824
  basics: "\u57FA\u7840",
@@ -64612,7 +64842,7 @@ ${codeText}
64612
64842
  }
64613
64843
  }
64614
64844
  };
64615
- const enUS$n = {
64845
+ const enUS$m = {
64616
64846
  blockMenu: {
64617
64847
  section: {
64618
64848
  basics: "Basic",
@@ -64636,7 +64866,7 @@ ${codeText}
64636
64866
  }
64637
64867
  }
64638
64868
  };
64639
- const jaJP$n = {
64869
+ const jaJP$m = {
64640
64870
  blockMenu: {
64641
64871
  section: {
64642
64872
  basics: "\u4E00\u822C",
@@ -64661,9 +64891,9 @@ ${codeText}
64661
64891
  }
64662
64892
  };
64663
64893
  i18n$1.mergeLang({
64664
- "zh-CN": zhCN$n,
64665
- "en-US": enUS$n,
64666
- "ja-JP": jaJP$n
64894
+ "zh-CN": zhCN$m,
64895
+ "en-US": enUS$m,
64896
+ "ja-JP": jaJP$m
64667
64897
  });
64668
64898
  const style$6 = "";
64669
64899
  class DragData {
@@ -64743,7 +64973,7 @@ ${codeText}
64743
64973
  function clearDraggedObject(editor) {
64744
64974
  getDragData(editor).clearData();
64745
64975
  }
64746
- const logger$1h = getLogger("find-drop-target");
64976
+ const logger$1g = getLogger("find-drop-target");
64747
64977
  function childContainerFromPoint(x, y) {
64748
64978
  const elem = getElementFromPoint(x, y);
64749
64979
  if (!elem) {
@@ -64856,13 +65086,13 @@ ${codeText}
64856
65086
  return true;
64857
65087
  }
64858
65088
  const parentBlock = getParentBlock(container);
64859
- assert(logger$1h, parentBlock, "no parent block");
65089
+ assert(logger$1g, parentBlock, "no parent block");
64860
65090
  if (!editor.isBlockWritable(parentBlock)) {
64861
65091
  return false;
64862
65092
  }
64863
65093
  return canInsertAsSibling(editor, parentBlock);
64864
65094
  }
64865
- const logger$1g = getLogger("drop-target");
65095
+ const logger$1f = getLogger("drop-target");
64866
65096
  function getEmbedClassByFile(editor, file2) {
64867
65097
  let embedClass = {};
64868
65098
  if (/image/.test(file2.type)) {
@@ -64872,7 +65102,7 @@ ${codeText}
64872
65102
  } else if (/video/.test(file2.type)) {
64873
65103
  embedClass = editor.editorEmbeds.getEmbedClass("video");
64874
65104
  }
64875
- assert(logger$1g, embedClass, `unSupport file type ${file2.type}`);
65105
+ assert(logger$1f, embedClass, `unSupport file type ${file2.type}`);
64876
65106
  return embedClass;
64877
65107
  }
64878
65108
  async function patchInsertFile(editor, files, containerId, blockIndex) {
@@ -65622,7 +65852,7 @@ ${codeText}
65622
65852
  }
65623
65853
  }
65624
65854
  }
65625
- const zhCN$m = {
65855
+ const zhCN$l = {
65626
65856
  image: {
65627
65857
  title: "\u56FE\u7247",
65628
65858
  upload: {
@@ -65638,7 +65868,7 @@ ${codeText}
65638
65868
  abstract: "\u56FE\u7247"
65639
65869
  }
65640
65870
  };
65641
- const enUS$m = {
65871
+ const enUS$l = {
65642
65872
  image: {
65643
65873
  title: "Image",
65644
65874
  upload: {
@@ -65654,7 +65884,7 @@ ${codeText}
65654
65884
  abstract: "Image"
65655
65885
  }
65656
65886
  };
65657
- const jaJP$m = {
65887
+ const jaJP$l = {
65658
65888
  image: {
65659
65889
  title: "\u753B\u50CF",
65660
65890
  upload: {
@@ -65671,9 +65901,9 @@ ${codeText}
65671
65901
  }
65672
65902
  };
65673
65903
  i18n$1.mergeLang({
65674
- "zh-CN": zhCN$m,
65675
- "en-US": enUS$m,
65676
- "ja-JP": jaJP$m
65904
+ "zh-CN": zhCN$l,
65905
+ "en-US": enUS$l,
65906
+ "ja-JP": jaJP$l
65677
65907
  });
65678
65908
  function convertToImage(editor, containerId, blockIndex, offset) {
65679
65909
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -65727,7 +65957,7 @@ ${codeText}
65727
65957
  return false;
65728
65958
  }
65729
65959
  }
65730
- const logger$1f = getLogger("copy-image");
65960
+ const logger$1e = getLogger("copy-image");
65731
65961
  function getImageClipboardData(editor, img, imageObject, index2) {
65732
65962
  const imageData = imageObject.getImages()[index2];
65733
65963
  const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
@@ -65768,7 +65998,7 @@ ${codeText}
65768
65998
  });
65769
65999
  clipboardData["image/png"] = fileBlob;
65770
66000
  } catch (error2) {
65771
- logger$1f.error(error2);
66001
+ logger$1e.error(error2);
65772
66002
  }
65773
66003
  addMetaToDoc(editor, doc2);
65774
66004
  const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
@@ -66041,195 +66271,6 @@ ${codeText}
66041
66271
  }
66042
66272
  return getDragInsertPos(editor, block, images, x);
66043
66273
  }
66044
- const zhCN$l = {
66045
- embedProperties: {
66046
- edit: "\u7F16\u8F91",
66047
- addComment: "\u6DFB\u52A0\u6279\u6CE8"
66048
- }
66049
- };
66050
- const enUS$l = {
66051
- embedProperties: {
66052
- edit: "Edit",
66053
- addComment: "Add annotation"
66054
- }
66055
- };
66056
- const jaJP$l = {
66057
- embedProperties: {
66058
- edit: "\u7DE8\u96C6",
66059
- addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
66060
- }
66061
- };
66062
- i18n$1.mergeLang({
66063
- "zh-CN": zhCN$l,
66064
- "en-US": enUS$l,
66065
- "ja-JP": jaJP$l
66066
- });
66067
- const logger$1e = getLogger("embed-block-properties");
66068
- function addCommentToBlock(editor, block) {
66069
- var _a;
66070
- for (const hook of editor.blockHooks) {
66071
- const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
66072
- if (!commands) {
66073
- continue;
66074
- }
66075
- if (commands.group === "block-comment-actions") {
66076
- const command = commands.commands[0];
66077
- if (!command) {
66078
- continue;
66079
- }
66080
- commands.executeCommand(editor, block, commands.commands[0], null);
66081
- return true;
66082
- }
66083
- }
66084
- return false;
66085
- }
66086
- class StandardEmbedBlockCommands {
66087
- constructor(editor, block, properties) {
66088
- __publicField(this, "group", "hovering-toolbar");
66089
- __publicField(this, "_commands", [{
66090
- id: "edit",
66091
- name: i18n$1.t("embedProperties.edit"),
66092
- icon: EditIcon
66093
- }, {
66094
- id: "separator",
66095
- name: "",
66096
- type: "separator"
66097
- }]);
66098
- this.editor = editor;
66099
- this.block = block;
66100
- this.properties = properties;
66101
- }
66102
- get commands() {
66103
- var _a, _b, _c, _d;
66104
- if (clientType.isMobile) {
66105
- return [];
66106
- }
66107
- let standardCommands = [];
66108
- if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
66109
- this.properties.presetIds.forEach((id) => {
66110
- const command = this._commands.find((item) => item.id === id);
66111
- if (command) {
66112
- standardCommands.push(command);
66113
- }
66114
- });
66115
- }
66116
- if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
66117
- standardCommands.push(...this.properties.extCommands);
66118
- }
66119
- if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
66120
- standardCommands.push(...this.properties.extCommands(this.editor, this.block));
66121
- }
66122
- if ((_d = this.properties) == null ? void 0 : _d.extIds) {
66123
- this.properties.extIds.forEach((id) => {
66124
- const command = this._commands.find((item) => item.id === id);
66125
- if (command) {
66126
- standardCommands.push(command);
66127
- }
66128
- });
66129
- }
66130
- const { enableComments = true } = this.editor.options;
66131
- if (!enableComments || this.editor.readonly) {
66132
- standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
66133
- }
66134
- if (this.editor.readonly) {
66135
- standardCommands = standardCommands.filter((command) => command.id !== "edit");
66136
- }
66137
- standardCommands.forEach((item) => {
66138
- if (item.id === "add-comment" || item.id === "edit") {
66139
- item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
66140
- }
66141
- });
66142
- return standardCommands;
66143
- }
66144
- executeCommand(editor, block, item) {
66145
- var _a, _b;
66146
- if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
66147
- return;
66148
- }
66149
- if (item.id === "add-comment") {
66150
- if (!addCommentToBlock(editor, block)) {
66151
- logger$1e.error("failed to add comment to block");
66152
- }
66153
- return;
66154
- }
66155
- logger$1e.error(`unknown command: ${JSON.stringify(item)}`);
66156
- }
66157
- }
66158
- function getStandardEmbedBlockProperties(editor, block, properties) {
66159
- return {
66160
- blockCommands: {
66161
- "hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
66162
- }
66163
- };
66164
- }
66165
- class EmbedBlockResizer {
66166
- constructor(editor) {
66167
- __publicField(this, "resizing", false);
66168
- __publicField(this, "blockResizer");
66169
- __publicField(this, "handleResized", () => {
66170
- this.resizing = false;
66171
- });
66172
- __publicField(this, "handleResizing", (resizer, rect) => {
66173
- var _a, _b;
66174
- this.resizing = true;
66175
- const block = resizer.getBlock();
66176
- if (block) {
66177
- if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
66178
- return;
66179
- }
66180
- const blockType = getEmbedType(block);
66181
- const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
66182
- const height = Math.max(rect.height, adjustableMinHeight || 100);
66183
- const oldData = this.editor.getBlockData(block);
66184
- const oldEmbedData = oldData.embedData;
66185
- const newEmbedData = {
66186
- ...oldEmbedData,
66187
- height
66188
- };
66189
- this.editor.updateEmbedData(block, newEmbedData);
66190
- }
66191
- });
66192
- __publicField(this, "handleHoveringBlockChange", (block, old) => {
66193
- if (this.resizing) {
66194
- return;
66195
- }
66196
- if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
66197
- this.disableResizer();
66198
- }
66199
- if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
66200
- this.tryEnableResizer(block);
66201
- }
66202
- });
66203
- __publicField(this, "handleEditorResize", () => {
66204
- this.blockResizer.updateResizer();
66205
- });
66206
- this.editor = editor;
66207
- OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
66208
- this.blockResizer = new BlockResizer(this.editor, {
66209
- resize: ["bottom"]
66210
- });
66211
- this.blockResizer.addListener("resizing", this.handleResizing);
66212
- this.blockResizer.addListener("resized", this.handleResized);
66213
- this.editor.addListener("resize", this.handleEditorResize);
66214
- }
66215
- destroy() {
66216
- this.editor.removeListener("resize", this.handleEditorResize);
66217
- OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
66218
- }
66219
- tryEnableResizer(block) {
66220
- this.blockResizer.enableResize(block);
66221
- }
66222
- disableResizer() {
66223
- this.blockResizer.disableResize();
66224
- }
66225
- static get(editor) {
66226
- return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
66227
- }
66228
- static register(editor, block) {
66229
- addClass(block, "resizable");
66230
- return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
66231
- }
66232
- }
66233
66274
  class ImageHoveringToolbarCommands$1 {
66234
66275
  constructor(editor, block) {
66235
66276
  __publicField(this, "group", "hovering-toolbar");
@@ -66301,7 +66342,7 @@ ${codeText}
66301
66342
  executeCommand(editor, block, item) {
66302
66343
  switch (item.id) {
66303
66344
  case "addComment":
66304
- addCommentToBlock(editor, block);
66345
+ addCommentToBlock$1(editor, block);
66305
66346
  break;
66306
66347
  case "left":
66307
66348
  case "center":
@@ -67617,7 +67658,7 @@ ${codeText}
67617
67658
  });
67618
67659
  });
67619
67660
  __publicField(this, "handleEditorResize", () => {
67620
- this.updateItemsLayout();
67661
+ this.updateItemsLayout(false);
67621
67662
  });
67622
67663
  __publicField(this, "handleDocChanged", () => {
67623
67664
  this.updateComments();
@@ -67694,9 +67735,11 @@ ${codeText}
67694
67735
  this.removeAllListeners();
67695
67736
  document.removeEventListener("click", this.handleDocumentClick);
67696
67737
  }
67697
- updateItemsLayout() {
67738
+ updateItemsLayout(dispatchScroll = true) {
67698
67739
  arrangeItems(this.editor, this.items, this.activeItem);
67699
- this.dispatchScroll();
67740
+ if (dispatchScroll) {
67741
+ this.dispatchScroll();
67742
+ }
67700
67743
  }
67701
67744
  bindEvents() {
67702
67745
  this.container.addEventListener("click", this.handleContainerClick);
@@ -68563,7 +68606,7 @@ ${codeText}
68563
68606
  const types2 = ["table", "layout"];
68564
68607
  if (types2.includes(getBlockType(block))) {
68565
68608
  editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
68566
- comment = addCommentToBlock$1(editor, block, this.provider);
68609
+ comment = addCommentToBlock(editor, block, this.provider);
68567
68610
  }
68568
68611
  }
68569
68612
  comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
@@ -68584,7 +68627,7 @@ ${codeText}
68584
68627
  try {
68585
68628
  this.editorComments.showCommentList();
68586
68629
  const block2 = editor.getBlockById(blockId);
68587
- addCommentToBlock$1(editor, block2, this.provider);
68630
+ addCommentToBlock(editor, block2, this.provider);
68588
68631
  } catch (err) {
68589
68632
  logger$13.error(`failed to execute block command: ${JSON.stringify(err)}`);
68590
68633
  }
@@ -68593,14 +68636,24 @@ ${codeText}
68593
68636
  this.editorComments = editorComments;
68594
68637
  }
68595
68638
  commands(editor, blockElement, child) {
68596
- var _a;
68597
- if (editor.readonly) {
68639
+ if (editor.readonly || clientType.isMobile) {
68598
68640
  return void 0;
68599
68641
  }
68600
68642
  const data2 = getBlockId(blockElement);
68601
68643
  if (child) {
68602
- const whitList = ["file"];
68603
- if (isTextBlockContentBoxChild(child) && whitList.includes((_a = child.getAttribute("data-box-type")) != null ? _a : "")) {
68644
+ const showCommandsBar = (child2) => {
68645
+ var _a, _b, _c;
68646
+ if (!child2 || !isTextBlockContentBoxChild(child2)) {
68647
+ return false;
68648
+ }
68649
+ const box = child2;
68650
+ const boxCommands = (_b = (_a = editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.getBoxProperties) == null ? void 0 : _b.call(_a, editor, box).boxCommands;
68651
+ if (!boxCommands) {
68652
+ return false;
68653
+ }
68654
+ return ((_c = boxCommands["hovering-toolbar"]) == null ? void 0 : _c.commands.length) > 0;
68655
+ };
68656
+ if (showCommandsBar(child)) {
68604
68657
  return {
68605
68658
  group: "hovering-toolbar",
68606
68659
  commands: [
@@ -68920,11 +68973,11 @@ ${codeText}
68920
68973
  const { containerId } = path[path.length - 1];
68921
68974
  const targetBlock = getParentBlock(getContainerById(editor, containerId));
68922
68975
  if (targetBlock && getBlockType(targetBlock) === "code") {
68923
- addCommentToBlock$1(editor, targetBlock, editorComments.commentProvider);
68976
+ addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
68924
68977
  return;
68925
68978
  }
68926
68979
  }
68927
- addCommentToBlock$1(editor, block, editorComments.commentProvider);
68980
+ addCommentToBlock(editor, block, editorComments.commentProvider);
68928
68981
  return;
68929
68982
  }
68930
68983
  const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
@@ -69160,7 +69213,7 @@ ${codeText}
69160
69213
  editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
69161
69214
  const editorComments = editor2.getCustom("editor-comments");
69162
69215
  editorComments.showCommentList();
69163
- addCommentToBlock$1(editor2, block, editorComments.commentProvider);
69216
+ addCommentToBlock(editor2, block, editorComments.commentProvider);
69164
69217
  }
69165
69218
  }
69166
69219
  };
@@ -69197,7 +69250,7 @@ ${codeText}
69197
69250
  const selectedBlock = range.getSelectedBlocks()[0];
69198
69251
  if (selectedBlock) {
69199
69252
  const editorComments = editor.getCustom("editor-comments");
69200
- addCommentToBlock$1(editor, selectedBlock.block, editorComments.commentProvider);
69253
+ addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
69201
69254
  }
69202
69255
  return;
69203
69256
  }
@@ -76455,7 +76508,7 @@ ${content}
76455
76508
  } else if (item.id === "download") {
76456
76509
  downloadFile$1(editor, box);
76457
76510
  } else if (item.id === "add-comment") {
76458
- addCommentToBlock(editor, block);
76511
+ addCommentToBlock$1(editor, block);
76459
76512
  }
76460
76513
  }
76461
76514
  }
@@ -76747,7 +76800,7 @@ ${content}
76747
76800
  } else if (item.id === "download") {
76748
76801
  downloadFile(editor, block);
76749
76802
  } else if (item.id === "add-comment") {
76750
- addCommentToBlock(editor, block);
76803
+ addCommentToBlock$1(editor, block);
76751
76804
  }
76752
76805
  }
76753
76806
  }
@@ -86254,7 +86307,7 @@ ${data2.flowchartText}
86254
86307
  executeCommand(editor, block, item) {
86255
86308
  switch (item.id) {
86256
86309
  case "addComment":
86257
- addCommentToBlock(editor, block);
86310
+ addCommentToBlock$1(editor, block);
86258
86311
  break;
86259
86312
  case "left":
86260
86313
  case "center":
@@ -88286,7 +88339,7 @@ ${data2.flowchartText}
88286
88339
  }
88287
88340
  }
88288
88341
  });
88289
- editor.version = "2.2.12";
88342
+ editor.version = "2.2.13-beta.2";
88290
88343
  return editor;
88291
88344
  }
88292
88345
  function isDoc(doc2) {
@@ -88381,7 +88434,7 @@ ${data2.flowchartText}
88381
88434
  });
88382
88435
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88383
88436
  OnesEditorToolbar.register(editor);
88384
- editor.version = "2.2.12";
88437
+ editor.version = "2.2.13-beta.2";
88385
88438
  return editor;
88386
88439
  }
88387
88440
  async function showDocVersions(editor, options, serverUrl) {
@@ -134225,6 +134278,7 @@ ${data2.flowchartText}
134225
134278
  exports2.ShareDBLocalDoc = ShareDBLocalDoc;
134226
134279
  exports2.ShareDBServer = ShareDBServer;
134227
134280
  exports2.SimpleCache = SimpleCache;
134281
+ exports2.StandardBoxCommands = StandardBoxCommands;
134228
134282
  exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
134229
134283
  exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
134230
134284
  exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
@@ -134243,7 +134297,7 @@ ${data2.flowchartText}
134243
134297
  exports2.addAttribute = addAttribute;
134244
134298
  exports2.addClass = addClass;
134245
134299
  exports2.addColor = addColor;
134246
- exports2.addCommentToBlock = addCommentToBlock;
134300
+ exports2.addCommentToBlock = addCommentToBlock$1;
134247
134301
  exports2.addDays = addDays;
134248
134302
  exports2.addMetaToDoc = addMetaToDoc;
134249
134303
  exports2.addMonths = addMonths;