@ones-editor/editor 2.2.12-beta.3 → 2.2.13-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -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);
@@ -46936,7 +46959,413 @@ ${codeText}
46936
46959
  }
46937
46960
  return rects[0];
46938
46961
  }
46939
- const logger$24 = getLogger("exclusive-block");
46962
+ const zhCN$v = {
46963
+ embedProperties: {
46964
+ edit: "\u7F16\u8F91",
46965
+ addComment: "\u6DFB\u52A0\u6279\u6CE8"
46966
+ }
46967
+ };
46968
+ const enUS$v = {
46969
+ embedProperties: {
46970
+ edit: "Edit",
46971
+ addComment: "Add annotation"
46972
+ }
46973
+ };
46974
+ const jaJP$v = {
46975
+ embedProperties: {
46976
+ edit: "\u7DE8\u96C6",
46977
+ addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
46978
+ }
46979
+ };
46980
+ i18n$1.mergeLang({
46981
+ "zh-CN": zhCN$v,
46982
+ "en-US": enUS$v,
46983
+ "ja-JP": jaJP$v
46984
+ });
46985
+ const logger$24 = getLogger("embed-block-properties");
46986
+ function addCommentToBlock$1(editor, block) {
46987
+ var _a;
46988
+ for (const hook of editor.blockHooks) {
46989
+ const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
46990
+ if (!commands) {
46991
+ continue;
46992
+ }
46993
+ if (commands.group === "block-comment-actions") {
46994
+ const command = commands.commands[0];
46995
+ if (!command) {
46996
+ continue;
46997
+ }
46998
+ commands.executeCommand(editor, block, commands.commands[0], null);
46999
+ return true;
47000
+ }
47001
+ }
47002
+ return false;
47003
+ }
47004
+ class StandardEmbedBlockCommands {
47005
+ constructor(editor, block, properties) {
47006
+ __publicField(this, "group", "hovering-toolbar");
47007
+ __publicField(this, "_commands", [{
47008
+ id: "edit",
47009
+ name: i18n$1.t("embedProperties.edit"),
47010
+ icon: EditIcon
47011
+ }, {
47012
+ id: "separator",
47013
+ name: "",
47014
+ type: "separator"
47015
+ }]);
47016
+ this.editor = editor;
47017
+ this.block = block;
47018
+ this.properties = properties;
47019
+ }
47020
+ get commands() {
47021
+ var _a, _b, _c, _d;
47022
+ if (clientType.isMobile) {
47023
+ return [];
47024
+ }
47025
+ let standardCommands = [];
47026
+ if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
47027
+ this.properties.presetIds.forEach((id) => {
47028
+ const command = this._commands.find((item) => item.id === id);
47029
+ if (command) {
47030
+ standardCommands.push(command);
47031
+ }
47032
+ });
47033
+ }
47034
+ if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
47035
+ standardCommands.push(...this.properties.extCommands);
47036
+ }
47037
+ if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
47038
+ standardCommands.push(...this.properties.extCommands(this.editor, this.block));
47039
+ }
47040
+ if ((_d = this.properties) == null ? void 0 : _d.extIds) {
47041
+ this.properties.extIds.forEach((id) => {
47042
+ const command = this._commands.find((item) => item.id === id);
47043
+ if (command) {
47044
+ standardCommands.push(command);
47045
+ }
47046
+ });
47047
+ }
47048
+ const { enableComments = true } = this.editor.options;
47049
+ if (!enableComments || this.editor.readonly) {
47050
+ standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
47051
+ }
47052
+ if (this.editor.readonly) {
47053
+ standardCommands = standardCommands.filter((command) => command.id !== "edit");
47054
+ }
47055
+ standardCommands.forEach((item) => {
47056
+ if (item.id === "add-comment" || item.id === "edit") {
47057
+ item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
47058
+ }
47059
+ });
47060
+ return standardCommands;
47061
+ }
47062
+ executeCommand(editor, block, item) {
47063
+ var _a, _b;
47064
+ if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
47065
+ return;
47066
+ }
47067
+ if (item.id === "add-comment") {
47068
+ if (!addCommentToBlock$1(editor, block)) {
47069
+ logger$24.error("failed to add comment to block");
47070
+ }
47071
+ return;
47072
+ }
47073
+ logger$24.error(`unknown command: ${JSON.stringify(item)}`);
47074
+ }
47075
+ }
47076
+ function getStandardEmbedBlockProperties(editor, block, properties) {
47077
+ return {
47078
+ blockCommands: {
47079
+ "hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
47080
+ }
47081
+ };
47082
+ }
47083
+ function createResizeGripper(parent, type) {
47084
+ const elem = createElement("div", ["resize-gripper", type], parent);
47085
+ elem.setAttribute("data-resize-type", type);
47086
+ }
47087
+ function getExistsResizer(block) {
47088
+ const tools = getBlockTools(block);
47089
+ return tools.querySelector(".block-resizer");
47090
+ }
47091
+ function hideResizer(block) {
47092
+ const exists = getExistsResizer(block);
47093
+ if (exists) {
47094
+ removeClass(exists, "active");
47095
+ }
47096
+ }
47097
+ function updateSize(block, element, resizer) {
47098
+ const blockRect = block.getBoundingClientRect();
47099
+ const elementRect = element.getBoundingClientRect();
47100
+ const top = elementRect.top - blockRect.top;
47101
+ const left = elementRect.left - blockRect.left;
47102
+ const width = elementRect.width;
47103
+ const height = elementRect.height;
47104
+ resizer.style.top = `${top}px`;
47105
+ resizer.style.left = `${left}px`;
47106
+ resizer.style.width = `${width}px`;
47107
+ resizer.style.height = `${height}px`;
47108
+ }
47109
+ function createResizer(block, element, options, mouseDownEvent) {
47110
+ const exists = getExistsResizer(block);
47111
+ if (exists) {
47112
+ addClass(exists, "active");
47113
+ updateSize(block, element, exists);
47114
+ return exists;
47115
+ }
47116
+ const tools = getBlockTools(block);
47117
+ const resizer = createElement("div", ["block-resizer"], tools);
47118
+ updateSize(block, element, resizer);
47119
+ options.resize.forEach((type) => {
47120
+ createResizeGripper(resizer, type);
47121
+ });
47122
+ resizer.addEventListener("mousedown", mouseDownEvent);
47123
+ addClass(resizer, "active");
47124
+ return resizer;
47125
+ }
47126
+ function updateResizer(block, element) {
47127
+ const resizer = getExistsResizer(block);
47128
+ if (!resizer) {
47129
+ return;
47130
+ }
47131
+ if (!isChildNode(block, element)) {
47132
+ return;
47133
+ }
47134
+ const blockRect = block.getBoundingClientRect();
47135
+ const elementRect = element.getBoundingClientRect();
47136
+ const top = elementRect.top - blockRect.top;
47137
+ const left = elementRect.left - blockRect.left;
47138
+ const width = elementRect.width;
47139
+ const height = elementRect.height;
47140
+ resizer.style.top = `${top}px`;
47141
+ resizer.style.left = `${left}px`;
47142
+ resizer.style.width = `${width}px`;
47143
+ resizer.style.height = `${height}px`;
47144
+ }
47145
+ const style$a = "";
47146
+ const logger$23 = getLogger("block-resizer");
47147
+ class BlockResizer extends tinyTypedEmitter.TypedEmitter {
47148
+ constructor(editor, options) {
47149
+ super();
47150
+ __publicField(this, "resizableElement");
47151
+ __publicField(this, "block", null);
47152
+ __publicField(this, "startRect", null);
47153
+ __publicField(this, "startPos", null);
47154
+ __publicField(this, "resizeType", null);
47155
+ __publicField(this, "enabled", false);
47156
+ __publicField(this, "handleEditorResize", () => {
47157
+ if (this.block) {
47158
+ this.updateResizer();
47159
+ }
47160
+ });
47161
+ __publicField(this, "handleMouseDown", (event) => {
47162
+ event.preventDefault();
47163
+ event.stopPropagation();
47164
+ const element = this.getResizableElement();
47165
+ if (!element) {
47166
+ return;
47167
+ }
47168
+ if (event.button !== 0) {
47169
+ return;
47170
+ }
47171
+ const gripper = event.target;
47172
+ if (!gripper) {
47173
+ return;
47174
+ }
47175
+ if (!(gripper instanceof HTMLElement)) {
47176
+ return;
47177
+ }
47178
+ const resizeType = gripper.getAttribute("data-resize-type");
47179
+ if (!resizeType) {
47180
+ return;
47181
+ }
47182
+ this.bindEvents();
47183
+ this.startRect = element.getBoundingClientRect();
47184
+ this.startPos = event;
47185
+ this.resizeType = resizeType;
47186
+ setDefaultCursor(window.getComputedStyle(gripper).cursor);
47187
+ if (this.block) {
47188
+ this.editor.selection.selectBlock(this.block, 0);
47189
+ }
47190
+ });
47191
+ __publicField(this, "handleMouseMove", (event) => {
47192
+ if (!this.startPos || !this.startRect || !this.resizeType) {
47193
+ return;
47194
+ }
47195
+ const element = this.getResizableElement();
47196
+ if (!element || !this.block) {
47197
+ return;
47198
+ }
47199
+ const deltaX = event.x - this.startPos.x;
47200
+ const deltaY = event.y - this.startPos.y;
47201
+ const oldRect = this.startRect;
47202
+ let { top, left, right, bottom } = oldRect;
47203
+ if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
47204
+ bottom += deltaY;
47205
+ }
47206
+ if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
47207
+ top += deltaY;
47208
+ }
47209
+ if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
47210
+ left += deltaX;
47211
+ }
47212
+ if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
47213
+ right += deltaX;
47214
+ }
47215
+ const width = right > left ? right - left : 0;
47216
+ const height = bottom > top ? bottom - top : 0;
47217
+ const newRect = new DOMRect(left, top, width, height);
47218
+ this.emit("resizing", this, newRect);
47219
+ const newElement = this.getResizableElement();
47220
+ if (newElement) {
47221
+ updateResizer(this.block, newElement);
47222
+ }
47223
+ });
47224
+ __publicField(this, "handleMouseUp", (event) => {
47225
+ if (event.button !== 0) {
47226
+ return;
47227
+ }
47228
+ setDefaultCursor("");
47229
+ this.unbindEvents();
47230
+ this.emit("resized", this);
47231
+ const element = this.getResizableElement();
47232
+ if (!element || !this.block) {
47233
+ return;
47234
+ }
47235
+ updateResizer(this.block, element);
47236
+ });
47237
+ this.editor = editor;
47238
+ this.options = options;
47239
+ this.editor.addListener("resize", this.handleEditorResize);
47240
+ }
47241
+ enableResize(block, resizableElement) {
47242
+ this.block = block;
47243
+ this.resizableElement = resizableElement;
47244
+ this.createResizer();
47245
+ this.enabled = true;
47246
+ }
47247
+ disableResize() {
47248
+ if (!this.block) {
47249
+ return;
47250
+ }
47251
+ hideResizer(this.block);
47252
+ this.enabled = false;
47253
+ }
47254
+ update(block, resizableElement) {
47255
+ this.block = block;
47256
+ this.resizableElement = resizableElement;
47257
+ const elem = this.getResizableElement();
47258
+ if (elem && this.enabled) {
47259
+ this.createResizer();
47260
+ }
47261
+ }
47262
+ updateResizer() {
47263
+ const newElement = this.getResizableElement();
47264
+ if (newElement && this.block) {
47265
+ updateResizer(this.block, newElement);
47266
+ }
47267
+ }
47268
+ getBlock() {
47269
+ return this.block;
47270
+ }
47271
+ destroy() {
47272
+ this.editor.removeListener("resize", this.handleEditorResize);
47273
+ }
47274
+ getResizableElement() {
47275
+ if (this.resizableElement) {
47276
+ return this.resizableElement;
47277
+ }
47278
+ if (!this.block) {
47279
+ return null;
47280
+ }
47281
+ return getBlockContent(this.block);
47282
+ }
47283
+ createResizer() {
47284
+ const element = this.getResizableElement();
47285
+ if (!element || !this.block) {
47286
+ return;
47287
+ }
47288
+ assert(logger$23, isChildNode(this.block, element), "not a block child element");
47289
+ createResizer(this.block, element, this.options, this.handleMouseDown);
47290
+ }
47291
+ bindEvents() {
47292
+ document.addEventListener("mousemove", this.handleMouseMove);
47293
+ document.addEventListener("mouseup", this.handleMouseUp);
47294
+ }
47295
+ unbindEvents() {
47296
+ document.removeEventListener("mousemove", this.handleMouseMove);
47297
+ document.removeEventListener("mouseup", this.handleMouseUp);
47298
+ }
47299
+ }
47300
+ class EmbedBlockResizer {
47301
+ constructor(editor) {
47302
+ __publicField(this, "resizing", false);
47303
+ __publicField(this, "blockResizer");
47304
+ __publicField(this, "handleResized", () => {
47305
+ this.resizing = false;
47306
+ });
47307
+ __publicField(this, "handleResizing", (resizer, rect) => {
47308
+ var _a, _b;
47309
+ this.resizing = true;
47310
+ const block = resizer.getBlock();
47311
+ if (block) {
47312
+ if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
47313
+ return;
47314
+ }
47315
+ const blockType = getEmbedType(block);
47316
+ const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
47317
+ const height = Math.max(rect.height, adjustableMinHeight || 100);
47318
+ const oldData = this.editor.getBlockData(block);
47319
+ const oldEmbedData = oldData.embedData;
47320
+ const newEmbedData = {
47321
+ ...oldEmbedData,
47322
+ height
47323
+ };
47324
+ this.editor.updateEmbedData(block, newEmbedData);
47325
+ }
47326
+ });
47327
+ __publicField(this, "handleHoveringBlockChange", (block, old) => {
47328
+ if (this.resizing) {
47329
+ return;
47330
+ }
47331
+ if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
47332
+ this.disableResizer();
47333
+ }
47334
+ if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
47335
+ this.tryEnableResizer(block);
47336
+ }
47337
+ });
47338
+ __publicField(this, "handleEditorResize", () => {
47339
+ this.blockResizer.updateResizer();
47340
+ });
47341
+ this.editor = editor;
47342
+ OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
47343
+ this.blockResizer = new BlockResizer(this.editor, {
47344
+ resize: ["bottom"]
47345
+ });
47346
+ this.blockResizer.addListener("resizing", this.handleResizing);
47347
+ this.blockResizer.addListener("resized", this.handleResized);
47348
+ this.editor.addListener("resize", this.handleEditorResize);
47349
+ }
47350
+ destroy() {
47351
+ this.editor.removeListener("resize", this.handleEditorResize);
47352
+ OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
47353
+ }
47354
+ tryEnableResizer(block) {
47355
+ this.blockResizer.enableResize(block);
47356
+ }
47357
+ disableResizer() {
47358
+ this.blockResizer.disableResize();
47359
+ }
47360
+ static get(editor) {
47361
+ return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
47362
+ }
47363
+ static register(editor, block) {
47364
+ addClass(block, "resizable");
47365
+ return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
47366
+ }
47367
+ }
47368
+ const logger$22 = getLogger("exclusive-block");
46940
47369
  function addExclusiveStyle(editor, block, userId, displayName) {
46941
47370
  var _a;
46942
47371
  addClass(block, "block-exclusive");
@@ -46954,7 +47383,7 @@ ${codeText}
46954
47383
  block.removeAttribute("data-exclusive-tips");
46955
47384
  }
46956
47385
  function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
46957
- logger$24.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
47386
+ logger$22.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
46958
47387
  if (exclusive) {
46959
47388
  addExclusiveStyle(editor, block, userId, displayName);
46960
47389
  } else {
@@ -47111,28 +47540,28 @@ ${codeText}
47111
47540
  }
47112
47541
  }
47113
47542
  const exclusiveBlockStyles = "";
47114
- const zhCN$v = {
47543
+ const zhCN$u = {
47115
47544
  exclusive: {
47116
47545
  tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
47117
47546
  fallbackAbstract: "\u8BE5 Block"
47118
47547
  }
47119
47548
  };
47120
- const enUS$v = {
47549
+ const enUS$u = {
47121
47550
  exclusive: {
47122
47551
  tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
47123
47552
  fallbackAbstract: "This Block"
47124
47553
  }
47125
47554
  };
47126
- const jaJP$v = {
47555
+ const jaJP$u = {
47127
47556
  exclusive: {
47128
47557
  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
47558
  fallbackAbstract: "\u3053\u306E\u8981\u7D20"
47130
47559
  }
47131
47560
  };
47132
47561
  i18n$1.mergeLang({
47133
- "zh-CN": zhCN$v,
47134
- "en-US": enUS$v,
47135
- "ja-JP": jaJP$v
47562
+ "zh-CN": zhCN$u,
47563
+ "en-US": enUS$u,
47564
+ "ja-JP": jaJP$u
47136
47565
  });
47137
47566
  function getBlockInfo(editor, block) {
47138
47567
  const data2 = editor.getBlockData(block);
@@ -47308,22 +47737,22 @@ ${codeText}
47308
47737
  };
47309
47738
  }
47310
47739
  }
47311
- const style$a = "";
47312
- const zhCN$u = {
47740
+ const style$9 = "";
47741
+ const zhCN$t = {
47313
47742
  locker: {
47314
47743
  lock: "\u9501\u5B9A",
47315
47744
  unlock: "\u89E3\u9664\u9501\u5B9A",
47316
47745
  lockedBy: "\u88AB {name} \u9501\u5B9A"
47317
47746
  }
47318
47747
  };
47319
- const enUS$u = {
47748
+ const enUS$t = {
47320
47749
  locker: {
47321
47750
  lock: "Lock",
47322
47751
  unlock: "Unlock",
47323
47752
  lockedBy: "Locked by {name}"
47324
47753
  }
47325
47754
  };
47326
- const jaJP$u = {
47755
+ const jaJP$t = {
47327
47756
  locker: {
47328
47757
  lock: "\u30ED\u30C3\u30AF",
47329
47758
  unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
@@ -47331,9 +47760,9 @@ ${codeText}
47331
47760
  }
47332
47761
  };
47333
47762
  i18n$1.mergeLang({
47334
- "zh-CN": zhCN$u,
47335
- "en-US": enUS$u,
47336
- "ja-JP": jaJP$u
47763
+ "zh-CN": zhCN$t,
47764
+ "en-US": enUS$t,
47765
+ "ja-JP": jaJP$t
47337
47766
  });
47338
47767
  class BlockLockerPasteHandler {
47339
47768
  async handleBeforePasteDoc(editor, doc2) {
@@ -47345,7 +47774,7 @@ ${codeText}
47345
47774
  return false;
47346
47775
  }
47347
47776
  }
47348
- const logger$23 = getLogger("context-menu-utils");
47777
+ const logger$21 = getLogger("context-menu-utils");
47349
47778
  function blobToString(blob) {
47350
47779
  return new Promise((resolve, reject) => {
47351
47780
  const reader = new FileReader();
@@ -47366,7 +47795,7 @@ ${codeText}
47366
47795
  const types2 = items[0].types;
47367
47796
  return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
47368
47797
  } catch (error2) {
47369
- logger$23.warn(`Failed to read clipboard data: ${error2}`);
47798
+ logger$21.warn(`Failed to read clipboard data: ${error2}`);
47370
47799
  return true;
47371
47800
  }
47372
47801
  }
@@ -47415,7 +47844,7 @@ ${codeText}
47415
47844
  }
47416
47845
  return dataTransfer;
47417
47846
  }
47418
- const logger$22 = getLogger("ClipboardProvider");
47847
+ const logger$20 = getLogger("ClipboardProvider");
47419
47848
  class ClipboardProvider {
47420
47849
  constructor(editor, options) {
47421
47850
  __publicField(this, "id", "ClipboardProvider");
@@ -47501,7 +47930,7 @@ ${codeText}
47501
47930
  }
47502
47931
  }).catch((err) => {
47503
47932
  this.clipboardPermission.read = "denied";
47504
- logger$22.log(err);
47933
+ logger$20.log(err);
47505
47934
  });
47506
47935
  } catch (error2) {
47507
47936
  this.clipboardPermission = {
@@ -47562,13 +47991,14 @@ ${codeText}
47562
47991
  }
47563
47992
  }
47564
47993
  class StandardBoxCommands {
47565
- constructor(editor) {
47994
+ constructor(editor, extIds) {
47566
47995
  __publicField(this, "group", "standard-box-commands");
47567
47996
  __publicField(this, "providers", []);
47568
47997
  this.editor = editor;
47569
- if (clientType.isMobile) {
47570
- this.providers.push(new ClipboardProvider(this.editor, { withPaste: false }));
47571
- }
47998
+ this.extIds = extIds;
47999
+ }
48000
+ addProvider(provider) {
48001
+ this.providers.push(provider);
47572
48002
  }
47573
48003
  get commands() {
47574
48004
  if (this.editor.readonly) {
@@ -47576,8 +48006,17 @@ ${codeText}
47576
48006
  }
47577
48007
  const items = [];
47578
48008
  const focusedBlock = this.editor.selection.focusedBlock;
48009
+ const hoveringTextChild = OnesEditorHoveringBlock.get(this.editor).hoveringTextChild;
47579
48010
  for (const provider of this.providers) {
47580
- items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
48011
+ items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range, { child: hoveringTextChild }));
48012
+ }
48013
+ for (const extId of this.extIds || []) {
48014
+ if (extId === "separator") {
48015
+ items.push({ id: "sep", name: "", type: "separator" });
48016
+ }
48017
+ if (extId === "add-comment") {
48018
+ items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
48019
+ }
47581
48020
  }
47582
48021
  return items;
47583
48022
  }
@@ -47586,19 +48025,27 @@ ${codeText}
47586
48025
  const { start, end } = getChildOffset(block, box);
47587
48026
  const range = createBlockSimpleRange(editor, block, start, end);
47588
48027
  for (const provider of this.providers) {
47589
- if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
48028
+ if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, { child: box })) {
47590
48029
  return;
47591
48030
  }
47592
- if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
48031
+ if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, { child: box })) {
47593
48032
  return;
47594
48033
  }
47595
48034
  }
48035
+ if (item.id === "add-comment") {
48036
+ addCommentToBlock$1(editor, block);
48037
+ }
48038
+ }
48039
+ static create(editor, extIds) {
48040
+ return new StandardBoxCommands(editor, extIds);
47596
48041
  }
47597
- static create(editor) {
47598
- return new StandardBoxCommands(editor);
48042
+ static mobileCreate(editor, extIds) {
48043
+ const instance = new StandardBoxCommands(editor, extIds);
48044
+ instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
48045
+ return instance;
47599
48046
  }
47600
48047
  }
47601
- const logger$21 = getLogger("object-commands");
48048
+ const logger$1$ = getLogger("object-commands");
47602
48049
  const SEP$1 = {
47603
48050
  id: "",
47604
48051
  name: "",
@@ -47654,7 +48101,7 @@ ${codeText}
47654
48101
  let element = null;
47655
48102
  const commands = [];
47656
48103
  if (clientType.isMobile && child && isBox(child)) {
47657
- boxCommands.push(new StandardBoxCommands(editor));
48104
+ boxCommands.push(StandardBoxCommands.mobileCreate(editor));
47658
48105
  }
47659
48106
  if (boxCommands.length > 0) {
47660
48107
  element = child;
@@ -47666,7 +48113,7 @@ ${codeText}
47666
48113
  if (blockCommands.length > 0) {
47667
48114
  for (let i = 0; i < blockCommands.length; i++) {
47668
48115
  const blockCommand = blockCommands[i];
47669
- element = element || targetElement || null;
48116
+ element = blockCommand.element || element || targetElement || null;
47670
48117
  commands.push(...blockCommand.commands);
47671
48118
  }
47672
48119
  }
@@ -47684,10 +48131,10 @@ ${codeText}
47684
48131
  const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
47685
48132
  const { boxCommands, blockCommands } = result;
47686
48133
  if (clientType.isMobile && child && isBox(child)) {
47687
- boxCommands.push(new StandardBoxCommands(editor));
48134
+ boxCommands.push(StandardBoxCommands.mobileCreate(editor));
47688
48135
  }
47689
48136
  if (boxCommands.length > 0) {
47690
- assert(logger$21, child, "child is null");
48137
+ assert(logger$1$, child, "child is null");
47691
48138
  for (let i = 0; i < boxCommands.length; i++) {
47692
48139
  if (boxCommands[i].commands.find((c) => c.id === item.id)) {
47693
48140
  boxCommands[i].executeCommand(editor, block, child, item);
@@ -47954,18 +48401,18 @@ ${codeText}
47954
48401
  }
47955
48402
  }
47956
48403
  const LIST_MAX_LEVEL = 8;
47957
- const logger$20 = getLogger("list-block");
47958
- const logger$1$ = getLogger("list-block");
48404
+ const logger$1_ = getLogger("list-block");
48405
+ const logger$1Z = getLogger("list-block");
47959
48406
  function isListBlock(block) {
47960
48407
  return getBlockType(block) === "list";
47961
48408
  }
47962
48409
  function ensureIsListBlock(block) {
47963
- assert(logger$1$, isListBlock(block), "not a list block");
48410
+ assert(logger$1Z, isListBlock(block), "not a list block");
47964
48411
  }
47965
48412
  function getListBlockType(block) {
47966
48413
  ensureIsListBlock(block);
47967
48414
  const type = block.getAttribute("data-list-type");
47968
- assert(logger$1$, type, "no list type");
48415
+ assert(logger$1Z, type, "no list type");
47969
48416
  return type;
47970
48417
  }
47971
48418
  function isTextOnlyListBlock(block) {
@@ -47984,7 +48431,7 @@ ${codeText}
47984
48431
  function getListBlockGroupId(block) {
47985
48432
  ensureIsListBlock(block);
47986
48433
  const groupId = block.getAttribute("data-list-group-id");
47987
- assert(logger$1$, groupId, "no group id");
48434
+ assert(logger$1Z, groupId, "no group id");
47988
48435
  return groupId;
47989
48436
  }
47990
48437
  function getListBlockProperties(block) {
@@ -47994,7 +48441,7 @@ ${codeText}
47994
48441
  const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
47995
48442
  const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
47996
48443
  const groupId = block.getAttribute("data-list-group-id");
47997
- assert(logger$1$, groupId, "no group id");
48444
+ assert(logger$1Z, groupId, "no group id");
47998
48445
  return {
47999
48446
  type,
48000
48447
  start,
@@ -48263,7 +48710,7 @@ ${codeText}
48263
48710
  this.nodeMap.set(block, node);
48264
48711
  if (parentBlock) {
48265
48712
  const parentNode = this.nodeMap.get(parentBlock);
48266
- assert(logger$20, parentNode, "no parent node");
48713
+ assert(logger$1_, parentNode, "no parent node");
48267
48714
  parentNode.children.push(node);
48268
48715
  } else {
48269
48716
  this.rootNodes.push(node);
@@ -48331,7 +48778,7 @@ ${codeText}
48331
48778
  return hasClass(block, "editor-in-mindmap-first");
48332
48779
  }
48333
48780
  function isViewingAsMindmap(block) {
48334
- assert(logger$20, isListBlock(block), "not a list block");
48781
+ assert(logger$1_, isListBlock(block), "not a list block");
48335
48782
  if (hasClass(block, "editor-in-mindmap-first")) {
48336
48783
  return true;
48337
48784
  }
@@ -48352,12 +48799,12 @@ ${codeText}
48352
48799
  const container = getParentContainer(from);
48353
48800
  if (to) {
48354
48801
  const container2 = getParentContainer(to);
48355
- assert(logger$20, container === container2, "invalid block container");
48802
+ assert(logger$1_, container === container2, "invalid block container");
48356
48803
  }
48357
48804
  const fromIndex = getBlockIndex(from);
48358
48805
  if (to) {
48359
48806
  const toIndex = getBlockIndex(to);
48360
- assert(logger$20, fromIndex <= toIndex, "invalid block index");
48807
+ assert(logger$1_, fromIndex <= toIndex, "invalid block index");
48361
48808
  }
48362
48809
  addClass(from, ...styles);
48363
48810
  if (!to || to === from) {
@@ -48365,7 +48812,7 @@ ${codeText}
48365
48812
  }
48366
48813
  let next2 = getNextBlock(from);
48367
48814
  while (next2 !== to) {
48368
- assert(logger$20, next2, "no next button");
48815
+ assert(logger$1_, next2, "no next button");
48369
48816
  addClass(next2, ...styles);
48370
48817
  next2 = getNextBlock(next2);
48371
48818
  }
@@ -48376,7 +48823,7 @@ ${codeText}
48376
48823
  async function requestMindmapFullscreen(editor, block, mindmapTools) {
48377
48824
  const tools = getBlockTools(block);
48378
48825
  const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
48379
- assert(logger$20, exitFullscreenButton, "no full screen button");
48826
+ assert(logger$1_, exitFullscreenButton, "no full screen button");
48380
48827
  const resetMindmap = () => {
48381
48828
  setTimeout(() => {
48382
48829
  mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
@@ -48396,7 +48843,7 @@ ${codeText}
48396
48843
  try {
48397
48844
  await exitFullscreen();
48398
48845
  } catch (err) {
48399
- logger$20.error(err);
48846
+ logger$1_.error(err);
48400
48847
  }
48401
48848
  onExitFullscreen();
48402
48849
  } else {
@@ -48405,7 +48852,7 @@ ${codeText}
48405
48852
  await requestFullscreen(tools);
48406
48853
  resetMindmap();
48407
48854
  } catch (err) {
48408
- logger$20.error(err);
48855
+ logger$1_.error(err);
48409
48856
  }
48410
48857
  exitFullscreenButton.innerHTML = ExitFullScreenIcon;
48411
48858
  exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
@@ -48686,7 +49133,7 @@ ${codeText}
48686
49133
  if (!svg) {
48687
49134
  return;
48688
49135
  }
48689
- assert(logger$20, svg, "no mindmap svg");
49136
+ assert(logger$1_, svg, "no mindmap svg");
48690
49137
  svg.remove();
48691
49138
  editor.domEvents.removeAllListeners(svg);
48692
49139
  destroyMindmapButtons(editor, block);
@@ -48738,7 +49185,7 @@ ${codeText}
48738
49185
  });
48739
49186
  __publicField(this, "handleMouseEnter", () => {
48740
49187
  const block = getParentBlock(this.toMindmapButton);
48741
- assert(logger$20, block && isListBlock(block), "no parent list");
49188
+ assert(logger$1_, block && isListBlock(block), "no parent list");
48742
49189
  highlightEntireList(this.editor, block, true);
48743
49190
  this.currentBlock = block;
48744
49191
  });
@@ -48750,7 +49197,7 @@ ${codeText}
48750
49197
  });
48751
49198
  __publicField(this, "handleClick", () => {
48752
49199
  const block = getParentBlock(this.toMindmapButton);
48753
- assert(logger$20, block && isListBlock(block), "no parent list");
49200
+ assert(logger$1_, block && isListBlock(block), "no parent list");
48754
49201
  toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
48755
49202
  });
48756
49203
  this.editor = editor;
@@ -48878,11 +49325,11 @@ ${codeText}
48878
49325
  }
48879
49326
  }
48880
49327
  function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
48881
- logger$20.debug("drag a block on a list block");
49328
+ logger$1_.debug("drag a block on a list block");
48882
49329
  if (!isTextKindBlock(editor, draggedBlock)) {
48883
49330
  return false;
48884
49331
  }
48885
- assert(logger$20, isListBlock(targetListBlock), "target is not a list block");
49332
+ assert(logger$1_, isListBlock(targetListBlock), "target is not a list block");
48886
49333
  const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
48887
49334
  const newStart = insertPos === "after" ? start + 1 : start;
48888
49335
  const oldData = editor.getBlockData(draggedBlock);
@@ -48915,7 +49362,7 @@ ${codeText}
48915
49362
  return true;
48916
49363
  }
48917
49364
  function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
48918
- logger$20.debug("drag a list between text blocks");
49365
+ logger$1_.debug("drag a list between text blocks");
48919
49366
  if (insertPos === "after") {
48920
49367
  const nextBlock = getNextBlock(targetBlock);
48921
49368
  if (nextBlock && isListBlock(nextBlock)) {
@@ -48952,11 +49399,11 @@ ${codeText}
48952
49399
  }
48953
49400
  const { blockId } = dragData;
48954
49401
  const draggedBlock = editor.getBlockById(blockId);
48955
- assert(logger$20, draggedBlock, "no dragged block");
49402
+ assert(logger$1_, draggedBlock, "no dragged block");
48956
49403
  const { isSourceBlock, targetBlock } = options;
48957
49404
  if (!isSourceBlock && targetBlock) {
48958
- assert(logger$20, block === targetBlock, "block !== target block");
48959
- assert(logger$20, isListBlock(targetBlock), "target is not a list block");
49405
+ assert(logger$1_, block === targetBlock, "block !== target block");
49406
+ assert(logger$1_, isListBlock(targetBlock), "target is not a list block");
48960
49407
  return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
48961
49408
  }
48962
49409
  return handleDragList(editor, draggedBlock, targetBlock, insertPos);
@@ -49458,7 +49905,7 @@ ${codeText}
49458
49905
  }
49459
49906
  const nextBrother = getListNextBrother(block);
49460
49907
  while (nextBlock !== nextBrother) {
49461
- assert(logger$20, nextBlock, "no next block");
49908
+ assert(logger$1_, nextBlock, "no next block");
49462
49909
  if (isListBlock(nextBlock)) {
49463
49910
  if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
49464
49911
  return nextBlock;
@@ -49557,9 +50004,9 @@ ${codeText}
49557
50004
  }
49558
50005
  return true;
49559
50006
  }
49560
- const logger$1_ = getLogger("list-block");
50007
+ const logger$1Y = getLogger("list-block");
49561
50008
  function cloneListData(editor, block, options) {
49562
- assert(logger$1_, isListBlock(block), "not a list block");
50009
+ assert(logger$1Y, isListBlock(block), "not a list block");
49563
50010
  const blockData = {
49564
50011
  ...editor.getBlockData(block),
49565
50012
  id: genId()
@@ -49634,7 +50081,7 @@ ${codeText}
49634
50081
  return true;
49635
50082
  }
49636
50083
  function findPrevBrotherAsParent(block) {
49637
- assert(logger$20, isListBlock(block), "not a list block");
50084
+ assert(logger$1_, isListBlock(block), "not a list block");
49638
50085
  const { level } = getListBlockProperties(block);
49639
50086
  let prevBlock = getPrevBlock(block);
49640
50087
  while (prevBlock) {
@@ -49661,7 +50108,7 @@ ${codeText}
49661
50108
  }
49662
50109
  function findPrevBrother(editor, fromBlock, toParentBlock) {
49663
50110
  let prevBlock = getPrevBlock(fromBlock);
49664
- assert(logger$20, prevBlock, "no prev brother");
50111
+ assert(logger$1_, prevBlock, "no prev brother");
49665
50112
  const parentLevel = getListBlockLevel(toParentBlock);
49666
50113
  while (prevBlock) {
49667
50114
  if (prevBlock === toParentBlock) {
@@ -49682,7 +50129,7 @@ ${codeText}
49682
50129
  }
49683
50130
  ensureIsListBlock(block);
49684
50131
  const prevBrother = findPrevBrotherAsParent(block);
49685
- assert(logger$20, prevBrother, "no list prev brother");
50132
+ assert(logger$1_, prevBrother, "no list prev brother");
49686
50133
  const newParent = prevBrother;
49687
50134
  const newBrother = findPrevBrother(editor, block, newParent);
49688
50135
  const level = getListBlockLevel(newParent) + 1;
@@ -49881,14 +50328,14 @@ ${codeText}
49881
50328
  this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
49882
50329
  }
49883
50330
  }
49884
- const logger$1Z = getLogger("customize-list-start-menu");
50331
+ const logger$1X = getLogger("customize-list-start-menu");
49885
50332
  class CustomizeListStartDialog {
49886
50333
  constructor(editor) {
49887
50334
  __publicField(this, "popup");
49888
50335
  __publicField(this, "block", null);
49889
50336
  __publicField(this, "show", (editor, block) => {
49890
50337
  const listBlockMarker = block.querySelector("div.list-container");
49891
- assert(logger$1Z, listBlockMarker, "list-block mark does not exist");
50338
+ assert(logger$1X, listBlockMarker, "list-block mark does not exist");
49892
50339
  this.block = block;
49893
50340
  this.popup.manualShow(listBlockMarker, {
49894
50341
  theme: "light"
@@ -50046,7 +50493,7 @@ ${codeText}
50046
50493
  const listContainer = findTarget(event, "div.list-container");
50047
50494
  if (listContainer && this.editor.isWritable()) {
50048
50495
  const block = getParentBlock(listContainer);
50049
- assert(logger$20, block, "no parent block");
50496
+ assert(logger$1_, block, "no parent block");
50050
50497
  ensureIsListBlock(block);
50051
50498
  const blockData = editor.getBlockData(block);
50052
50499
  if (blockData && blockData.checkbox) {
@@ -50186,7 +50633,7 @@ ${codeText}
50186
50633
  }
50187
50634
  return blockContent;
50188
50635
  }
50189
- const zhCN$t = {
50636
+ const zhCN$s = {
50190
50637
  list: {
50191
50638
  confirm: "\u786E\u5B9A",
50192
50639
  setStart: "\u8BBE\u7F6E\u7F16\u53F7",
@@ -50206,7 +50653,7 @@ ${codeText}
50206
50653
  exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
50207
50654
  }
50208
50655
  };
50209
- const enUS$t = {
50656
+ const enUS$s = {
50210
50657
  list: {
50211
50658
  confirm: "Confirm",
50212
50659
  setStart: "Set number",
@@ -50226,7 +50673,7 @@ ${codeText}
50226
50673
  exitFullscreen: "Exit full screen"
50227
50674
  }
50228
50675
  };
50229
- const jaJP$t = {
50676
+ const jaJP$s = {
50230
50677
  list: {
50231
50678
  confirm: "OK",
50232
50679
  setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
@@ -50247,12 +50694,12 @@ ${codeText}
50247
50694
  }
50248
50695
  };
50249
50696
  i18n$1.mergeLang({
50250
- "zh-CN": zhCN$t,
50251
- "en-US": enUS$t,
50252
- "ja-JP": jaJP$t
50697
+ "zh-CN": zhCN$s,
50698
+ "en-US": enUS$s,
50699
+ "ja-JP": jaJP$s
50253
50700
  });
50254
- const style$9 = "";
50255
- const logger$1Y = getLogger("list-block:paste-handler");
50701
+ const style$8 = "";
50702
+ const logger$1W = getLogger("list-block:paste-handler");
50256
50703
  class ListPasteHandler {
50257
50704
  constructor() {
50258
50705
  __publicField(this, "fixStartByList", null);
@@ -50306,7 +50753,7 @@ ${codeText}
50306
50753
  startIds.set(newGroupId, 1);
50307
50754
  } else {
50308
50755
  const start = startIds.get(groupId);
50309
- assert(logger$1Y, start, "start is null");
50756
+ assert(logger$1W, start, "start is null");
50310
50757
  block.start = start + 1;
50311
50758
  block.groupId = groupId;
50312
50759
  startIds.set(groupId, start + 1);
@@ -50326,7 +50773,7 @@ ${codeText}
50326
50773
  return false;
50327
50774
  }
50328
50775
  }
50329
- const logger$1X = getLogger("list selection to doc");
50776
+ const logger$1V = getLogger("list selection to doc");
50330
50777
  function convertListToText(data2) {
50331
50778
  const textData = { type: "text" };
50332
50779
  Object.entries(data2).forEach(([key, value]) => {
@@ -50341,7 +50788,7 @@ ${codeText}
50341
50788
  const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
50342
50789
  const start = selectedBlock.start;
50343
50790
  const end = selectedBlock.end;
50344
- assert(logger$1X, data2.text, "no block text");
50791
+ assert(logger$1V, data2.text, "no block text");
50345
50792
  const len = getBlockTextLength$6(editor, selectedBlock.block);
50346
50793
  if (end.offset - start.offset === len) {
50347
50794
  return {
@@ -50917,7 +51364,7 @@ ${codeText}
50917
51364
  toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
50918
51365
  }, 300);
50919
51366
  };
50920
- const logger$1W = getLogger("inline-box-items");
51367
+ const logger$1U = getLogger("inline-box-items");
50921
51368
  function insertEmptyBlockLink(editor, containerId, blockIndex) {
50922
51369
  let block = editor.findBlockByIndex(containerId, blockIndex);
50923
51370
  let placement = "bottom-start";
@@ -50928,7 +51375,7 @@ ${codeText}
50928
51375
  const onFinished = (linkText, linkUrl) => {
50929
51376
  editor.undoManager.runInGroup(() => {
50930
51377
  try {
50931
- assert(logger$1W, block, "block not found");
51378
+ assert(logger$1U, block, "block not found");
50932
51379
  if (!isEmptyTextBlock(editor, block)) {
50933
51380
  block = editor.insertTextBlock([], containerId, blockIndex);
50934
51381
  }
@@ -50939,7 +51386,7 @@ ${codeText}
50939
51386
  editor.selection.selectBlock(block, getTextLength(text2));
50940
51387
  editor.focus();
50941
51388
  } catch (error2) {
50942
- logger$1W.error(error2);
51389
+ logger$1U.error(error2);
50943
51390
  }
50944
51391
  });
50945
51392
  };
@@ -50959,7 +51406,7 @@ ${codeText}
50959
51406
  function insertLink(editor, containerId, blockIndex) {
50960
51407
  const block = editor.getBlockByIndex(containerId, blockIndex);
50961
51408
  const range = editor.selection.range;
50962
- assert(logger$1W, isSimpleBlockPosition(range.start), "invalid block position");
51409
+ assert(logger$1U, isSimpleBlockPosition(range.start), "invalid block position");
50963
51410
  const rects = getBlockClientRects(editor, block, range);
50964
51411
  if (rects.length === 0) {
50965
51412
  return;
@@ -50985,7 +51432,7 @@ ${codeText}
50985
51432
  editor.selection.selectBlock(block, start + linkText.length);
50986
51433
  editor.focus();
50987
51434
  } catch (error2) {
50988
- logger$1W.error(error2);
51435
+ logger$1U.error(error2);
50989
51436
  }
50990
51437
  });
50991
51438
  };
@@ -51203,7 +51650,7 @@ ${codeText}
51203
51650
  function getToolbar(editor) {
51204
51651
  return editor.findCustom("toolbar-handler");
51205
51652
  }
51206
- const logger$1V = getLogger("link-popup");
51653
+ const logger$1T = getLogger("link-popup");
51207
51654
  function getLinkHref(child) {
51208
51655
  var _a, _b;
51209
51656
  return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
@@ -51241,7 +51688,7 @@ ${codeText}
51241
51688
  editor.selection.selectBlock(block, range.start + linkText.length);
51242
51689
  editor.focus();
51243
51690
  } catch (error2) {
51244
- logger$1V.error(error2);
51691
+ logger$1T.error(error2);
51245
51692
  }
51246
51693
  };
51247
51694
  const onClose = () => {
@@ -51480,7 +51927,7 @@ ${codeText}
51480
51927
  this.editProvider = new EditLinkProvider();
51481
51928
  }
51482
51929
  }
51483
- const logger$1U = getLogger("readonly-toolbar");
51930
+ const logger$1S = getLogger("readonly-toolbar");
51484
51931
  const SEP = {
51485
51932
  id: "",
51486
51933
  name: "",
@@ -51543,7 +51990,7 @@ ${codeText}
51543
51990
  });
51544
51991
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
51545
51992
  var _a;
51546
- assert(logger$1U, editor === this.editor, "editor mismatch");
51993
+ assert(logger$1S, editor === this.editor, "editor mismatch");
51547
51994
  if (!editor.readonly) {
51548
51995
  this.toolbar.close("selectionChange");
51549
51996
  return;
@@ -51725,7 +52172,7 @@ ${codeText}
51725
52172
  return visible;
51726
52173
  }
51727
52174
  }
51728
- const logger$1T = getLogger("toolbar-handler");
52175
+ const logger$1R = getLogger("toolbar-handler");
51729
52176
  class OnesEditorToolbar {
51730
52177
  constructor(editor) {
51731
52178
  __publicField(this, "id", "editor-toolbar");
@@ -51812,7 +52259,7 @@ ${codeText}
51812
52259
  });
51813
52260
  __publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
51814
52261
  var _a;
51815
- assert(logger$1T, editor === this.editor, "editor mismatch");
52262
+ assert(logger$1R, editor === this.editor, "editor mismatch");
51816
52263
  if (editor.selection.range.isCollapsed() || this.mouseDown) {
51817
52264
  if (this.toolbarType === "object") {
51818
52265
  const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
@@ -52032,8 +52479,15 @@ ${codeText}
52032
52479
  }
52033
52480
  }
52034
52481
  const getReferenceClientRectByCaret = () => {
52482
+ if (!this.hoveringBlock) {
52483
+ return new DOMRect();
52484
+ }
52485
+ const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
52486
+ if (!element2) {
52487
+ return new DOMRect();
52488
+ }
52035
52489
  let rect;
52036
- const clientRects = element.getClientRects();
52490
+ const clientRects = element2.getClientRects();
52037
52491
  const lineRects = [];
52038
52492
  Array.from(clientRects).forEach((clientRect) => {
52039
52493
  const { y } = clientRect;
@@ -52043,7 +52497,7 @@ ${codeText}
52043
52497
  lineRects.push(y);
52044
52498
  });
52045
52499
  if (lineRects.length > 1) {
52046
- rect = child ? clientRects[clientRects.length - 1] : clientRects[0];
52500
+ rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
52047
52501
  if (event) {
52048
52502
  for (let i = 0; i < clientRects.length; i++) {
52049
52503
  const clientRect = clientRects[i];
@@ -52055,21 +52509,15 @@ ${codeText}
52055
52509
  }
52056
52510
  }
52057
52511
  } else {
52058
- rect = element.getBoundingClientRect();
52059
- if (child) {
52060
- const childRect = child.getBoundingClientRect();
52512
+ rect = element2.getBoundingClientRect();
52513
+ if (!isBlock$1(element2)) {
52514
+ const childRect = element2.getBoundingClientRect();
52061
52515
  return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
52062
52516
  }
52063
52517
  if (clientRects.length === 1) {
52064
52518
  return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
52065
52519
  }
52066
52520
  }
52067
- if (this.hoveringBlock) {
52068
- const blockContent = getBlockContent(this.hoveringBlock);
52069
- if (blockContent !== element) {
52070
- return blockContent.getBoundingClientRect();
52071
- }
52072
- }
52073
52521
  if (event) {
52074
52522
  const y = rect.y;
52075
52523
  const x = event.clientX;
@@ -52079,8 +52527,9 @@ ${codeText}
52079
52527
  };
52080
52528
  this.toolbar.updateItems(commands);
52081
52529
  if (!this.toolbar.isVisible) {
52530
+ const isText = element === child && !isTextBlockContentBoxChild(element);
52082
52531
  this.toolbar.manualShow(element, {
52083
- placement: child && !isTextBlockContentBoxChild(child) && !clientType.isMobile ? "bottom" : "top",
52532
+ placement: isText && !clientType.isMobile ? "bottom" : "top",
52084
52533
  getReferenceClientRect: getReferenceClientRectByCaret
52085
52534
  });
52086
52535
  if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
@@ -52131,7 +52580,7 @@ ${codeText}
52131
52580
  this.texWidth = [tex, width];
52132
52581
  }
52133
52582
  }
52134
- const logger$1S = getLogger("mathjax-converter");
52583
+ const logger$1Q = getLogger("mathjax-converter");
52135
52584
  const MATHJAX_SCRIPT_ID = "MathJax-script";
52136
52585
  const MATHJAX_BUFFER = 30;
52137
52586
  const REDUCED_UNIT = 8;
@@ -52180,7 +52629,7 @@ ${codeText}
52180
52629
  const svg = result.querySelector("svg");
52181
52630
  return svg.outerHTML;
52182
52631
  } catch (err) {
52183
- logger$1S.error(err);
52632
+ logger$1Q.error(err);
52184
52633
  throw err;
52185
52634
  } finally {
52186
52635
  lockers.release(lockId);
@@ -52228,7 +52677,7 @@ ${codeText}
52228
52677
  ...perfectState
52229
52678
  };
52230
52679
  }
52231
- const logger$1R = getLogger("edit-mathjax");
52680
+ const logger$1P = getLogger("edit-mathjax");
52232
52681
  class MathjaxEditor {
52233
52682
  constructor() {
52234
52683
  __publicField(this, "editMathjaxPopup", null);
@@ -52305,9 +52754,9 @@ ${codeText}
52305
52754
  this.observer.observe(textarea2);
52306
52755
  }
52307
52756
  getTextarea() {
52308
- assert(logger$1R, this.editMathjaxPopup, "no exists mathjax editor popup");
52757
+ assert(logger$1P, this.editMathjaxPopup, "no exists mathjax editor popup");
52309
52758
  const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
52310
- assert(logger$1R, textarea2, "no textarea");
52759
+ assert(logger$1P, textarea2, "no textarea");
52311
52760
  return textarea2;
52312
52761
  }
52313
52762
  destroy() {
@@ -52377,7 +52826,7 @@ ${codeText}
52377
52826
  };
52378
52827
  editMathjax(editor, box, data2.tex, update2);
52379
52828
  }
52380
- const logger$1Q = getLogger("mathjax-box");
52829
+ const logger$1O = getLogger("mathjax-box");
52381
52830
  function updateCaret(editor, event) {
52382
52831
  editor.selection.updateSelection(null);
52383
52832
  const target = event.target;
@@ -52482,7 +52931,7 @@ ${codeText}
52482
52931
  };
52483
52932
  editor.updateBoxData(newData);
52484
52933
  }).catch((err) => {
52485
- logger$1Q.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
52934
+ logger$1O.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
52486
52935
  });
52487
52936
  return data2;
52488
52937
  }
@@ -52501,7 +52950,7 @@ ${codeText}
52501
52950
  }
52502
52951
  function handleClickBox$3(editor, box, event) {
52503
52952
  const parentBlock = getParentBlock(box);
52504
- assert(logger$1Q, parentBlock, "failed to get block");
52953
+ assert(logger$1O, parentBlock, "failed to get block");
52505
52954
  if (!editor.isBlockWritable(parentBlock)) {
52506
52955
  return;
52507
52956
  }
@@ -52698,28 +53147,28 @@ $$${mathData.mathjaxText}$$
52698
53147
  getBlockProperties: getBlockProperties$b
52699
53148
  };
52700
53149
  const mathjaxStyle = "";
52701
- const zhCN$s = {
53150
+ const zhCN$r = {
52702
53151
  mathjax: {
52703
53152
  emptyText: "\u7A7A\u7684\u516C\u5F0F",
52704
53153
  abstract: "\u516C\u5F0F"
52705
53154
  }
52706
53155
  };
52707
- const enUS$s = {
53156
+ const enUS$r = {
52708
53157
  mathjax: {
52709
53158
  emptyText: "Empty formula",
52710
53159
  abstract: "Formula"
52711
53160
  }
52712
53161
  };
52713
- const jaJP$s = {
53162
+ const jaJP$r = {
52714
53163
  mathjax: {
52715
53164
  emptyText: "\u6570\u5F0F\u306A\u3057",
52716
53165
  abstract: "\u6570\u5F0F"
52717
53166
  }
52718
53167
  };
52719
53168
  i18n$1.mergeLang({
52720
- "zh-CN": zhCN$s,
52721
- "en-US": enUS$s,
52722
- "ja-JP": jaJP$s
53169
+ "zh-CN": zhCN$r,
53170
+ "en-US": enUS$r,
53171
+ "ja-JP": jaJP$r
52723
53172
  });
52724
53173
  function convertToMath(editor, containerId, blockIndex, offset) {
52725
53174
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -58253,7 +58702,7 @@ $$${mathData.mathjaxText}$$
58253
58702
  const docBlockText = { insert: " ", attributes: data2 };
58254
58703
  return docBlockText;
58255
58704
  }
58256
- const logger$1P = getLogger("StatusBoxEditor");
58705
+ const logger$1N = getLogger("StatusBoxEditor");
58257
58706
  class StatusBoxEditor {
58258
58707
  constructor(editor) {
58259
58708
  __publicField(this, "linkPopup", null);
@@ -58276,10 +58725,10 @@ $$${mathData.mathjaxText}$$
58276
58725
  });
58277
58726
  __publicField(this, "handClose", () => {
58278
58727
  var _a;
58279
- assert(logger$1P, this.boxElement, "boxElement not found");
58728
+ assert(logger$1N, this.boxElement, "boxElement not found");
58280
58729
  const boxData = this.editor.getBoxData(this.boxElement);
58281
58730
  const block = getParentBlock(this.boxElement);
58282
- assert(logger$1P, block, "block not found");
58731
+ assert(logger$1N, block, "block not found");
58283
58732
  if (!boxData.title) {
58284
58733
  const offset = getChildOffset(block, this.boxElement);
58285
58734
  this.editor.deleteTextFromBlock(block, offset.start, 1);
@@ -58317,7 +58766,7 @@ $$${mathData.mathjaxText}$$
58317
58766
  return;
58318
58767
  }
58319
58768
  const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
58320
- assert(logger$1P, this.boxElement, "boxElement not found");
58769
+ assert(logger$1N, this.boxElement, "boxElement not found");
58321
58770
  const data2 = this.editor.getBoxData(this.boxElement);
58322
58771
  this.statusPalette.changeColor(color);
58323
58772
  const newData = { ...data2, color };
@@ -58334,7 +58783,7 @@ $$${mathData.mathjaxText}$$
58334
58783
  });
58335
58784
  __publicField(this, "onTitleChange", (e2) => {
58336
58785
  const title = e2.target.value;
58337
- assert(logger$1P, this.boxElement, "boxElement not found");
58786
+ assert(logger$1N, this.boxElement, "boxElement not found");
58338
58787
  const data2 = this.editor.getBoxData(this.boxElement);
58339
58788
  const newData = { ...data2, title: title.trim() };
58340
58789
  this.editor.updateBoxData(newData, { noFocus: true });
@@ -58415,7 +58864,7 @@ $$${mathData.mathjaxText}$$
58415
58864
  toStandardText: toStandardText$1,
58416
58865
  matchText: matchText$1
58417
58866
  };
58418
- const logger$1O = getLogger("status-box-command");
58867
+ const logger$1M = getLogger("status-box-command");
58419
58868
  class StatusBoxCommand {
58420
58869
  static get commands() {
58421
58870
  return [
@@ -58434,7 +58883,7 @@ $$${mathData.mathjaxText}$$
58434
58883
  const block = editor.getBlockByIndex(containerId, blockIndex);
58435
58884
  const boxOp = createEmptyStatusBox();
58436
58885
  const { start } = editor.selection.range;
58437
- assert(logger$1O, isSimpleBlockPosition(start), "invalid block position");
58886
+ assert(logger$1M, isSimpleBlockPosition(start), "invalid block position");
58438
58887
  editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
58439
58888
  const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
58440
58889
  editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
@@ -58453,7 +58902,7 @@ $$${mathData.mathjaxText}$$
58453
58902
  }
58454
58903
  }
58455
58904
  __publicField(StatusBoxCommand, "id", "insert-status");
58456
- const enUS$r = {
58905
+ const enUS$q = {
58457
58906
  status: {
58458
58907
  empty: "Set status",
58459
58908
  command: {
@@ -58477,7 +58926,7 @@ $$${mathData.mathjaxText}$$
58477
58926
  }
58478
58927
  }
58479
58928
  };
58480
- const zhCN$r = {
58929
+ const zhCN$q = {
58481
58930
  status: {
58482
58931
  empty: "\u8BBE\u7F6E\u72B6\u6001",
58483
58932
  command: {
@@ -58501,7 +58950,7 @@ $$${mathData.mathjaxText}$$
58501
58950
  }
58502
58951
  }
58503
58952
  };
58504
- const jaJP$r = {
58953
+ const jaJP$q = {
58505
58954
  status: {
58506
58955
  empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
58507
58956
  command: {
@@ -58526,12 +58975,12 @@ $$${mathData.mathjaxText}$$
58526
58975
  }
58527
58976
  };
58528
58977
  const langs$2 = {
58529
- "en-US": enUS$r,
58530
- "zh-CN": zhCN$r,
58531
- "ja-JP": jaJP$r
58978
+ "en-US": enUS$q,
58979
+ "zh-CN": zhCN$q,
58980
+ "ja-JP": jaJP$q
58532
58981
  };
58533
58982
  i18n$1.mergeLang(langs$2);
58534
- const logger$1N = getLogger("inline-box-items");
58983
+ const logger$1L = getLogger("inline-box-items");
58535
58984
  function insertEmptyBlockMath(editor, containerId, blockIndex) {
58536
58985
  return editor.undoManager.runInGroup(() => {
58537
58986
  var _a;
@@ -58542,7 +58991,7 @@ $$${mathData.mathjaxText}$$
58542
58991
  const boxOp = createEmptyMathjaxBox();
58543
58992
  editor.setBlockText(block, [boxOp]);
58544
58993
  const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
58545
- assert(logger$1N, boxId, "mathjax box id is empty");
58994
+ assert(logger$1L, boxId, "mathjax box id is empty");
58546
58995
  setTimeout(() => {
58547
58996
  const box = editor.getBoxById(boxId);
58548
58997
  editMathjaxBox(editor, box);
@@ -58555,11 +59004,11 @@ $$${mathData.mathjaxText}$$
58555
59004
  var _a;
58556
59005
  const block = editor.getBlockByIndex(containerId, blockIndex);
58557
59006
  const range = editor.selection.range;
58558
- assert(logger$1N, isSimpleBlockPosition(range.start), "invalid block position");
59007
+ assert(logger$1L, isSimpleBlockPosition(range.start), "invalid block position");
58559
59008
  const boxOp = createEmptyMathjaxBox();
58560
59009
  editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
58561
59010
  const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
58562
- assert(logger$1N, boxId, "mathjax box id is empty");
59011
+ assert(logger$1L, boxId, "mathjax box id is empty");
58563
59012
  setTimeout(() => {
58564
59013
  const box = editor.getBoxById(boxId);
58565
59014
  editMathjaxBox(editor, box);
@@ -58726,7 +59175,7 @@ $$${mathData.mathjaxText}$$
58726
59175
  }
58727
59176
  }
58728
59177
  };
58729
- const logger$1M = getLogger("insert-menu");
59178
+ const logger$1K = getLogger("insert-menu");
58730
59179
  const injectGroup = (commands, group, startIndex) => {
58731
59180
  commands.forEach((command, index2) => {
58732
59181
  command.group = group;
@@ -58865,7 +59314,7 @@ $$${mathData.mathjaxText}$$
58865
59314
  return true;
58866
59315
  }
58867
59316
  const blockId = getBlockId(block);
58868
- assert(logger$1M, range.isSimple(), "invalid range");
59317
+ assert(logger$1K, range.isSimple(), "invalid range");
58869
59318
  const offset = range.start.offset;
58870
59319
  if (quickItem.commandProvider) {
58871
59320
  const params2 = { from: "quick-menu", blockId, offset };
@@ -58901,7 +59350,7 @@ $$${mathData.mathjaxText}$$
58901
59350
  });
58902
59351
  }
58903
59352
  }
58904
- const logger$1L = getLogger("quick-command-providers");
59353
+ const logger$1J = getLogger("quick-command-providers");
58905
59354
  class QuickCommandProviders extends AbstractProvider {
58906
59355
  constructor(editor) {
58907
59356
  super(editor);
@@ -58921,7 +59370,7 @@ $$${mathData.mathjaxText}$$
58921
59370
  }
58922
59371
  getCommands(range) {
58923
59372
  var _a, _b;
58924
- assert(logger$1L, range.start.blockId === range.end.blockId, "invalid range");
59373
+ assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
58925
59374
  const commandsMap = /* @__PURE__ */ new Map();
58926
59375
  const block = this.editor.getBlockById(range.anchor.blockId);
58927
59376
  const container = getParentContainer(block);
@@ -59358,7 +59807,7 @@ $$${mathData.mathjaxText}$$
59358
59807
  "CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
59359
59808
  ...headingShortcut()
59360
59809
  };
59361
- const zhCN$q = {
59810
+ const zhCN$p = {
59362
59811
  quickMenu: {
59363
59812
  basic: {
59364
59813
  heading: {
@@ -59414,7 +59863,7 @@ $$${mathData.mathjaxText}$$
59414
59863
  selectBlock: "\u9009\u62E9\u533A\u5757"
59415
59864
  }
59416
59865
  };
59417
- const enUS$q = {
59866
+ const enUS$p = {
59418
59867
  quickMenu: {
59419
59868
  basic: {
59420
59869
  heading: {
@@ -59470,7 +59919,7 @@ $$${mathData.mathjaxText}$$
59470
59919
  selectBlock: "Select Block"
59471
59920
  }
59472
59921
  };
59473
- const jaJP$q = {
59922
+ const jaJP$p = {
59474
59923
  quickMenu: {
59475
59924
  basic: {
59476
59925
  heading: {
@@ -59527,9 +59976,9 @@ $$${mathData.mathjaxText}$$
59527
59976
  }
59528
59977
  };
59529
59978
  i18n$1.mergeLang({
59530
- "zh-CN": zhCN$q,
59531
- "en-US": enUS$q,
59532
- "ja-JP": jaJP$q
59979
+ "zh-CN": zhCN$p,
59980
+ "en-US": enUS$p,
59981
+ "ja-JP": jaJP$p
59533
59982
  });
59534
59983
  class TextStylesFixedProvider extends ProxyProvider {
59535
59984
  constructor(editor, afterCommandCallback) {
@@ -59734,7 +60183,7 @@ $$${mathData.mathjaxText}$$
59734
60183
  return false;
59735
60184
  }
59736
60185
  }
59737
- const logger$1K = getLogger("block-command-providers");
60186
+ const logger$1I = getLogger("block-command-providers");
59738
60187
  class BlockCommandProviders extends AbstractProvider {
59739
60188
  constructor(editor, afterCommandCallback) {
59740
60189
  super(editor);
@@ -59755,7 +60204,7 @@ $$${mathData.mathjaxText}$$
59755
60204
  this.registerCommandProvider(new InsertGroupProvider(editor));
59756
60205
  }
59757
60206
  getCommands(range) {
59758
- assert(logger$1K, range.start.blockId === range.end.blockId, "invalid range");
60207
+ assert(logger$1I, range.start.blockId === range.end.blockId, "invalid range");
59759
60208
  const block = this.editor.getBlockById(range.anchor.blockId);
59760
60209
  const commandsMap = /* @__PURE__ */ new Map();
59761
60210
  let startIndex = 100;
@@ -59769,7 +60218,7 @@ $$${mathData.mathjaxText}$$
59769
60218
  return this.filterItems(range, commands);
59770
60219
  }
59771
60220
  }
59772
- const logger$1J = getLogger("standard-block-actions");
60221
+ const logger$1H = getLogger("standard-block-actions");
59773
60222
  class StandardBlockActionHook {
59774
60223
  constructor() {
59775
60224
  __publicField(this, "executeCommand", (editor, bloockElement, item) => {
@@ -59788,7 +60237,7 @@ $$${mathData.mathjaxText}$$
59788
60237
  this.deleteBlock(editor, block);
59789
60238
  }
59790
60239
  } catch (err) {
59791
- logger$1J.error(`failed to execute block command: ${JSON.stringify(err)}`);
60240
+ logger$1H.error(`failed to execute block command: ${JSON.stringify(err)}`);
59792
60241
  }
59793
60242
  });
59794
60243
  }
@@ -59856,7 +60305,7 @@ $$${mathData.mathjaxText}$$
59856
60305
  }
59857
60306
  }
59858
60307
  }
59859
- const logger$1I = getLogger("block-menu");
60308
+ const logger$1G = getLogger("block-menu");
59860
60309
  class BlockMenu {
59861
60310
  constructor(editor) {
59862
60311
  __publicField(this, "menu");
@@ -59864,7 +60313,7 @@ $$${mathData.mathjaxText}$$
59864
60313
  __publicField(this, "commandBlock", null);
59865
60314
  __publicField(this, "blockCommandProviders");
59866
60315
  __publicField(this, "handleShow", () => {
59867
- assert(logger$1I, this.currentBlock, "no target block before show block menu");
60316
+ assert(logger$1G, this.currentBlock, "no target block before show block menu");
59868
60317
  const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
59869
60318
  this.menu.updateItems(items);
59870
60319
  this.commandBlock = this.currentBlock;
@@ -59875,7 +60324,7 @@ $$${mathData.mathjaxText}$$
59875
60324
  }
59876
60325
  });
59877
60326
  __publicField(this, "handleItemClick", (bar2, item) => {
59878
- assert(logger$1I, this.commandBlock, "no command block before show block menu");
60327
+ assert(logger$1G, this.commandBlock, "no command block before show block menu");
59879
60328
  this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
59880
60329
  if (!item.element) {
59881
60330
  this.close();
@@ -59918,7 +60367,7 @@ $$${mathData.mathjaxText}$$
59918
60367
  this.menu.destroy();
59919
60368
  }
59920
60369
  }
59921
- const logger$1H = getLogger("text-styles");
60370
+ const logger$1F = getLogger("text-styles");
59922
60371
  function getIntersectionStyles(text2) {
59923
60372
  const getOpStyle = (op) => {
59924
60373
  if (!op.attributes) {
@@ -59952,10 +60401,10 @@ $$${mathData.mathjaxText}$$
59952
60401
  return new Map(Object.entries(attributes));
59953
60402
  }
59954
60403
  function applyTextStyle(editor, block, range, style2, value) {
59955
- assert(logger$1H, range.isSimple(), "invalid range");
60404
+ assert(logger$1F, range.isSimple(), "invalid range");
59956
60405
  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");
60406
+ assert(logger$1F, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
60407
+ assert(logger$1F, style2.startsWith("style-"), "invalid style");
59959
60408
  const oldText = editor.getBlockText(block);
59960
60409
  let newText = oldText;
59961
60410
  if (style2 === "style-sub") {
@@ -60001,13 +60450,13 @@ $$${mathData.mathjaxText}$$
60001
60450
  return standardItems;
60002
60451
  }
60003
60452
  function getSubText(editor, block, range) {
60004
- assert(logger$1H, range.isSimple(), "nor a simple range");
60453
+ assert(logger$1F, range.isSimple(), "nor a simple range");
60005
60454
  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");
60455
+ assert(logger$1F, start.isSimple(), "is not a simple block position");
60456
+ assert(logger$1F, end.isSimple(), "is not a simple block position");
60457
+ assert(logger$1F, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
60009
60458
  const blockId = getBlockId(block);
60010
- assert(logger$1H, start.blockId === blockId && end.blockId === blockId, "invalid range");
60459
+ assert(logger$1F, start.blockId === blockId && end.blockId === blockId, "invalid range");
60011
60460
  const text2 = editor.getBlockText(block);
60012
60461
  let subText2 = [];
60013
60462
  if (start.offset === end.offset) {
@@ -60019,7 +60468,7 @@ $$${mathData.mathjaxText}$$
60019
60468
  }
60020
60469
  return subText2;
60021
60470
  }
60022
- const logger$1G = getLogger("text-commands");
60471
+ const logger$1E = getLogger("text-commands");
60023
60472
  function getCommands$1(editor, text2) {
60024
60473
  const StandardTextStyles = {
60025
60474
  "style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
@@ -60037,13 +60486,13 @@ $$${mathData.mathjaxText}$$
60037
60486
  }
60038
60487
  function executeStyleCommand(editor, block, range, command, params, result) {
60039
60488
  if (!command.startsWith("style-")) {
60040
- logger$1G.warn(`unknown command: ${command}`);
60489
+ logger$1E.warn(`unknown command: ${command}`);
60041
60490
  return false;
60042
60491
  }
60043
60492
  const value = params == null ? void 0 : params.value;
60044
60493
  const type = typeof value;
60045
60494
  if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
60046
- logger$1G.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
60495
+ logger$1E.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
60047
60496
  return false;
60048
60497
  }
60049
60498
  const newText = applyTextStyle(editor, block, range, command, value);
@@ -60268,7 +60717,7 @@ $$${mathData.mathjaxText}$$
60268
60717
  this.providers = [new TextScriptProvider(editor)];
60269
60718
  }
60270
60719
  }
60271
- const logger$1F = getLogger("text-command-provider");
60720
+ const logger$1D = getLogger("text-command-provider");
60272
60721
  class TextCommandProvider {
60273
60722
  constructor(editor, options) {
60274
60723
  __publicField(this, "id", "TextCommandProvider");
@@ -60388,7 +60837,7 @@ $$${mathData.mathjaxText}$$
60388
60837
  }
60389
60838
  static fromTextCommandId(id) {
60390
60839
  const prefix = "text/";
60391
- assert(logger$1F, id.startsWith(prefix), `invalid item id: ${id}`);
60840
+ assert(logger$1D, id.startsWith(prefix), `invalid item id: ${id}`);
60392
60841
  return id.substring(prefix.length);
60393
60842
  }
60394
60843
  }
@@ -60493,7 +60942,7 @@ $$${mathData.mathjaxText}$$
60493
60942
  };
60494
60943
  editor.updateBlockData(block, newData);
60495
60944
  }
60496
- function addCommentToBlock$1(editor, block, provider) {
60945
+ function addCommentToBlock(editor, block, provider) {
60497
60946
  const { start, end } = createBlockSimpleRange(editor, block, 0, getBlockTextLength$6(editor, block));
60498
60947
  const selectedBlock = { block, start, end };
60499
60948
  const abstract = getCommentAbstractFromSelectedBlocks(editor, [selectedBlock]);
@@ -60506,7 +60955,7 @@ $$${mathData.mathjaxText}$$
60506
60955
  provider.localCreateComment(comment, doc2);
60507
60956
  return comment;
60508
60957
  }
60509
- const logger$1E = getLogger("standard-block-actions");
60958
+ const logger$1C = getLogger("standard-block-actions");
60510
60959
  class CommentBlockHook {
60511
60960
  constructor(provider, editorComments) {
60512
60961
  __publicField(this, "executeCommand", (editor, block, item) => {
@@ -60514,9 +60963,9 @@ $$${mathData.mathjaxText}$$
60514
60963
  try {
60515
60964
  this.editorComments.showCommentList();
60516
60965
  const block2 = editor.getBlockById(blockId);
60517
- addCommentToBlock$1(editor, block2, this.provider);
60966
+ addCommentToBlock(editor, block2, this.provider);
60518
60967
  } catch (err) {
60519
- logger$1E.error(`failed to execute block command: ${JSON.stringify(err)}`);
60968
+ logger$1C.error(`failed to execute block command: ${JSON.stringify(err)}`);
60520
60969
  }
60521
60970
  });
60522
60971
  this.provider = provider;
@@ -60620,7 +61069,7 @@ $$${mathData.mathjaxText}$$
60620
61069
  const attributes = Array.from(element.attributes).map((c) => c.name);
60621
61070
  return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
60622
61071
  }
60623
- const logger$1D = getLogger("doc-comments");
61072
+ const logger$1B = getLogger("doc-comments");
60624
61073
  function addBlockComments(doc2, block, result, resultSet) {
60625
61074
  if (block.comments) {
60626
61075
  const blockComments = block.comments;
@@ -60715,8 +61164,8 @@ $$${mathData.mathjaxText}$$
60715
61164
  const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
60716
61165
  const index1 = commentsMap.get(group1.groupId);
60717
61166
  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}`);
61167
+ assert(logger$1B, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
61168
+ assert(logger$1B, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
60720
61169
  return index1 - index2;
60721
61170
  });
60722
61171
  return result;
@@ -60777,7 +61226,7 @@ $$${mathData.mathjaxText}$$
60777
61226
  const commentIds = intersection__default.default(comments1, comments2);
60778
61227
  return commentIds;
60779
61228
  }
60780
- const logger$1C = getLogger("active-comments");
61229
+ const logger$1A = getLogger("active-comments");
60781
61230
  function inactiveComment(editor, commentId) {
60782
61231
  const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
60783
61232
  activeCommentElements.forEach((el) => {
@@ -60813,7 +61262,7 @@ $$${mathData.mathjaxText}$$
60813
61262
  const commentIds = getCommentsFromSelection(editor);
60814
61263
  if (commentIds.indexOf(commentId) === -1) {
60815
61264
  const block = getParentBlock(targetElement);
60816
- assert(logger$1C, block, "block not found");
61265
+ assert(logger$1A, block, "block not found");
60817
61266
  const offset = getChildOffset(block, targetElement);
60818
61267
  const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
60819
61268
  editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
@@ -60855,7 +61304,7 @@ $$${mathData.mathjaxText}$$
60855
61304
  function isValidSize(size) {
60856
61305
  return typeof size === "number";
60857
61306
  }
60858
- const logger$1B = getLogger("image-data");
61307
+ const logger$1z = getLogger("image-data");
60859
61308
  const md5Cache = /* @__PURE__ */ new Map();
60860
61309
  const DEFAULT_WIDTH$1 = 1e3;
60861
61310
  const DEFAULT_HEIGHT = 400;
@@ -60987,7 +61436,7 @@ $$${mathData.mathjaxText}$$
60987
61436
  if (heightKey && isValidSize(image.height)) {
60988
61437
  result[heightKey] = image.height;
60989
61438
  }
60990
- assert(logger$1B, image.flex, "no image flex");
61439
+ assert(logger$1z, image.flex, "no image flex");
60991
61440
  const flexKey = getImageFlexKeyFromSrc(index2);
60992
61441
  result[flexKey] = image.flex;
60993
61442
  });
@@ -61043,224 +61492,7 @@ $$${mathData.mathjaxText}$$
61043
61492
  const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
61044
61493
  return totalFlex;
61045
61494
  }
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");
61495
+ const logger$1y = getLogger("image-dom");
61264
61496
  function getExistsProgressMask(imageContainer) {
61265
61497
  return imageContainer.querySelector(".uploading-progress-mask");
61266
61498
  }
@@ -61277,7 +61509,7 @@ $$${mathData.mathjaxText}$$
61277
61509
  function getImageUploadingProgressValueElement(imageContainer) {
61278
61510
  const bar2 = getImageUploadingProgressMask(imageContainer);
61279
61511
  const value = bar2.querySelector(".uploading-progress-bar-value");
61280
- assert(logger$1z, value, "no progress value");
61512
+ assert(logger$1y, value, "no progress value");
61281
61513
  return value;
61282
61514
  }
61283
61515
  function setImageUploading(imageContainer, progress) {
@@ -61367,7 +61599,7 @@ $$${mathData.mathjaxText}$$
61367
61599
  const images = Array.from(block.querySelectorAll(".image-container"));
61368
61600
  return images;
61369
61601
  }
61370
- const logger$1y = getLogger("table-resize-drag-drop");
61602
+ const logger$1x = getLogger("table-resize-drag-drop");
61371
61603
  class ImageSplitterResizer {
61372
61604
  constructor(editor, elem, data2, mouseDownEvent) {
61373
61605
  __publicField(this, "cursor", "col-resize");
@@ -61380,7 +61612,7 @@ $$${mathData.mathjaxText}$$
61380
61612
  const imageObject = getImageObject(this.editor, block);
61381
61613
  const images = imageObject.getImages();
61382
61614
  const splitterIndex = this.data.splitterIndex;
61383
- assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61615
+ assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61384
61616
  const imageContainers = getImageContainersByBlock(block);
61385
61617
  const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
61386
61618
  this.initWidths = initWidths;
@@ -61398,7 +61630,7 @@ $$${mathData.mathjaxText}$$
61398
61630
  const imageObject = getImageObject(this.editor, block);
61399
61631
  const images = cloneDeep__default.default(imageObject.getImages());
61400
61632
  const splitterIndex = this.data.splitterIndex;
61401
- assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61633
+ assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
61402
61634
  const width1 = this.initWidths[splitterIndex];
61403
61635
  const width2 = this.initWidths[splitterIndex + 1];
61404
61636
  if (width1 + width2 < 100) {
@@ -61417,7 +61649,7 @@ $$${mathData.mathjaxText}$$
61417
61649
  newWidths[splitterIndex] += delta;
61418
61650
  newWidths[splitterIndex + 1] -= delta;
61419
61651
  const imageContainers = getImageContainersByBlock(block);
61420
- assert(logger$1y, imageContainers.length === images.length, "invalid image data");
61652
+ assert(logger$1x, imageContainers.length === images.length, "invalid image data");
61421
61653
  const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
61422
61654
  for (let i = 0; i < images.length; i++) {
61423
61655
  const flex = newWidths[i] / totalWidth;
@@ -61490,7 +61722,7 @@ $$${mathData.mathjaxText}$$
61490
61722
  editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
61491
61723
  editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
61492
61724
  }
61493
- const logger$1x = getLogger("image-item");
61725
+ const logger$1w = getLogger("image-item");
61494
61726
  function getParentImageBlock(eventTarget) {
61495
61727
  if (!eventTarget) {
61496
61728
  return null;
@@ -61569,7 +61801,7 @@ $$${mathData.mathjaxText}$$
61569
61801
  if (file2) {
61570
61802
  imageObject.replaceImage(index2, file2);
61571
61803
  } else {
61572
- logger$1x.warn(`failed to download image: ${imageData.src}`);
61804
+ logger$1w.warn(`failed to download image: ${imageData.src}`);
61573
61805
  }
61574
61806
  }
61575
61807
  function createLoadErrorElement(editor, imageContainer, imageData) {
@@ -61792,7 +62024,7 @@ $$${mathData.mathjaxText}$$
61792
62024
  function isImageFile(fileType) {
61793
62025
  return fileType.startsWith("image/");
61794
62026
  }
61795
- const logger$1w = getLogger("image-object");
62027
+ const logger$1v = getLogger("image-object");
61796
62028
  class ImageObject {
61797
62029
  constructor(editor, blockData) {
61798
62030
  __publicField(this, "images", []);
@@ -62083,7 +62315,7 @@ $$${mathData.mathjaxText}$$
62083
62315
  this.editor.updateEmbedData(block2, embedData);
62084
62316
  return true;
62085
62317
  } catch (err) {
62086
- logger$1w.error(err);
62318
+ logger$1v.error(err);
62087
62319
  const block2 = this.editor.findBlockById(this.blockData.id);
62088
62320
  if (!block2) {
62089
62321
  return false;
@@ -62100,7 +62332,7 @@ $$${mathData.mathjaxText}$$
62100
62332
  if (!block) {
62101
62333
  return;
62102
62334
  }
62103
- assert(logger$1w, flex.length === this.images.length, "invalid flex");
62335
+ assert(logger$1v, flex.length === this.images.length, "invalid flex");
62104
62336
  for (let i = 0; i < this.images.length; i++) {
62105
62337
  this.images[i].flex = flex[i];
62106
62338
  }
@@ -62149,7 +62381,7 @@ $$${mathData.mathjaxText}$$
62149
62381
  }
62150
62382
  }
62151
62383
  const imageEmbedStyle = "";
62152
- const logger$1v = getLogger("drop-indicator");
62384
+ const logger$1u = getLogger("drop-indicator");
62153
62385
  const INDICATOR_SIZE$1 = 2;
62154
62386
  class DropIndicator {
62155
62387
  constructor(editor) {
@@ -62194,7 +62426,7 @@ $$${mathData.mathjaxText}$$
62194
62426
  if (insertPos === "before") {
62195
62427
  const beforeBlock = getPrevVisibleBlock(block);
62196
62428
  if (!beforeBlock) {
62197
- assert(logger$1v, isChildContainer(getParentContainer(block)), "block does not in a child container");
62429
+ assert(logger$1u, isChildContainer(getParentContainer(block)), "block does not in a child container");
62198
62430
  const rect = block.getBoundingClientRect();
62199
62431
  const viewRect2 = this.getViewRect(block);
62200
62432
  return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
@@ -62220,14 +62452,14 @@ $$${mathData.mathjaxText}$$
62220
62452
  const PADDING = 5;
62221
62453
  if (insertPos.pos === "left") {
62222
62454
  const parent = getParentContainer(block);
62223
- assert(logger$1v, parent, "block does not in a container");
62455
+ assert(logger$1u, parent, "block does not in a container");
62224
62456
  const rect = block.getBoundingClientRect();
62225
62457
  const viewRect = this.getViewRect(block);
62226
62458
  return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
62227
62459
  }
62228
62460
  if (insertPos.pos === "right") {
62229
62461
  const parent = getParentContainer(block);
62230
- assert(logger$1v, parent, "block does not in a container");
62462
+ assert(logger$1u, parent, "block does not in a container");
62231
62463
  const rect = block.getBoundingClientRect();
62232
62464
  let viewRect;
62233
62465
  if (isEmbedBlock(block)) {
@@ -62324,7 +62556,7 @@ $$${mathData.mathjaxText}$$
62324
62556
  }
62325
62557
  return void 0;
62326
62558
  }
62327
- const logger$1u = getLogger("code-dom");
62559
+ const logger$1t = getLogger("code-dom");
62328
62560
  function isCodeBlock(block) {
62329
62561
  return getBlockType(block) === "code";
62330
62562
  }
@@ -62342,8 +62574,8 @@ $$${mathData.mathjaxText}$$
62342
62574
  }
62343
62575
  function getParentCodeBlock(elem) {
62344
62576
  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");
62577
+ assert(logger$1t, codeBlock2, "no parent code block");
62578
+ assert(logger$1t, isCodeBlock(codeBlock2), "not a code block");
62347
62579
  return codeBlock2;
62348
62580
  }
62349
62581
  const SUPPORTED_LANGUAGES = () => ({
@@ -62434,7 +62666,7 @@ $$${mathData.mathjaxText}$$
62434
62666
  function setDefaultLanguage(editor, lang) {
62435
62667
  return editor.settingsProvider.setItem("editor-code-lang", lang);
62436
62668
  }
62437
- const logger$1t = getLogger("convert-to-code");
62669
+ const logger$1s = getLogger("convert-to-code");
62438
62670
  function convertToCode(editor, srcBlock) {
62439
62671
  if (!isTextKindBlock(editor, srcBlock)) {
62440
62672
  return null;
@@ -62447,7 +62679,7 @@ $$${mathData.mathjaxText}$$
62447
62679
  const textContainerId = genId();
62448
62680
  editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
62449
62681
  const text2 = editor.getBlockData(srcBlock).text;
62450
- assert(logger$1t, text2, "no text");
62682
+ assert(logger$1s, text2, "no text");
62451
62683
  let alias = toPlainText(text2);
62452
62684
  if (alias.startsWith("```")) {
62453
62685
  alias = alias.substring(3);
@@ -62465,16 +62697,16 @@ $$${mathData.mathjaxText}$$
62465
62697
  };
62466
62698
  }
62467
62699
  const codeBlock = "";
62468
- const logger$1s = getLogger("code-block-child-container");
62700
+ const logger$1r = getLogger("code-block-child-container");
62469
62701
  function getTextContainer(codeBlock2) {
62470
- assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
62702
+ assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
62471
62703
  const content = getBlockContent(codeBlock2);
62472
62704
  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");
62705
+ assert(logger$1r, textContainer, "no code text container");
62474
62706
  return textContainer;
62475
62707
  }
62476
62708
  function getCaptionContainer(codeBlock2) {
62477
- assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
62709
+ assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
62478
62710
  const content = getBlockContent(codeBlock2);
62479
62711
  const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
62480
62712
  if (!textContainer)
@@ -62503,7 +62735,7 @@ $$${mathData.mathjaxText}$$
62503
62735
  }
62504
62736
  return getBlockType(block) === "code";
62505
62737
  }
62506
- const logger$1r = getLogger("code-caption");
62738
+ const logger$1q = getLogger("code-caption");
62507
62739
  function toggleCodeCaption(editor, codeBlock2) {
62508
62740
  if (editor.readonly) {
62509
62741
  return;
@@ -62516,7 +62748,7 @@ $$${mathData.mathjaxText}$$
62516
62748
  }
62517
62749
  const captionContainerId = createEmptyContainer(editor.doc);
62518
62750
  const oldData = editor.getBlockData(codeBlock2);
62519
- assert(logger$1r, oldData.children.length === 1, "code block should have only one child");
62751
+ assert(logger$1q, oldData.children.length === 1, "code block should have only one child");
62520
62752
  const newData = {
62521
62753
  ...oldData,
62522
62754
  children: [oldData.children[0], captionContainerId]
@@ -62532,7 +62764,7 @@ $$${mathData.mathjaxText}$$
62532
62764
  return false;
62533
62765
  }
62534
62766
  const parentBlock = getParentBlock(parentContainer);
62535
- assert(logger$1r, parentBlock, "no parent block");
62767
+ assert(logger$1q, parentBlock, "no parent block");
62536
62768
  if (!isCodeBlock(parentBlock)) {
62537
62769
  return false;
62538
62770
  }
@@ -62552,7 +62784,7 @@ $$${mathData.mathjaxText}$$
62552
62784
  const lastBlock2 = getLastChildBlock(textContainer);
62553
62785
  editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
62554
62786
  const oldData = editor.getBlockData(codeBlock2);
62555
- assert(logger$1r, oldData.children.length === 2, "code block should have only one child");
62787
+ assert(logger$1q, oldData.children.length === 2, "code block should have only one child");
62556
62788
  const captionContainerId = oldData.children[1];
62557
62789
  const newData = {
62558
62790
  ...oldData,
@@ -62561,7 +62793,7 @@ $$${mathData.mathjaxText}$$
62561
62793
  editor.updateBlockData(codeBlock2, newData);
62562
62794
  editor.deleteChildContainers([captionContainerId]);
62563
62795
  }
62564
- const logger$1q = getLogger("paste-in-table-block");
62796
+ const logger$1p = getLogger("paste-in-table-block");
62565
62797
  class PasteEventHandler {
62566
62798
  constructor(editor) {
62567
62799
  this.editor = editor;
@@ -62582,7 +62814,7 @@ $$${mathData.mathjaxText}$$
62582
62814
  return false;
62583
62815
  }
62584
62816
  const parentBlock = getParentBlock(parentContainer);
62585
- assert(logger$1q, parentBlock, "no parent block");
62817
+ assert(logger$1p, parentBlock, "no parent block");
62586
62818
  if (!isCodeBlock(parentBlock)) {
62587
62819
  return false;
62588
62820
  }
@@ -62646,7 +62878,7 @@ $$${mathData.mathjaxText}$$
62646
62878
  function registerCodeBlockCommandProvider(editor) {
62647
62879
  editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
62648
62880
  }
62649
- const logger$1p = getLogger("code-caption-input-handler");
62881
+ const logger$1o = getLogger("code-caption-input-handler");
62650
62882
  function getCurrentCaptionBlock(editor) {
62651
62883
  if (!editor.selection.range.isSimple()) {
62652
62884
  return null;
@@ -62759,7 +62991,7 @@ $$${mathData.mathjaxText}$$
62759
62991
  editor.undoManager.runInGroup(() => {
62760
62992
  editor.clearSelectedContents();
62761
62993
  const start = editor.selection.range.start;
62762
- assert(logger$1p, start.isSimple(), "not simple position");
62994
+ assert(logger$1o, start.isSimple(), "not simple position");
62763
62995
  editor.insertTextToBlock(block, start.offset, text2);
62764
62996
  });
62765
62997
  return true;
@@ -62804,9 +63036,9 @@ $$${mathData.mathjaxText}$$
62804
63036
  };
62805
63037
  editor.updateBlockData(codeBlock2, newData);
62806
63038
  }
62807
- const logger$1o = getLogger("code-block-header");
63039
+ const logger$1n = getLogger("code-block-header");
62808
63040
  function selectCodeBlock(editor, block, options) {
62809
- assert(logger$1o, isCodeBlock(block), "not a code block");
63041
+ assert(logger$1n, isCodeBlock(block), "not a code block");
62810
63042
  const firstBlock = getFirstChildBlock(getTextContainer(block));
62811
63043
  editor.selection.selectBlock(firstBlock, 0);
62812
63044
  if (options.focusToEditor) {
@@ -62848,8 +63080,8 @@ $$${mathData.mathjaxText}$$
62848
63080
  const target = event.target;
62849
63081
  const select2 = target.closest(".language-select");
62850
63082
  const block = getParentBlock(select2);
62851
- assert(logger$1o, block, "no parent block");
62852
- assert(logger$1o, getBlockType(block) === "code", "not a code block");
63083
+ assert(logger$1n, block, "no parent block");
63084
+ assert(logger$1n, getBlockType(block) === "code", "not a code block");
62853
63085
  const codeData = editor2.getBlockData(block);
62854
63086
  const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
62855
63087
  dropdown2.custom = { codeBlock: block, editor: editor2 };
@@ -62872,11 +63104,11 @@ $$${mathData.mathjaxText}$$
62872
63104
  function handleCodeHeaderButtonClick(editor, event) {
62873
63105
  const target = event.target;
62874
63106
  const button2 = target.closest(".code-header-button");
62875
- assert(logger$1o, button2, "no button");
63107
+ assert(logger$1n, button2, "no button");
62876
63108
  const block = getParentBlock(target);
62877
- assert(logger$1o, block, "no parent block");
63109
+ assert(logger$1n, block, "no parent block");
62878
63110
  const id = button2.getAttribute("data-id");
62879
- assert(logger$1o, getBlockType(block) === "code", "not a code block");
63111
+ assert(logger$1n, getBlockType(block) === "code", "not a code block");
62880
63112
  if (id === "wrap") {
62881
63113
  const old = editor.getBlockData(block);
62882
63114
  changeCodeBlockWrap(editor, block, !old.nowrap);
@@ -62902,7 +63134,7 @@ $$${mathData.mathjaxText}$$
62902
63134
  }
62903
63135
  });
62904
63136
  }).catch((err) => {
62905
- logger$1o.error(err.message);
63137
+ logger$1n.error(err.message);
62906
63138
  });
62907
63139
  return;
62908
63140
  }
@@ -62953,7 +63185,7 @@ $$${mathData.mathjaxText}$$
62953
63185
  }
62954
63186
  function getCodeBlockHeader(block) {
62955
63187
  const header = block.querySelector(".code-block-header");
62956
- assert(logger$1o, header, "no code block header");
63188
+ assert(logger$1n, header, "no code block header");
62957
63189
  return header;
62958
63190
  }
62959
63191
  function handleCodeScroll(editor, event) {
@@ -63002,7 +63234,7 @@ $$${mathData.mathjaxText}$$
63002
63234
  focusBlockId: textBlock.id
63003
63235
  };
63004
63236
  }
63005
- const logger$1n = getLogger("code-block");
63237
+ const logger$1m = getLogger("code-block");
63006
63238
  function getPaddingNum(index2) {
63007
63239
  if (index2 <= 2) {
63008
63240
  return 32;
@@ -63029,10 +63261,10 @@ $$${mathData.mathjaxText}$$
63029
63261
  handlePasteInTableEvent(editor);
63030
63262
  registerCodeBlockCommandProvider(editor);
63031
63263
  trackChildBlockEvent(editor, handleDebounceUpdate);
63032
- assert(logger$1n, blockData.type === "code", "invalid block data type");
63264
+ assert(logger$1m, blockData.type === "code", "invalid block data type");
63033
63265
  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");
63266
+ assert(logger$1m, codeData.children, "invalid block data children");
63267
+ assert(logger$1m, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
63036
63268
  setTimeout(() => {
63037
63269
  if (isNodeRemoved(blockElement))
63038
63270
  return;
@@ -63083,15 +63315,15 @@ $$${mathData.mathjaxText}$$
63083
63315
  }
63084
63316
  function updateSelection$3(editor, block, from, to) {
63085
63317
  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");
63318
+ assert(logger$1m, to.isSimple(), "from is simple position but to is not simple position");
63319
+ logger$1m.debug("full select list");
63088
63320
  addClass(block, "full-selected");
63089
63321
  return;
63090
63322
  }
63091
- assert(logger$1n, !to.isSimple(), "from is complex position but end is simple position");
63323
+ assert(logger$1m, !to.isSimple(), "from is complex position but end is simple position");
63092
63324
  const f = from;
63093
63325
  const t2 = to;
63094
- assert(logger$1n, f.blockId === t2.blockId, "only allow update one table selection");
63326
+ assert(logger$1m, f.blockId === t2.blockId, "only allow update one table selection");
63095
63327
  const containers = getCodeChildContainers(block);
63096
63328
  containers.forEach((container) => {
63097
63329
  const containerId = getContainerId(container);
@@ -63126,8 +63358,8 @@ $$${mathData.mathjaxText}$$
63126
63358
  const containersIds = childContainers.map(getContainerId);
63127
63359
  const startIndex = containersIds.indexOf(start.childContainerId);
63128
63360
  const endIndex = containersIds.indexOf(end.childContainerId);
63129
- assert(logger$1n, startIndex !== -1, "invalid start pos");
63130
- assert(logger$1n, endIndex !== -1, "invalid end pos");
63361
+ assert(logger$1m, startIndex !== -1, "invalid start pos");
63362
+ assert(logger$1m, endIndex !== -1, "invalid end pos");
63131
63363
  const ret = [childContainers[startIndex]];
63132
63364
  if (startIndex !== endIndex) {
63133
63365
  ret.push(childContainers[endIndex]);
@@ -63135,7 +63367,7 @@ $$${mathData.mathjaxText}$$
63135
63367
  return ret;
63136
63368
  }
63137
63369
  function handleBlockElementUpdated(editor, block, blockData) {
63138
- assert(logger$1n, isCodeBlock(block), "invalid block type");
63370
+ assert(logger$1m, isCodeBlock(block), "invalid block type");
63139
63371
  const codeData = blockData;
63140
63372
  updateCodeBlockElementStyles(editor, block, codeData);
63141
63373
  }
@@ -63327,10 +63559,10 @@ ${codeText}
63327
63559
  "Shift+Tab": handleShiftTab$1,
63328
63560
  "CtrlOrCmd+A": selectCode
63329
63561
  };
63330
- const logger$1m = getLogger("code-text-decorate");
63562
+ const logger$1l = getLogger("code-text-decorate");
63331
63563
  class CodeTextDecorator {
63332
63564
  decorateText(editor, path, blockText) {
63333
- assert(logger$1m, path.length > 0, "invalid path");
63565
+ assert(logger$1l, path.length > 0, "invalid path");
63334
63566
  if (path.length === 1) {
63335
63567
  return {};
63336
63568
  }
@@ -63355,7 +63587,7 @@ ${codeText}
63355
63587
  const grammar = getPrismGrammar(codeData.language);
63356
63588
  const tokens = Prism__default.default.tokenize(code, grammar);
63357
63589
  const tokenToText = (token, attributes) => {
63358
- assert(logger$1m, token, "no token");
63590
+ assert(logger$1l, token, "no token");
63359
63591
  if (typeof token === "string") {
63360
63592
  const ret = {
63361
63593
  insert: token,
@@ -63363,7 +63595,7 @@ ${codeText}
63363
63595
  };
63364
63596
  return [ret];
63365
63597
  }
63366
- assert(logger$1m, token instanceof Prism__default.default.Token, "invalid token type");
63598
+ assert(logger$1l, token instanceof Prism__default.default.Token, "invalid token type");
63367
63599
  const content = token.content;
63368
63600
  const newAttributes = cloneDeep__default.default(attributes);
63369
63601
  newAttributes[`style-code-${token.type}`] = true;
@@ -63379,18 +63611,18 @@ ${codeText}
63379
63611
  const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
63380
63612
  return ret;
63381
63613
  }
63382
- assert(logger$1m, content instanceof Prism__default.default.Token, "invalid token");
63614
+ assert(logger$1l, content instanceof Prism__default.default.Token, "invalid token");
63383
63615
  return tokenToText(content, newAttributes);
63384
63616
  };
63385
63617
  const ops = tokens.map((token) => tokenToText(token, {}));
63386
63618
  const newText = ops.flat();
63387
- assert(logger$1m, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
63619
+ assert(logger$1l, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
63388
63620
  return {
63389
63621
  text: newText
63390
63622
  };
63391
63623
  }
63392
63624
  }
63393
- const zhCN$p = {
63625
+ const zhCN$o = {
63394
63626
  code: {
63395
63627
  title: "\u4EE3\u7801",
63396
63628
  abstract: "\u4EE3\u7801",
@@ -63402,7 +63634,7 @@ ${codeText}
63402
63634
  plainText: "Plain Text"
63403
63635
  }
63404
63636
  };
63405
- const enUS$p = {
63637
+ const enUS$o = {
63406
63638
  code: {
63407
63639
  title: "Code",
63408
63640
  abstract: "Code",
@@ -63414,7 +63646,7 @@ ${codeText}
63414
63646
  plainText: "Plain Text"
63415
63647
  }
63416
63648
  };
63417
- const jaJP$p = {
63649
+ const jaJP$o = {
63418
63650
  code: {
63419
63651
  title: "\u30B3\u30FC\u30C9",
63420
63652
  abstract: "\u30B3\u30FC\u30C9",
@@ -63427,9 +63659,9 @@ ${codeText}
63427
63659
  }
63428
63660
  };
63429
63661
  i18n$1.mergeLang({
63430
- "zh-CN": zhCN$p,
63431
- "en-US": enUS$p,
63432
- "ja-JP": jaJP$p
63662
+ "zh-CN": zhCN$o,
63663
+ "en-US": enUS$o,
63664
+ "ja-JP": jaJP$o
63433
63665
  });
63434
63666
  function convertToTable(editor, containerId, blockIndex, offset) {
63435
63667
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -63690,7 +63922,7 @@ ${codeText}
63690
63922
  }
63691
63923
  return false;
63692
63924
  }
63693
- const logger$1l = getLogger("match-text-style");
63925
+ const logger$1k = getLogger("match-text-style");
63694
63926
  function matchTextPair(text2, find) {
63695
63927
  if (text2.length < find.length * 2 + 1) {
63696
63928
  return -1;
@@ -63760,7 +63992,7 @@ ${codeText}
63760
63992
  editor.insertBoxToBlock(block, start, boxData);
63761
63993
  });
63762
63994
  } catch (err) {
63763
- logger$1l.warn(`failed to convert to box, ${err.message}`);
63995
+ logger$1k.warn(`failed to convert to box, ${err.message}`);
63764
63996
  continue;
63765
63997
  }
63766
63998
  }
@@ -63823,7 +64055,7 @@ ${codeText}
63823
64055
  return false;
63824
64056
  }
63825
64057
  }
63826
- const enUS$o = {
64058
+ const enUS$n = {
63827
64059
  placeholder: {
63828
64060
  default: "Type / for commands",
63829
64061
  heading: "Heading {heading}",
@@ -63834,7 +64066,7 @@ ${codeText}
63834
64066
  mobileDefault: "Type to add content"
63835
64067
  }
63836
64068
  };
63837
- const zhCN$o = {
64069
+ const zhCN$n = {
63838
64070
  placeholder: {
63839
64071
  default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
63840
64072
  heading: "\u6807\u9898{heading}",
@@ -63845,7 +64077,7 @@ ${codeText}
63845
64077
  mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
63846
64078
  }
63847
64079
  };
63848
- const jaJP$o = {
64080
+ const jaJP$n = {
63849
64081
  placeholder: {
63850
64082
  default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
63851
64083
  heading: "\u898B\u51FA\u3057{heading}",
@@ -63857,9 +64089,9 @@ ${codeText}
63857
64089
  }
63858
64090
  };
63859
64091
  const langs$1 = {
63860
- "en-US": enUS$o,
63861
- "zh-CN": zhCN$o,
63862
- "ja-JP": jaJP$o
64092
+ "en-US": enUS$n,
64093
+ "zh-CN": zhCN$n,
64094
+ "ja-JP": jaJP$n
63863
64095
  };
63864
64096
  i18n$1.mergeLang(langs$1);
63865
64097
  function isEmptyTextBlockWithoutCompositionText(editor, block) {
@@ -64026,7 +64258,7 @@ ${codeText}
64026
64258
  }
64027
64259
  return false;
64028
64260
  }
64029
- const logger$1k = getLogger("enforce-title");
64261
+ const logger$1j = getLogger("enforce-title");
64030
64262
  class EnforceWithDocumentTitleHandler {
64031
64263
  constructor(editor, options = {
64032
64264
  headingLevel: 1
@@ -64098,7 +64330,7 @@ ${codeText}
64098
64330
  var _a, _b;
64099
64331
  try {
64100
64332
  const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
64101
- assert(logger$1k, blocks.length > 0, "root container is empty");
64333
+ assert(logger$1j, blocks.length > 0, "root container is empty");
64102
64334
  const firstBlock = blocks[0];
64103
64335
  if (firstBlock.type !== "text" && !this.options.hideTitle) {
64104
64336
  const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
@@ -64107,7 +64339,7 @@ ${codeText}
64107
64339
  return;
64108
64340
  }
64109
64341
  if (!this.options.hideTitle) {
64110
- assert(logger$1k, firstBlock.text, "invalid text block");
64342
+ assert(logger$1j, firstBlock.text, "invalid text block");
64111
64343
  const block = editor.getBlockById(firstBlock.id);
64112
64344
  if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
64113
64345
  const text2 = editor.getBlockString(block);
@@ -64192,7 +64424,7 @@ ${codeText}
64192
64424
  });
64193
64425
  return orgDataUrl;
64194
64426
  }
64195
- const logger$1j = getLogger("drag-preview-image");
64427
+ const logger$1i = getLogger("drag-preview-image");
64196
64428
  class DragPreviewImage {
64197
64429
  constructor(editor) {
64198
64430
  __publicField(this, "startPosition", null);
@@ -64200,7 +64432,7 @@ ${codeText}
64200
64432
  __publicField(this, "handleDragStart", async (e2, preview) => {
64201
64433
  var _a, _b, _c, _d, _e, _f;
64202
64434
  const target = e2.target;
64203
- assert(logger$1j, target instanceof Element, `Invalid Drag target:${target}`);
64435
+ assert(logger$1i, target instanceof Element, `Invalid Drag target:${target}`);
64204
64436
  const { x: startX, y: startY } = e2;
64205
64437
  this.startPosition = {
64206
64438
  x: startX,
@@ -64286,7 +64518,7 @@ ${codeText}
64286
64518
  }
64287
64519
  return block;
64288
64520
  }
64289
- const logger$1i = getLogger("block-menu-drag-handler");
64521
+ const logger$1h = getLogger("block-menu-drag-handler");
64290
64522
  const MIN_DISTANCE_THRESHOLD$1 = 3;
64291
64523
  function createDragEventFromMouseEvent$2(event, type) {
64292
64524
  const dragEvent = new DragEvent(type, {
@@ -64308,7 +64540,7 @@ ${codeText}
64308
64540
  __publicField(this, "startPos", { x: 0, y: 0 });
64309
64541
  __publicField(this, "handleMouseDown", (event) => {
64310
64542
  const block = this.button.blockMenu.currentBlock;
64311
- assert(logger$1i, block, "no dragged block");
64543
+ assert(logger$1h, block, "no dragged block");
64312
64544
  if (event.button !== 0) {
64313
64545
  return;
64314
64546
  }
@@ -64336,7 +64568,7 @@ ${codeText}
64336
64568
  });
64337
64569
  }
64338
64570
  const block = this.button.blockMenu.currentBlock;
64339
- assert(logger$1i, block, "no dragged block");
64571
+ assert(logger$1h, block, "no dragged block");
64340
64572
  (_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
64341
64573
  const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
64342
64574
  registerStandardDraggedObject(this.editor, dragEvent, block);
@@ -64357,7 +64589,7 @@ ${codeText}
64357
64589
  if (!window.isDragging) {
64358
64590
  this.handleDragStart(event);
64359
64591
  }
64360
- assert(logger$1i, target instanceof Element, "target is invalid");
64592
+ assert(logger$1h, target instanceof Element, "target is invalid");
64361
64593
  this.dragPreview.handleDrag(event);
64362
64594
  const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
64363
64595
  this.editor.contentElement.dispatchEvent(dragEvent);
@@ -64365,7 +64597,7 @@ ${codeText}
64365
64597
  __publicField(this, "handleDragEnd", (event) => {
64366
64598
  var _a;
64367
64599
  const block = this.button.blockMenu.currentBlock;
64368
- assert(logger$1i, block, "no dragged block");
64600
+ assert(logger$1h, block, "no dragged block");
64369
64601
  window.isDragging = false;
64370
64602
  this.dragPreview.handleDragEnd();
64371
64603
  (_a = this.autoScroll) == null ? void 0 : _a.inactive();
@@ -64588,7 +64820,7 @@ ${codeText}
64588
64820
  this.rootButton.destroy();
64589
64821
  }
64590
64822
  }
64591
- const zhCN$n = {
64823
+ const zhCN$m = {
64592
64824
  blockMenu: {
64593
64825
  section: {
64594
64826
  basics: "\u57FA\u7840",
@@ -64612,7 +64844,7 @@ ${codeText}
64612
64844
  }
64613
64845
  }
64614
64846
  };
64615
- const enUS$n = {
64847
+ const enUS$m = {
64616
64848
  blockMenu: {
64617
64849
  section: {
64618
64850
  basics: "Basic",
@@ -64636,7 +64868,7 @@ ${codeText}
64636
64868
  }
64637
64869
  }
64638
64870
  };
64639
- const jaJP$n = {
64871
+ const jaJP$m = {
64640
64872
  blockMenu: {
64641
64873
  section: {
64642
64874
  basics: "\u4E00\u822C",
@@ -64661,9 +64893,9 @@ ${codeText}
64661
64893
  }
64662
64894
  };
64663
64895
  i18n$1.mergeLang({
64664
- "zh-CN": zhCN$n,
64665
- "en-US": enUS$n,
64666
- "ja-JP": jaJP$n
64896
+ "zh-CN": zhCN$m,
64897
+ "en-US": enUS$m,
64898
+ "ja-JP": jaJP$m
64667
64899
  });
64668
64900
  const style$6 = "";
64669
64901
  class DragData {
@@ -64743,7 +64975,7 @@ ${codeText}
64743
64975
  function clearDraggedObject(editor) {
64744
64976
  getDragData(editor).clearData();
64745
64977
  }
64746
- const logger$1h = getLogger("find-drop-target");
64978
+ const logger$1g = getLogger("find-drop-target");
64747
64979
  function childContainerFromPoint(x, y) {
64748
64980
  const elem = getElementFromPoint(x, y);
64749
64981
  if (!elem) {
@@ -64856,13 +65088,13 @@ ${codeText}
64856
65088
  return true;
64857
65089
  }
64858
65090
  const parentBlock = getParentBlock(container);
64859
- assert(logger$1h, parentBlock, "no parent block");
65091
+ assert(logger$1g, parentBlock, "no parent block");
64860
65092
  if (!editor.isBlockWritable(parentBlock)) {
64861
65093
  return false;
64862
65094
  }
64863
65095
  return canInsertAsSibling(editor, parentBlock);
64864
65096
  }
64865
- const logger$1g = getLogger("drop-target");
65097
+ const logger$1f = getLogger("drop-target");
64866
65098
  function getEmbedClassByFile(editor, file2) {
64867
65099
  let embedClass = {};
64868
65100
  if (/image/.test(file2.type)) {
@@ -64872,7 +65104,7 @@ ${codeText}
64872
65104
  } else if (/video/.test(file2.type)) {
64873
65105
  embedClass = editor.editorEmbeds.getEmbedClass("video");
64874
65106
  }
64875
- assert(logger$1g, embedClass, `unSupport file type ${file2.type}`);
65107
+ assert(logger$1f, embedClass, `unSupport file type ${file2.type}`);
64876
65108
  return embedClass;
64877
65109
  }
64878
65110
  async function patchInsertFile(editor, files, containerId, blockIndex) {
@@ -65622,7 +65854,7 @@ ${codeText}
65622
65854
  }
65623
65855
  }
65624
65856
  }
65625
- const zhCN$m = {
65857
+ const zhCN$l = {
65626
65858
  image: {
65627
65859
  title: "\u56FE\u7247",
65628
65860
  upload: {
@@ -65638,7 +65870,7 @@ ${codeText}
65638
65870
  abstract: "\u56FE\u7247"
65639
65871
  }
65640
65872
  };
65641
- const enUS$m = {
65873
+ const enUS$l = {
65642
65874
  image: {
65643
65875
  title: "Image",
65644
65876
  upload: {
@@ -65654,7 +65886,7 @@ ${codeText}
65654
65886
  abstract: "Image"
65655
65887
  }
65656
65888
  };
65657
- const jaJP$m = {
65889
+ const jaJP$l = {
65658
65890
  image: {
65659
65891
  title: "\u753B\u50CF",
65660
65892
  upload: {
@@ -65671,9 +65903,9 @@ ${codeText}
65671
65903
  }
65672
65904
  };
65673
65905
  i18n$1.mergeLang({
65674
- "zh-CN": zhCN$m,
65675
- "en-US": enUS$m,
65676
- "ja-JP": jaJP$m
65906
+ "zh-CN": zhCN$l,
65907
+ "en-US": enUS$l,
65908
+ "ja-JP": jaJP$l
65677
65909
  });
65678
65910
  function convertToImage(editor, containerId, blockIndex, offset) {
65679
65911
  const block = editor.getBlockByIndex(containerId, blockIndex);
@@ -65727,7 +65959,7 @@ ${codeText}
65727
65959
  return false;
65728
65960
  }
65729
65961
  }
65730
- const logger$1f = getLogger("copy-image");
65962
+ const logger$1e = getLogger("copy-image");
65731
65963
  function getImageClipboardData(editor, img, imageObject, index2) {
65732
65964
  const imageData = imageObject.getImages()[index2];
65733
65965
  const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
@@ -65768,7 +66000,7 @@ ${codeText}
65768
66000
  });
65769
66001
  clipboardData["image/png"] = fileBlob;
65770
66002
  } catch (error2) {
65771
- logger$1f.error(error2);
66003
+ logger$1e.error(error2);
65772
66004
  }
65773
66005
  addMetaToDoc(editor, doc2);
65774
66006
  const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
@@ -66041,195 +66273,6 @@ ${codeText}
66041
66273
  }
66042
66274
  return getDragInsertPos(editor, block, images, x);
66043
66275
  }
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
66276
  class ImageHoveringToolbarCommands$1 {
66234
66277
  constructor(editor, block) {
66235
66278
  __publicField(this, "group", "hovering-toolbar");
@@ -66301,7 +66344,7 @@ ${codeText}
66301
66344
  executeCommand(editor, block, item) {
66302
66345
  switch (item.id) {
66303
66346
  case "addComment":
66304
- addCommentToBlock(editor, block);
66347
+ addCommentToBlock$1(editor, block);
66305
66348
  break;
66306
66349
  case "left":
66307
66350
  case "center":
@@ -67617,7 +67660,7 @@ ${codeText}
67617
67660
  });
67618
67661
  });
67619
67662
  __publicField(this, "handleEditorResize", () => {
67620
- this.updateItemsLayout();
67663
+ this.updateItemsLayout(false);
67621
67664
  });
67622
67665
  __publicField(this, "handleDocChanged", () => {
67623
67666
  this.updateComments();
@@ -67694,9 +67737,11 @@ ${codeText}
67694
67737
  this.removeAllListeners();
67695
67738
  document.removeEventListener("click", this.handleDocumentClick);
67696
67739
  }
67697
- updateItemsLayout() {
67740
+ updateItemsLayout(dispatchScroll = true) {
67698
67741
  arrangeItems(this.editor, this.items, this.activeItem);
67699
- this.dispatchScroll();
67742
+ if (dispatchScroll) {
67743
+ this.dispatchScroll();
67744
+ }
67700
67745
  }
67701
67746
  bindEvents() {
67702
67747
  this.container.addEventListener("click", this.handleContainerClick);
@@ -68563,7 +68608,7 @@ ${codeText}
68563
68608
  const types2 = ["table", "layout"];
68564
68609
  if (types2.includes(getBlockType(block))) {
68565
68610
  editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
68566
- comment = addCommentToBlock$1(editor, block, this.provider);
68611
+ comment = addCommentToBlock(editor, block, this.provider);
68567
68612
  }
68568
68613
  }
68569
68614
  comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
@@ -68584,7 +68629,7 @@ ${codeText}
68584
68629
  try {
68585
68630
  this.editorComments.showCommentList();
68586
68631
  const block2 = editor.getBlockById(blockId);
68587
- addCommentToBlock$1(editor, block2, this.provider);
68632
+ addCommentToBlock(editor, block2, this.provider);
68588
68633
  } catch (err) {
68589
68634
  logger$13.error(`failed to execute block command: ${JSON.stringify(err)}`);
68590
68635
  }
@@ -68593,14 +68638,24 @@ ${codeText}
68593
68638
  this.editorComments = editorComments;
68594
68639
  }
68595
68640
  commands(editor, blockElement, child) {
68596
- var _a;
68597
- if (editor.readonly) {
68641
+ if (editor.readonly || clientType.isMobile) {
68598
68642
  return void 0;
68599
68643
  }
68600
68644
  const data2 = getBlockId(blockElement);
68601
68645
  if (child) {
68602
- const whitList = ["file"];
68603
- if (isTextBlockContentBoxChild(child) && whitList.includes((_a = child.getAttribute("data-box-type")) != null ? _a : "")) {
68646
+ const showCommandsBar = (child2) => {
68647
+ var _a, _b, _c;
68648
+ if (!child2 || !isTextBlockContentBoxChild(child2)) {
68649
+ return false;
68650
+ }
68651
+ const box = child2;
68652
+ const boxCommands = (_b = (_a = editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.getBoxProperties) == null ? void 0 : _b.call(_a, editor, box).boxCommands;
68653
+ if (!boxCommands) {
68654
+ return false;
68655
+ }
68656
+ return ((_c = boxCommands["hovering-toolbar"]) == null ? void 0 : _c.commands.length) > 0;
68657
+ };
68658
+ if (showCommandsBar(child)) {
68604
68659
  return {
68605
68660
  group: "hovering-toolbar",
68606
68661
  commands: [
@@ -68920,11 +68975,11 @@ ${codeText}
68920
68975
  const { containerId } = path[path.length - 1];
68921
68976
  const targetBlock = getParentBlock(getContainerById(editor, containerId));
68922
68977
  if (targetBlock && getBlockType(targetBlock) === "code") {
68923
- addCommentToBlock$1(editor, targetBlock, editorComments.commentProvider);
68978
+ addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
68924
68979
  return;
68925
68980
  }
68926
68981
  }
68927
- addCommentToBlock$1(editor, block, editorComments.commentProvider);
68982
+ addCommentToBlock(editor, block, editorComments.commentProvider);
68928
68983
  return;
68929
68984
  }
68930
68985
  const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
@@ -69160,7 +69215,7 @@ ${codeText}
69160
69215
  editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
69161
69216
  const editorComments = editor2.getCustom("editor-comments");
69162
69217
  editorComments.showCommentList();
69163
- addCommentToBlock$1(editor2, block, editorComments.commentProvider);
69218
+ addCommentToBlock(editor2, block, editorComments.commentProvider);
69164
69219
  }
69165
69220
  }
69166
69221
  };
@@ -69197,7 +69252,7 @@ ${codeText}
69197
69252
  const selectedBlock = range.getSelectedBlocks()[0];
69198
69253
  if (selectedBlock) {
69199
69254
  const editorComments = editor.getCustom("editor-comments");
69200
- addCommentToBlock$1(editor, selectedBlock.block, editorComments.commentProvider);
69255
+ addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
69201
69256
  }
69202
69257
  return;
69203
69258
  }
@@ -76455,7 +76510,7 @@ ${content}
76455
76510
  } else if (item.id === "download") {
76456
76511
  downloadFile$1(editor, box);
76457
76512
  } else if (item.id === "add-comment") {
76458
- addCommentToBlock(editor, block);
76513
+ addCommentToBlock$1(editor, block);
76459
76514
  }
76460
76515
  }
76461
76516
  }
@@ -76747,7 +76802,7 @@ ${content}
76747
76802
  } else if (item.id === "download") {
76748
76803
  downloadFile(editor, block);
76749
76804
  } else if (item.id === "add-comment") {
76750
- addCommentToBlock(editor, block);
76805
+ addCommentToBlock$1(editor, block);
76751
76806
  }
76752
76807
  }
76753
76808
  }
@@ -86254,7 +86309,7 @@ ${data2.flowchartText}
86254
86309
  executeCommand(editor, block, item) {
86255
86310
  switch (item.id) {
86256
86311
  case "addComment":
86257
- addCommentToBlock(editor, block);
86312
+ addCommentToBlock$1(editor, block);
86258
86313
  break;
86259
86314
  case "left":
86260
86315
  case "center":
@@ -88286,7 +88341,7 @@ ${data2.flowchartText}
88286
88341
  }
88287
88342
  }
88288
88343
  });
88289
- editor.version = "2.2.12-beta.3";
88344
+ editor.version = "2.2.13-beta.1";
88290
88345
  return editor;
88291
88346
  }
88292
88347
  function isDoc(doc2) {
@@ -88381,7 +88436,7 @@ ${data2.flowchartText}
88381
88436
  });
88382
88437
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88383
88438
  OnesEditorToolbar.register(editor);
88384
- editor.version = "2.2.12-beta.3";
88439
+ editor.version = "2.2.13-beta.1";
88385
88440
  return editor;
88386
88441
  }
88387
88442
  async function showDocVersions(editor, options, serverUrl) {
@@ -134225,6 +134280,7 @@ ${data2.flowchartText}
134225
134280
  exports2.ShareDBLocalDoc = ShareDBLocalDoc;
134226
134281
  exports2.ShareDBServer = ShareDBServer;
134227
134282
  exports2.SimpleCache = SimpleCache;
134283
+ exports2.StandardBoxCommands = StandardBoxCommands;
134228
134284
  exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
134229
134285
  exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
134230
134286
  exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
@@ -134243,7 +134299,7 @@ ${data2.flowchartText}
134243
134299
  exports2.addAttribute = addAttribute;
134244
134300
  exports2.addClass = addClass;
134245
134301
  exports2.addColor = addColor;
134246
- exports2.addCommentToBlock = addCommentToBlock;
134302
+ exports2.addCommentToBlock = addCommentToBlock$1;
134247
134303
  exports2.addDays = addDays;
134248
134304
  exports2.addMetaToDoc = addMetaToDoc;
134249
134305
  exports2.addMonths = addMonths;