@ones-editor/editor 2.9.7 → 2.9.8-beta.10

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.
Files changed (31) hide show
  1. package/@ones-editor/cke-html/package.json +7 -0
  2. package/@ones-editor/cke-html/src/html/cke-html.d.ts +4 -0
  3. package/@ones-editor/cke-html/src/html/combine-html.d.ts +2 -0
  4. package/@ones-editor/cke-html/src/html/comment.d.ts +6 -0
  5. package/@ones-editor/cke-html/src/html/converter.d.ts +7 -0
  6. package/@ones-editor/cke-html/src/html/data-helper/link-data.d.ts +0 -0
  7. package/@ones-editor/cke-html/src/html/image.d.ts +4 -0
  8. package/@ones-editor/cke-html/src/html/link.d.ts +2 -0
  9. package/@ones-editor/cke-html/src/html/markdown.d.ts +2 -0
  10. package/@ones-editor/cke-html/src/html/mention.d.ts +4 -0
  11. package/@ones-editor/cke-html/src/index.d.ts +2 -0
  12. package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -0
  13. package/@ones-editor/core/src/core/doc/doc.d.ts +3 -1
  14. package/@ones-editor/core/src/core/input-handler/remove-unknown-components.d.ts +3 -0
  15. package/@ones-editor/core/src/core/types.d.ts +1 -0
  16. package/@ones-editor/core/src/users/remote-users.d.ts +1 -1
  17. package/@ones-editor/main-toolbar/src/index.d.ts +8 -1
  18. package/@ones-editor/main-toolbar/src/items/file.d.ts +8 -0
  19. package/@ones-editor/main-toolbar/src/items/index.d.ts +4 -2
  20. package/@ones-editor/main-toolbar/src/items/mention.d.ts +8 -0
  21. package/@ones-editor/main-toolbar/src/locale/en-us.d.ts +3 -0
  22. package/@ones-editor/main-toolbar/src/locale/ja-jp.d.ts +3 -0
  23. package/@ones-editor/main-toolbar/src/locale/zh-cn.d.ts +3 -0
  24. package/@ones-editor/main-toolbar/src/locale/zh-hant-hk.d.ts +3 -0
  25. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  26. package/@ones-editor/ui-base/src/command-bar/types.d.ts +13 -7
  27. package/@ones-editor/ui-base/src/icons/index.d.ts +3 -1
  28. package/dist/index.d.ts +2 -1
  29. package/dist/index.js +711 -164
  30. package/dist/types.d.ts +1 -0
  31. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3855,7 +3855,7 @@ div.comment-editor-root [data-type=editor-container].root div[data-type=editor-b
3855
3855
  min-width: 0;
3856
3856
  }
3857
3857
  .editor-root:not(.mobile) [data-type=editor-container].root div[data-type=editor-block].code-block {
3858
- min-width: 360px;
3858
+ min-width: 200px;
3859
3859
  }div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-align=center] [data-type=block-content][data-content-placeholder]::before {
3860
3860
  justify-content: center;
3861
3861
  }
@@ -5658,22 +5658,11 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
5658
5658
  color: #87888A;
5659
5659
  font-size: 12px;
5660
5660
  }
5661
- div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-info .file-creator {
5662
- max-width: 80px;
5663
- white-space: nowrap;
5664
- overflow: hidden;
5665
- text-overflow: ellipsis;
5666
- }
5667
- div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-info .uploaded-time {
5668
- margin-left: 5px;
5661
+ div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-info .info {
5669
5662
  white-space: nowrap;
5670
5663
  overflow: hidden;
5671
5664
  text-overflow: ellipsis;
5672
5665
  }
5673
- div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-info .file-size {
5674
- margin-left: 15px;
5675
- flex-shrink: 0;
5676
- }
5677
5666
  div.editor-root div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root .file-actions {
5678
5667
  position: absolute;
5679
5668
  top: 0;
@@ -5728,10 +5717,10 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
5728
5717
  height: 24px;
5729
5718
  }
5730
5719
  div.editor-root:not(.mobile) div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] {
5731
- min-width: 360px;
5720
+ min-width: 200px;
5732
5721
  }
5733
5722
  div.editor-root:not(.mobile) div.editor-content div[data-type=editor-container] div.embed-block[data-type=editor-block][data-embed-type=office] [data-type=block-content] .card-root {
5734
- min-width: 360px;
5723
+ min-width: 200px;
5735
5724
  }:root {
5736
5725
  --editor-version-button-border: black;
5737
5726
  --editor-bg-color: #ffffff;
@@ -8875,6 +8864,35 @@ div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
8875
8864
  }
8876
8865
  [data-command-bar-id=main-toolbar-more-menu] .editor-command-bar.toolbar .command-item.hidden, [data-command-bar-id=main-toolbar-more-menu] .editor-command-bar.menu .command-item.hidden {
8877
8866
  display: flex;
8867
+ }
8868
+ .editor-main-toolbar-root {
8869
+ display: flex;
8870
+ width: 100%;
8871
+ min-height: 35px;
8872
+ }
8873
+ .editor-main-toolbar-root .editor-main-toolbar-resizer {
8874
+ position: relative;
8875
+ flex-grow: 1;
8876
+ flex-shrink: 1;
8877
+ }
8878
+ .editor-main-toolbar-root .editor-main-toolbar-resizer .editor-main-toolbar-container {
8879
+ position: absolute;
8880
+ left: 0;
8881
+ right: 0;
8882
+ top: 0;
8883
+ bottom: 0;
8884
+ display: flex;
8885
+ align-items: center;
8886
+ }
8887
+ .editor-main-toolbar-root .editor-main-toolbar-resizer .editor-main-toolbar-container .editor-command-bar-root {
8888
+ overflow: hidden !important;
8889
+ }
8890
+ .editor-main-toolbar-root [data-command-bar-root-id=main-toolbar-fullscreen] {
8891
+ flex-grow: 0 !important;
8892
+ flex-shrink: 0 !important;
8893
+ display: flex;
8894
+ align-items: center;
8895
+ justify-content: center;
8878
8896
  }`)),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
8879
8897
  var __defProp = Object.defineProperty;
8880
8898
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -24880,18 +24898,11 @@ var __publicField = (obj, key, value) => {
24880
24898
  };
24881
24899
  }
24882
24900
  function isEmptyDoc(doc2) {
24883
- const root2 = doc2.blocks.root;
24884
- if (root2.length !== 1) {
24885
- return false;
24886
- }
24887
- const block = root2[0];
24888
- if (!block.text) {
24889
- return false;
24890
- }
24891
- if (getTextLength(block.text)) {
24892
- return false;
24893
- }
24894
- return true;
24901
+ const blocks = doc2.blocks.root;
24902
+ const ret = blocks.every((block) => {
24903
+ return block.type === "text" && getTextLength(block.text || []) === 0;
24904
+ });
24905
+ return ret;
24895
24906
  }
24896
24907
  function createContainer$1(doc2, docsOrDocObject) {
24897
24908
  const containerId = genId();
@@ -26071,9 +26082,11 @@ var __publicField = (obj, key, value) => {
26071
26082
  __publicField(this, "composingTimer");
26072
26083
  __publicField(this, "callbacks");
26073
26084
  __publicField(this, "inputElement");
26085
+ __publicField(this, "focused", false);
26074
26086
  __publicField(this, "handleBlur", () => {
26075
26087
  this.editor.emit("blur", this.editor);
26076
26088
  this.callbacks.onBlur();
26089
+ this.focused = false;
26077
26090
  });
26078
26091
  __publicField(this, "handleWindowFocus", () => {
26079
26092
  if (document.activeElement === this.inputElement) {
@@ -26090,6 +26103,7 @@ var __publicField = (obj, key, value) => {
26090
26103
  this.editor.emit("focus", this.editor);
26091
26104
  this.callbacks.onFocus();
26092
26105
  this.editor.input.focus();
26106
+ this.focused = true;
26093
26107
  });
26094
26108
  }
26095
26109
  return;
@@ -26098,7 +26112,9 @@ var __publicField = (obj, key, value) => {
26098
26112
  return;
26099
26113
  }
26100
26114
  setTimeout(() => {
26101
- this.handleBlur();
26115
+ if (this.focused) {
26116
+ this.handleBlur();
26117
+ }
26102
26118
  });
26103
26119
  });
26104
26120
  __publicField(this, "handleDocumentSelectionChange", () => {
@@ -26113,6 +26129,9 @@ var __publicField = (obj, key, value) => {
26113
26129
  return;
26114
26130
  }
26115
26131
  }
26132
+ if (!this.focused) {
26133
+ return;
26134
+ }
26116
26135
  this.handleBlur();
26117
26136
  }, 100);
26118
26137
  });
@@ -26278,6 +26297,7 @@ var __publicField = (obj, key, value) => {
26278
26297
  this.callbacks.onFocus();
26279
26298
  });
26280
26299
  }
26300
+ this.focused = true;
26281
26301
  }
26282
26302
  isInDisableScrollMask(target) {
26283
26303
  let elem = target;
@@ -26314,7 +26334,7 @@ var __publicField = (obj, key, value) => {
26314
26334
  }
26315
26335
  }
26316
26336
  function moveInputToScreenCenter(editor) {
26317
- const container = editor.rootElement;
26337
+ const container = getScrollContainer$1(editor.rootContainer);
26318
26338
  const rect = container.getBoundingClientRect();
26319
26339
  const scale = getElementScale(container);
26320
26340
  const windowWidth = window.innerWidth;
@@ -26325,9 +26345,10 @@ var __publicField = (obj, key, value) => {
26325
26345
  const y2 = rect.bottom > windowHeight ? windowHeight : rect.bottom;
26326
26346
  const centerX = (x1 + x2) / 2;
26327
26347
  const centerY = (y1 + y2) / 2;
26328
- const x = 0 - rect.left + centerX;
26329
- const y = 0 - rect.top + centerY;
26330
26348
  const input2 = editor.input.inputElement;
26349
+ const inputHeight = input2.getBoundingClientRect().height;
26350
+ const x = 0 - rect.left + centerX;
26351
+ const y = 0 - rect.top + centerY + container.scrollTop - inputHeight / 2;
26331
26352
  input2.style.left = `${x / scale}px`;
26332
26353
  input2.style.top = `${y / scale}px`;
26333
26354
  }
@@ -29936,6 +29957,64 @@ ${codeText}
29936
29957
  }
29937
29958
  return doc2;
29938
29959
  }
29960
+ function removeUnknownComponents(editor, doc2) {
29961
+ const getAllBlockTypes = () => {
29962
+ const types2 = [];
29963
+ editor.editorBlocks.forEach((b) => {
29964
+ types2.push(b.blockType);
29965
+ });
29966
+ return types2;
29967
+ };
29968
+ const getAllEmbedTypes = () => {
29969
+ const embeds = [];
29970
+ editor.editorEmbeds.forEach((e2) => {
29971
+ embeds.push(e2.embedType);
29972
+ });
29973
+ return embeds;
29974
+ };
29975
+ const getAllBoxTypes = () => {
29976
+ const boxes = [];
29977
+ editor.editorBoxes.forEach((b) => {
29978
+ boxes.push(b.boxType);
29979
+ });
29980
+ return boxes;
29981
+ };
29982
+ const blockTypes = new Set(getAllBlockTypes());
29983
+ const embedTypes = new Set(getAllEmbedTypes());
29984
+ const boxTypes = new Set(getAllBoxTypes());
29985
+ Array.from(Object.keys(doc2.blocks)).forEach((containerId) => {
29986
+ const blocks = doc2.blocks[containerId];
29987
+ for (let i = blocks.length - 1; i >= 0; i--) {
29988
+ const block = blocks[i];
29989
+ const blockType = block.type;
29990
+ if (isTextKindBlockType(editor, blockType)) {
29991
+ const text2 = block.text;
29992
+ for (let j = text2.length - 1; j >= 0; j--) {
29993
+ const op = text2[j];
29994
+ if (isBoxOp(op)) {
29995
+ const box = op.attributes;
29996
+ if (!boxTypes.has(box.type)) {
29997
+ text2.splice(j, 1);
29998
+ }
29999
+ }
30000
+ }
30001
+ } else if (blockType === "embed") {
30002
+ const embed = block;
30003
+ const embedType = embed.embedType;
30004
+ if (!embedTypes.has(embedType)) {
30005
+ blocks.splice(i, 1);
30006
+ }
30007
+ } else {
30008
+ if (!blockTypes.has(block.type)) {
30009
+ blocks.splice(i, 1);
30010
+ }
30011
+ }
30012
+ }
30013
+ if (blocks.length === 0) {
30014
+ blocks.push(createEmptyTextBlockData());
30015
+ }
30016
+ });
30017
+ }
29939
30018
  class EditorInputHandlers {
29940
30019
  constructor(editor) {
29941
30020
  __publicField(this, "editor");
@@ -30194,6 +30273,7 @@ ${codeText}
30194
30273
  return;
30195
30274
  }
30196
30275
  }
30276
+ removeUnknownComponents(this.editor, doc2);
30197
30277
  const cloneDocResult = { blockIdMap: /* @__PURE__ */ new Map(), containerIdMap: /* @__PURE__ */ new Map(), boxIdMap: /* @__PURE__ */ new Map() };
30198
30278
  await editorInsertDocWithResources(this.editor, doc2, cloneDocResult);
30199
30279
  for (let i = 0; i < this.handlers.length; i++) {
@@ -31870,6 +31950,7 @@ ${codeText}
31870
31950
  __publicField(this, "settingsProvider");
31871
31951
  __publicField(this, "_readonly", false);
31872
31952
  __publicField(this, "_scrollable", true);
31953
+ __publicField(this, "_destroyed", false);
31873
31954
  __publicField(this, "getColor", (index2) => {
31874
31955
  const colors = this.options.colors;
31875
31956
  if (colors.length === 0) {
@@ -32009,6 +32090,10 @@ ${codeText}
32009
32090
  this.domEvents.destroy();
32010
32091
  this.removeAllListeners();
32011
32092
  this.inputHandlers.destroy();
32093
+ this._destroyed = true;
32094
+ }
32095
+ get destroyed() {
32096
+ return this._destroyed;
32012
32097
  }
32013
32098
  focus(options) {
32014
32099
  this.input.focus(options);
@@ -32300,11 +32385,17 @@ ${codeText}
32300
32385
  this.emit("change", Array.from(this.users.values()));
32301
32386
  }, 300);
32302
32387
  }
32303
- getSimpleCursors(blockId) {
32388
+ getSimpleCursors(blockId, excludeUserId) {
32304
32389
  const ret = /* @__PURE__ */ new Map();
32305
32390
  Array.from(this.cursors.values()).filter((message) => {
32306
32391
  const ret2 = message.range.anchor.blockId === blockId && isSimpleRange(message.range);
32307
- return ret2;
32392
+ if (!ret2) {
32393
+ return false;
32394
+ }
32395
+ if (excludeUserId && excludeUserId === message.user.userId) {
32396
+ return false;
32397
+ }
32398
+ return true;
32308
32399
  }).forEach((message) => {
32309
32400
  const offset = message.range.focus.offset;
32310
32401
  let users = ret.get(offset);
@@ -40076,7 +40167,7 @@ ${codeText}
40076
40167
  assert(logger$2S, typeof blockIndex === "number", "invalid path blockIndex");
40077
40168
  const blockData = editor.doc.getBlockData(containerId, blockIndex);
40078
40169
  const length = getTextLength(blockText);
40079
- const cursorMessages = remoteUsers.getSimpleCursors(blockData.id);
40170
+ const cursorMessages = remoteUsers.getSimpleCursors(blockData.id, editor.doc.getUser().userId);
40080
40171
  cursorMessages.forEach((messages, offset) => {
40081
40172
  if (offset > length) {
40082
40173
  offset = length;
@@ -41038,6 +41129,8 @@ ${codeText}
41038
41129
  const TableEditIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 14.5H2.5C1.94772 14.5 1.5 14.0523 1.5 13.5V2.5C1.5 1.94772 1.94772 1.5 2.5 1.5H13.5C14.0523 1.5 14.5 1.94772 14.5 2.5V8" stroke="#2D2D2E"/>\n<path d="M1.6 4.8H14.4" stroke="#2D2D2E"/>\n<path d="M1.6 9.6H8.00078" stroke="#2D2D2E"/>\n<path d="M5.6 1.6L5.6 14.4" stroke="#2D2D2E"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5043 8.98727L11.6789 8.22924C11.7097 8.09564 11.8387 8 11.9881 8H12.8119C12.9613 8 13.0903 8.09564 13.1211 8.22924L13.2957 8.98727C13.3177 9.08256 13.3912 9.16027 13.488 9.20102C13.569 9.23514 13.648 9.2726 13.7248 9.31318C13.8018 9.35372 13.877 9.3976 13.95 9.44477C14.037 9.50098 14.1474 9.52034 14.2487 9.49008L15.0543 9.24927C15.1963 9.20683 15.3514 9.26108 15.4261 9.37933L15.9576 10.2206C16.0323 10.3389 16.0062 10.4888 15.895 10.5799L15.2639 11.0972C15.1846 11.1622 15.1477 11.2593 15.1575 11.3562C15.1657 11.4375 15.1698 11.5189 15.1697 11.6C15.1698 11.6811 15.1658 11.7625 15.1576 11.8438C15.1478 11.9407 15.1847 12.0378 15.264 12.1028L15.895 12.62C16.0062 12.7112 16.0324 12.8611 15.9577 12.9793L15.4262 13.8206C15.3515 13.9389 15.1963 13.9931 15.0544 13.9507L14.2487 13.7099C14.1474 13.6796 14.037 13.699 13.95 13.7552C13.877 13.8024 13.8018 13.8463 13.7248 13.8868C13.648 13.9274 13.569 13.9649 13.488 13.999C13.3912 14.0397 13.3177 14.1174 13.2957 14.2127L13.1211 14.9708C13.0903 15.1044 12.9613 15.2 12.8119 15.2H11.9881C11.8387 15.2 11.7097 15.1044 11.6789 14.9708L11.5043 14.2127C11.4823 14.1174 11.4088 14.0397 11.312 13.999C11.231 13.9649 11.152 13.9274 11.0752 13.8868C10.9982 13.8463 10.923 13.8024 10.85 13.7552C10.763 13.699 10.6526 13.6796 10.5513 13.7099L9.74565 13.9507C9.60366 13.9931 9.44854 13.9389 9.37384 13.8206L8.84234 12.9793C8.76764 12.8611 8.79378 12.7112 8.905 12.62L9.53602 12.1028C9.61534 12.0378 9.6522 11.9407 9.64243 11.8438C9.63424 11.7625 9.63023 11.6811 9.63031 11.6C9.63023 11.5189 9.63426 11.4375 9.64247 11.3562C9.65226 11.2593 9.61539 11.1622 9.53607 11.0972L8.90506 10.5799C8.79384 10.4888 8.7677 10.3389 8.8424 10.2206L9.3739 9.37933C9.4486 9.26108 9.60371 9.20683 9.74571 9.24927L10.5514 9.49008C10.6526 9.52034 10.7631 9.50098 10.8501 9.44477C10.923 9.3976 10.9982 9.35372 11.0752 9.31318C11.152 9.2726 11.231 9.23514 11.312 9.20102C11.4088 9.16027 11.4823 9.08256 11.5043 8.98727ZM12.3278 12.5136C12.8866 12.5136 13.3396 12.0996 13.3396 11.5889C13.3396 11.0783 12.8866 10.6643 12.3278 10.6643C11.769 10.6643 11.316 11.0783 11.316 11.5889C11.316 12.0996 11.769 12.5136 12.3278 12.5136Z" fill="#2D2D2E"/>\n</svg>\n';
41039
41130
  const AdjustWidthIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 6H2.5C1.94772 6 1.5 6.44772 1.5 7V13.5C1.5 14.0523 1.94772 14.5 2.5 14.5H8M8 6H13.5C14.0523 6 14.5 6.44772 14.5 7V13.5C14.5 14.0523 14.0523 14.5 13.5 14.5H8M8 6V14.5" stroke="#2D2D2E"/>\n<path d="M1.5 2.5H14.5M1.5 1V4M8 1V4M14.5 1V4" stroke="#2D2D2E"/>\n</svg>\n';
41040
41131
  const TocIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 3.5L14 3.5" stroke="#2D2D2E"/>\n<path d="M2 6.50397H10" stroke="#2D2D2E"/>\n<path d="M2 12.5L14 12.5" stroke="#2D2D2E"/>\n<path d="M6 9.5H14" stroke="#2D2D2E"/>\n</svg>\n';
41132
+ const AttachmentIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.49669 1C4.80282 1 3.0118 2.3515 3.0118 3.76237L3 10.6206M6.49669 1C8.41943 1 10.0154 2.60058 10.0154 4.17342M6.49669 1C7.43289 1 8.28684 1.42118 8.90405 1.96796C9.50746 2.50252 10.0154 3.29036 10.0154 4.17342M10.0154 4.17342L10.0154 9.61446C10.0154 10.4166 9.23033 11.2316 8 11.2316C6.91283 11.2316 6.01026 10.5735 6.01026 9.87981L5.98457 5.04102M3 10.6206C3 13.1126 5.38055 15 8 15M3 10.6206C3 12.9301 5.13252 15 8 15M8 15C10.6194 15 13 13.1988 13 10.7068M8 15C10.8675 15 13 13.0162 13 10.7068M13 10.7068V5.04102" stroke="currentColor" stroke-linecap="square" stroke-linejoin="round"/>\n<path d="M13 4V10C13 12.7614 10.7614 15 8 15C5.23858 15 3 12.7614 3 10V4.5" stroke="currentColor"/>\n<path d="M10 9V4.5C10 2.567 8.433 1 6.5 1C4.567 1 3 2.567 3 4.5" stroke="currentColor"/>\n<path d="M10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9V4" stroke="currentColor"/>\n</svg>\n';
41133
+ const Mention2Icon = '<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M11.237 13.6469C10.2882 14.1888 9.18962 14.4985 8.01868 14.4985C4.42977 14.4985 1.52039 11.5892 1.52039 8.00024C1.52039 4.41134 4.42977 1.50195 8.01868 1.50195C11.6076 1.50195 14.517 4.41134 14.517 8.00024C14.517 8.70345 14.4221 9.21723 14.2284 9.56578C13.9961 10.0692 13.4926 10.7276 12.66 10.8438C12.3454 10.9008 12.0336 10.7797 11.7805 10.6233C11.3724 10.3711 11.2127 9.88274 11.2127 9.40298V4.48055" stroke="currentColor"/>\n<path d="M7.67957 4.73828C9.37526 4.73835 10.6913 6.20213 10.6913 7.93262C10.6913 9.6631 9.37526 11.1269 7.67957 11.127C5.98381 11.127 4.66785 9.66315 4.66785 7.93262C4.66785 6.20209 5.98381 4.73828 7.67957 4.73828Z" stroke="currentColor"/>\n</svg>\n';
41041
41134
  const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41042
41135
  __proto__: null,
41043
41136
  TableEditIcon,
@@ -41168,7 +41261,9 @@ ${codeText}
41168
41261
  LoadingCircleIcon,
41169
41262
  TextGroupIcon,
41170
41263
  AdjustWidthIcon,
41171
- TocIcon
41264
+ TocIcon,
41265
+ AttachmentIcon,
41266
+ Mention2Icon
41172
41267
  }, Symbol.toStringTag, { value: "Module" }));
41173
41268
  function createLoading() {
41174
41269
  const loading2 = createElement("span", ["editor-loading-icon"], null);
@@ -41789,6 +41884,9 @@ ${codeText}
41789
41884
  }
41790
41885
  const content = createElement("div", ["editor-command-bar-root"], null);
41791
41886
  content.setAttribute("data-keep-editor-focus", "");
41887
+ if (this.options.rootId) {
41888
+ content.setAttribute("data-command-bar-root-id", this.options.rootId);
41889
+ }
41792
41890
  if (this.options.header) {
41793
41891
  const headerElem = createElement("div", ["editor-command-bar-header"], null);
41794
41892
  if (this.options.header instanceof Function) {
@@ -41894,7 +41992,7 @@ ${codeText}
41894
41992
  placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
41895
41993
  maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
41896
41994
  arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
41897
- appendTo: document.body,
41995
+ appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
41898
41996
  onShow: this.handleShow,
41899
41997
  onHidden: this.handleHidden,
41900
41998
  onShown: this.handleShown,
@@ -42460,7 +42558,7 @@ ${codeText}
42460
42558
  placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
42461
42559
  maxWidth: 500,
42462
42560
  arrow: this.options.tippyArrow,
42463
- appendTo: document.body,
42561
+ appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
42464
42562
  onShow: this.handleShow,
42465
42563
  onHidden: this.handleHidden,
42466
42564
  delay: options == null ? void 0 : options.delay,
@@ -42598,7 +42696,7 @@ ${codeText}
42598
42696
  });
42599
42697
  }
42600
42698
  initCommandBarElement(elem) {
42601
- addClass(elem, "dialog", "manual");
42699
+ addClass(elem, "command-dialog", "manual");
42602
42700
  }
42603
42701
  initItemElement(item, elem) {
42604
42702
  }
@@ -43070,7 +43168,7 @@ ${codeText}
43070
43168
  placement: "bottom",
43071
43169
  maxWidth: 1e3,
43072
43170
  arrow: (_b = options == null ? void 0 : options.arrow) != null ? _b : this.options.tippyArrow,
43073
- appendTo: document.body,
43171
+ appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
43074
43172
  onShow: this.handleShow,
43075
43173
  onShown: this.handleShown,
43076
43174
  onHidden: this.handleHidden,
@@ -54496,6 +54594,7 @@ ${codeText}
54496
54594
  }, 50));
54497
54595
  this.editor = editor;
54498
54596
  const popover = editor.options.componentsOptions.popover;
54597
+ const objectToolbar = editor.options.componentsOptions.objectToolbar;
54499
54598
  this.toolbar = new ManualToolbar([], void 0, {
54500
54599
  tooltipId: editor.clientId,
54501
54600
  id: "editor-toolbar",
@@ -54503,7 +54602,8 @@ ${codeText}
54503
54602
  refuseOverflow: true,
54504
54603
  padding: 20,
54505
54604
  showName: clientType.isMobile,
54506
- autoClose: clientType.isMobile ? true : void 0
54605
+ autoClose: clientType.isMobile ? true : void 0,
54606
+ appendTo: (objectToolbar == null ? void 0 : objectToolbar.appendTo) || (popover == null ? void 0 : popover.appendTo)
54507
54607
  });
54508
54608
  this.toolbar.on("click", this.handleButtonClick);
54509
54609
  this.toolbar.on("close", this.handleClose);
@@ -54875,7 +54975,7 @@ ${codeText}
54875
54975
  const svg = await mathjax2Svg(editor, tex);
54876
54976
  const data2 = svg;
54877
54977
  const file2 = new File([data2], "math.svg");
54878
- const path = await editor.doc.uploadResource(file2);
54978
+ const path = await editor.doc.uploadResource(file2, { resourceType: "graph" });
54879
54979
  return path.resourceId;
54880
54980
  }
54881
54981
  async function convertAndUploadMathjaxForEmbed(editor, tex) {
@@ -54883,7 +54983,7 @@ ${codeText}
54883
54983
  const perfectState = analyzeMathjaxSvgWidth(svg);
54884
54984
  const data2 = svg;
54885
54985
  const file2 = new File([data2], "math.svg");
54886
- const path = await editor.doc.uploadResource(file2);
54986
+ const path = await editor.doc.uploadResource(file2, { resourceType: "graph" });
54887
54987
  return {
54888
54988
  resourceId: path.resourceId,
54889
54989
  ...perfectState
@@ -55156,7 +55256,7 @@ ${codeText}
55156
55256
  return ` $${math.tex}$ `;
55157
55257
  }
55158
55258
  if (math.src) {
55159
- return `<img src="${editor.doc.buildResourceUrl(math.src, { withToken: true })}" />`;
55259
+ return `<img data-embed-type="mathjax" data-uuid="mathjax:${math.src}" src="${editor.doc.buildResourceUrl(math.src, { withToken: true })}" />`;
55160
55260
  }
55161
55261
  return `<code>$${math.tex}$</code>`;
55162
55262
  }
@@ -55337,7 +55437,7 @@ ${codeText}
55337
55437
  function convertTo$g(editor, blockData, doc2, type) {
55338
55438
  const mathData = blockData.embedData;
55339
55439
  if (type === "html") {
55340
- return `<img src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
55440
+ return `<img data-embed-type="mathjax" data-uuid="mathjax:${mathData.src}" src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
55341
55441
  }
55342
55442
  if (type === "markdown") {
55343
55443
  return `
@@ -64110,6 +64210,17 @@ $$${mathData.mathjaxText}$$
64110
64210
  const failedLoad = !!block.querySelector(".images > .image-container.error, .images > .image-container.empty ");
64111
64211
  const width = calImageBlockStyleWidth(editor, blockData, parentContainer, failedLoad);
64112
64212
  const height = calBlockHeight(editor, blockData, parentContainer, failedLoad);
64213
+ if (width.startsWith("0") && height.startsWith("0")) {
64214
+ const image = block.querySelector("img");
64215
+ if (image) {
64216
+ image.onload = () => {
64217
+ setTimeout(() => {
64218
+ updateImageBlockSize(editor, blockData, blockElement, parentContainerElement);
64219
+ }, 300);
64220
+ };
64221
+ }
64222
+ return;
64223
+ }
64113
64224
  const content = getBlockContent(block);
64114
64225
  if (width === "auto") {
64115
64226
  content.style.width = width;
@@ -64887,7 +64998,8 @@ $$${mathData.mathjaxText}$$
64887
64998
  const res = await this.editor.doc.uploadResource(file2, {
64888
64999
  onProgress: (progress) => {
64889
65000
  setImageUploading(imageContainer, progress);
64890
- }
65001
+ },
65002
+ resourceType: "image"
64891
65003
  });
64892
65004
  removeClass(imageContainer, "uploading");
64893
65005
  this.images[index2].src = res.resourceId;
@@ -68864,7 +68976,7 @@ ${codeText}
68864
68976
  }
68865
68977
  const fileName = `image.${ext}`;
68866
68978
  const file2 = new File([blob], fileName, { type: mimeString });
68867
- const ret = await editor.doc.uploadResource(file2);
68979
+ const ret = await editor.doc.uploadResource(file2, { resourceType: "paste" });
68868
68980
  return ret.resourceId;
68869
68981
  }
68870
68982
  return src;
@@ -69076,7 +69188,7 @@ ${codeText}
69076
69188
  const data2 = blockData.embedData;
69077
69189
  const images = getImages$1(data2);
69078
69190
  if (type === "html") {
69079
- return images.map((image) => `<img src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
69191
+ return images.map((image) => `<img data-embed-type="image" data-uuid="image:${data2.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
69080
69192
  }
69081
69193
  if (type === "markdown") {
69082
69194
  const markdown = images.map((image) => `![img](${editor.doc.buildResourceUrl(image.src, { withToken: true })})`).join("\n");
@@ -74439,20 +74551,6 @@ ${codeText}
74439
74551
  const maxCellTextLength = maxCellTextLengths.get(cell.col) || 0;
74440
74552
  return padText(text2, maxCellTextLength);
74441
74553
  };
74442
- if (type === "text") {
74443
- const text2 = [];
74444
- for (let col = 0; col < grid.colCount; col++) {
74445
- const cellText = getCellText({ row: 0, col });
74446
- text2.push(cellText);
74447
- }
74448
- for (let row = 1; row < grid.rowCount; row++) {
74449
- for (let col = 0; col < grid.colCount; col++) {
74450
- const cellText = getCellText({ row, col });
74451
- text2.push(cellText);
74452
- }
74453
- }
74454
- return text2.join("\n");
74455
- }
74456
74554
  const lines = [];
74457
74555
  let headerText = "|";
74458
74556
  let headerSeparator = "|";
@@ -80336,7 +80434,7 @@ ${docStr}
80336
80434
  const data2 = boxData;
80337
80435
  if (type === "html") {
80338
80436
  if (data2.src) {
80339
- return `<a href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a>`;
80437
+ return `<a data-embed-type="file" data-uuid="file:${data2.src}" href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a>`;
80340
80438
  }
80341
80439
  return `[${data2.fileName}]`;
80342
80440
  }
@@ -80451,14 +80549,10 @@ ${docStr}
80451
80549
  }
80452
80550
  nameElement.title = fileName;
80453
80551
  const infos = createElement("div", ["file-info"], detail);
80454
- if (creator) {
80455
- createElement("div", ["file-creator"], infos, creator);
80456
- }
80457
- if (created) {
80458
- const timeText = i18n$1.t("file.uploadedTime", { time: formatDate(new Date(created), "YYYY-MM-DD hh:mm") });
80459
- createElement("div", ["uploaded-time"], infos, timeText);
80460
- }
80461
- createElement("div", ["file-size"], infos, formatBytes(fileSize));
80552
+ const timeText = i18n$1.t("file.uploadedTime", { time: formatDate(new Date(created), "YYYY-MM-DD hh:mm") });
80553
+ const sizeText = formatBytes(fileSize);
80554
+ const infoText = `${creator} ${timeText} ${sizeText}`;
80555
+ createElement("div", ["info"], infos, infoText);
80462
80556
  const actions2 = createElement("div", ["file-actions"], card);
80463
80557
  const options = editor.getComponentOptions("file");
80464
80558
  let copilotButton;
@@ -80638,7 +80732,7 @@ ${docStr}
80638
80732
  const data2 = embedData;
80639
80733
  if (type === "html") {
80640
80734
  if (data2.src) {
80641
- return `<p><a href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a></p>`;
80735
+ return `<p><a data-embed-type="file" data-uuid="file:${data2.src}" href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a></p>`;
80642
80736
  }
80643
80737
  return `<p>[${data2.fileName}]</p>`;
80644
80738
  }
@@ -85993,7 +86087,7 @@ ${docStr}
85993
86087
  const file2 = new File([buffer], `${genId()}.svg`, {
85994
86088
  type: "image/svg+xml"
85995
86089
  });
85996
- const ret = await editor.doc.uploadResource(file2);
86090
+ const ret = await editor.doc.uploadResource(file2, { resourceType: "graph" });
85997
86091
  return ret.resourceId;
85998
86092
  }
85999
86093
  const _MermaidInstance = class extends GraphBase {
@@ -86162,7 +86256,7 @@ ${docStr}
86162
86256
  const data2 = embedData;
86163
86257
  if (type === "html") {
86164
86258
  if (data2.src) {
86165
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86259
+ return `<img data-embed-type="mermaid" data-uuid="mermaid:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86166
86260
  }
86167
86261
  if (data2.mermaidText) {
86168
86262
  return `<div class="mermaid">${data2.mermaidText}</div>`;
@@ -86231,7 +86325,7 @@ ${data2.mermaidText}
86231
86325
  const file2 = new File([buffer], `${genId()}.svg`, {
86232
86326
  type: "image/svg+xml"
86233
86327
  });
86234
- const resource = await editor.doc.uploadResource(file2);
86328
+ const resource = await editor.doc.uploadResource(file2, { resourceType: "graph" });
86235
86329
  return resource.resourceId;
86236
86330
  }
86237
86331
  const _FlowChartInstance = class extends GraphBase {
@@ -86328,7 +86422,7 @@ ${data2.mermaidText}
86328
86422
  const data2 = embedData;
86329
86423
  if (type === "html") {
86330
86424
  if (data2.src) {
86331
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86425
+ return `<img data-embed-type="flowchart" data-uuid="flowchart:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86332
86426
  }
86333
86427
  if (data2.flowchartText) {
86334
86428
  return `<div>${data2.flowchartText}</div>`;
@@ -86686,7 +86780,7 @@ ${data2.flowchartText}
86686
86780
  });
86687
86781
  const targetBlock = editor.findBlockById(getBlockId(block));
86688
86782
  if (targetBlock) {
86689
- const res = await editor.doc.uploadResource(file2);
86783
+ const res = await editor.doc.uploadResource(file2, { resourceType: "graph" });
86690
86784
  const { resourceId } = res;
86691
86785
  const oldData = editor.getBlockData(targetBlock);
86692
86786
  const oldEmbedData = oldData.embedData;
@@ -86738,31 +86832,40 @@ ${data2.flowchartText}
86738
86832
  const xml = drawIoData.xmlSvg || drawIoData.xml || "";
86739
86833
  switch (msg.event) {
86740
86834
  case "configure":
86741
- iframe.contentWindow.postMessage(JSON.stringify({
86742
- action: "configure",
86743
- config: {
86744
- defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
86745
- }
86746
- }), "*");
86835
+ iframe.contentWindow.postMessage(
86836
+ JSON.stringify({
86837
+ action: "configure",
86838
+ config: {
86839
+ defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
86840
+ }
86841
+ }),
86842
+ "*"
86843
+ );
86747
86844
  break;
86748
86845
  case "init":
86749
- iframe.contentWindow.postMessage(JSON.stringify({
86750
- action: "load",
86751
- saveAndExit: 1,
86752
- noSaveBtn: 1,
86753
- noExitBtn: 0,
86754
- xml
86755
- }), "*");
86846
+ iframe.contentWindow.postMessage(
86847
+ JSON.stringify({
86848
+ action: "load",
86849
+ saveAndExit: 1,
86850
+ noSaveBtn: 1,
86851
+ noExitBtn: 0,
86852
+ xml
86853
+ }),
86854
+ "*"
86855
+ );
86756
86856
  loaded();
86757
86857
  loadingHandler.removeLoading();
86758
86858
  break;
86759
86859
  case "save":
86760
86860
  exportFlag = "save";
86761
- iframe.contentWindow.postMessage(JSON.stringify({
86762
- action: "export",
86763
- format: "xmlsvg",
86764
- spin: "Saving graph"
86765
- }), "*");
86861
+ iframe.contentWindow.postMessage(
86862
+ JSON.stringify({
86863
+ action: "export",
86864
+ format: "xmlsvg",
86865
+ spin: "Saving graph"
86866
+ }),
86867
+ "*"
86868
+ );
86766
86869
  break;
86767
86870
  case "export":
86768
86871
  if (exportFlag !== "auto") {
@@ -86788,12 +86891,15 @@ ${data2.flowchartText}
86788
86891
  allowRetry: true,
86789
86892
  onOk: () => {
86790
86893
  setTimeout(() => {
86791
- drawioIframeWindow.postMessage(JSON.stringify({
86792
- action: "export",
86793
- format: "xmlsvg",
86794
- spin: i18n$1.t("drawio.save"),
86795
- autoSave: exportFlag
86796
- }), "*");
86894
+ drawioIframeWindow.postMessage(
86895
+ JSON.stringify({
86896
+ action: "export",
86897
+ format: "xmlsvg",
86898
+ spin: i18n$1.t("drawio.save"),
86899
+ autoSave: exportFlag
86900
+ }),
86901
+ "*"
86902
+ );
86797
86903
  }, 1e3);
86798
86904
  },
86799
86905
  onClose: () => {
@@ -86859,12 +86965,15 @@ ${data2.flowchartText}
86859
86965
  if (!drawioIframe || !drawioIframe.contentWindow) {
86860
86966
  return;
86861
86967
  }
86862
- drawioIframe.contentWindow.postMessage(JSON.stringify({
86863
- action: "export",
86864
- format: "xmlsvg",
86865
- spin: "Saving graph",
86866
- autoSave: true
86867
- }), "*");
86968
+ drawioIframe.contentWindow.postMessage(
86969
+ JSON.stringify({
86970
+ action: "export",
86971
+ format: "xmlsvg",
86972
+ spin: "Saving graph",
86973
+ autoSave: true
86974
+ }),
86975
+ "*"
86976
+ );
86868
86977
  }, SAVE_DELAY_TIME);
86869
86978
  };
86870
86979
  const exit = () => {
@@ -87004,10 +87113,12 @@ ${data2.flowchartText}
87004
87113
  }
87005
87114
  function updateGraphByXml(mxFile, embed, editor) {
87006
87115
  assert(logger$i, editor, "parameter missing");
87007
- initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
87008
- checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
87009
- maxRetryTime: 5e3
87010
- })).then(() => {
87116
+ initDrawIo(editor).then(
87117
+ () => loopCheckResourceWasLoaded({
87118
+ checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
87119
+ maxRetryTime: 5e3
87120
+ })
87121
+ ).then(() => {
87011
87122
  const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec, Graph } = window;
87012
87123
  assert(logger$i, mxUtils, "External resource loading exception: mxUtils");
87013
87124
  assert(logger$i, MxGraph, "External resource loading exception: MxGraph");
@@ -87027,7 +87138,10 @@ ${data2.flowchartText}
87027
87138
  const raw = atob(diagramBase64);
87028
87139
  const pako = window.pako;
87029
87140
  assert(logger$i, pako, "External resource loading exception: pako");
87030
- const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
87141
+ const encodedXml = pako.inflateRaw(
87142
+ Uint8Array.from(raw, (c) => c.charCodeAt(0)),
87143
+ { to: "string" }
87144
+ );
87031
87145
  const xml = decodeURIComponent(encodedXml);
87032
87146
  xmlDoc = mxUtils.parseXml(xml);
87033
87147
  } else {
@@ -87271,7 +87385,7 @@ ${data2.flowchartText}
87271
87385
  const data2 = embedData;
87272
87386
  if (type === "html") {
87273
87387
  if (data2.src) {
87274
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87388
+ return `<img data-embed-type="drawio" data-uuid="drawio:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87275
87389
  }
87276
87390
  if (data2.xmlSvg) {
87277
87391
  return data2.xmlSvg;
@@ -87361,7 +87475,7 @@ ${data2.flowchartText}
87361
87475
  if (!plantumlImgFile) {
87362
87476
  return await Promise.resolve(url);
87363
87477
  }
87364
- const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile);
87478
+ const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile, { resourceType: "graph" });
87365
87479
  return uploadResourceResult.resourceId;
87366
87480
  } catch (error2) {
87367
87481
  return Promise.resolve(url);
@@ -87465,7 +87579,7 @@ ${data2.flowchartText}
87465
87579
  const data2 = embedData;
87466
87580
  if (type === "html") {
87467
87581
  if (data2.src) {
87468
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87582
+ return `<img data-embed-type="plantuml" data-uuid="plantuml:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87469
87583
  }
87470
87584
  if (data2.plantumlText) {
87471
87585
  return `<div>${data2.plantumlText}</div>`;
@@ -90896,7 +91010,8 @@ ${data2.plantumlText}
90896
91010
  const { resourceId } = await editor.doc.uploadResource(file2, {
90897
91011
  onProgress: (progress) => {
90898
91012
  this.renderProgress(progress, file2);
90899
- }
91013
+ },
91014
+ resourceType: "media"
90900
91015
  });
90901
91016
  const { name, type, size } = file2;
90902
91017
  const newBlockData = {
@@ -91034,7 +91149,11 @@ ${data2.plantumlText}
91034
91149
  renderEmpty(blockData) {
91035
91150
  assert(logger$9, this.abstract, "no abstract");
91036
91151
  assert(logger$9, this.mediaContainer, "The media element not exist");
91037
- const empty = createElement("div", ["media-empty", "embed-selected-content", "embed-hover-content"], this.mediaContainer);
91152
+ const empty = createElement(
91153
+ "div",
91154
+ ["media-empty", "embed-selected-content", "embed-hover-content"],
91155
+ this.mediaContainer
91156
+ );
91038
91157
  empty.innerHTML = this.abstract.mediaIcon;
91039
91158
  this.updateMediaContent(empty);
91040
91159
  const { editor } = this.options;
@@ -91055,7 +91174,7 @@ ${data2.plantumlText}
91055
91174
  }
91056
91175
  await editor.doc.addResources([resourceId]);
91057
91176
  const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
91058
- if (resourceUrl !== blockData.embedData.src && (serviceAppId && blockData.embedData.src.includes(serviceAppId))) {
91177
+ if (resourceUrl !== blockData.embedData.src && serviceAppId && blockData.embedData.src.includes(serviceAppId)) {
91059
91178
  const block = getParentBlock(content);
91060
91179
  if (block && !editor.readonly && editor.isBlockWritable(block)) {
91061
91180
  const newBlockData = cloneDeep__default.default(blockData);
@@ -91196,7 +91315,7 @@ ${data2.plantumlText}
91196
91315
  const mediaData = blockData.embedData;
91197
91316
  const url = editor.doc.buildResourceUrl(mediaData.src, { withToken: true });
91198
91317
  if (type === "html") {
91199
- return `<${mediaData.type} src="${url}" />`;
91318
+ return `<${this.embedType} data-embed-type="${this.embedType}" data-uuid="${this.embedType}:${mediaData.src}" src="${url}" />`;
91200
91319
  }
91201
91320
  if (type === "markdown") {
91202
91321
  return `![${mediaData.src}](${url})`;
@@ -94237,11 +94356,11 @@ ${JSON.stringify(error2, null, 2)}`);
94237
94356
  this.fixedToolbar = (_a = editor.findCustom("main-toolbar-fixed-toolbar")) == null ? void 0 : _a.toolbar;
94238
94357
  if (this.fixedToolbar) {
94239
94358
  const content = this.fixedToolbar.content;
94240
- const toolbar2 = content.closest(".editor-command-bar-root");
94359
+ const resizer = content.closest(".editor-main-toolbar-resizer");
94241
94360
  this.observer = new ResizeObserver(() => {
94242
94361
  this.updateItems();
94243
94362
  });
94244
- this.observer.observe(toolbar2);
94363
+ this.observer.observe(resizer);
94245
94364
  editor.addCustom("main-toolbar-more-item", () => this);
94246
94365
  }
94247
94366
  });
@@ -94268,7 +94387,7 @@ ${JSON.stringify(error2, null, 2)}`);
94268
94387
  return;
94269
94388
  }
94270
94389
  const content = toolbar2.content;
94271
- const toolbarRoot = content.closest(".editor-command-bar-root");
94390
+ const toolbarRoot = content.closest(".editor-main-toolbar-resizer");
94272
94391
  const toolbarRect = toolbarRoot.getBoundingClientRect();
94273
94392
  const toolbarRight = toolbarRect.right;
94274
94393
  items.forEach((item) => {
@@ -94338,8 +94457,67 @@ ${JSON.stringify(error2, null, 2)}`);
94338
94457
  toolbar2.updateItems(items);
94339
94458
  }
94340
94459
  }
94460
+ class InsertFileItem {
94461
+ constructor() {
94462
+ __publicField(this, "id", "insert-file");
94463
+ __publicField(this, "name", i18n$1.t("toolbar.file"));
94464
+ __publicField(this, "icon", AttachmentIcon);
94465
+ }
94466
+ async onClick(editor, item) {
94467
+ const block = editor.getBlockById(editor.selection.range.start.blockId);
94468
+ const container = editor.getParentContainer(block);
94469
+ const index2 = editor.getBlockIndex(block);
94470
+ const file2 = await selectFile("*");
94471
+ if (!file2) {
94472
+ return;
94473
+ }
94474
+ const res = await editor.doc.uploadResource(file2);
94475
+ if (!res.resourceId) {
94476
+ return;
94477
+ }
94478
+ const data2 = {
94479
+ src: res.resourceId,
94480
+ fileName: file2.name,
94481
+ fileSize: file2.size,
94482
+ fileType: file2.type,
94483
+ created: Date.now(),
94484
+ creator: editor.doc.getUser().displayName,
94485
+ previewType: FilePreviewType.Card
94486
+ };
94487
+ editor.insertEmbed(getContainerId(container), index2 + 1, "office", data2);
94488
+ }
94489
+ }
94490
+ class InsertMentionItem {
94491
+ constructor() {
94492
+ __publicField(this, "id", "insert-mention");
94493
+ __publicField(this, "name", i18n$1.t("toolbar.mention"));
94494
+ __publicField(this, "icon", Mention2Icon);
94495
+ }
94496
+ onClick(editor, item) {
94497
+ editor.clearSelectedContents();
94498
+ const focus = editor.selection.range.focus;
94499
+ if (!focus.isSimple()) {
94500
+ return;
94501
+ }
94502
+ const block = editor.getBlockById(focus.blockId);
94503
+ if (!isTextKindBlock(editor, block)) {
94504
+ return;
94505
+ }
94506
+ editor.focus();
94507
+ editor.insertTextToBlock(block, focus.offset, "@");
94508
+ const mention = editor.findCustom("mention");
94509
+ if (mention) {
94510
+ const suggest = mention.suggest;
94511
+ if (suggest) {
94512
+ const container = getParentContainer(block);
94513
+ suggest.handleAfterInsertText(editor, getContainerId(container), getBlockIndex(block), focus.offset, "@");
94514
+ }
94515
+ }
94516
+ }
94517
+ }
94341
94518
  function getToolbarDefaultItems(editor) {
94342
- return [
94519
+ const commentsEnabled = !!editor.options.enableComments;
94520
+ const items = [
94343
94521
  new UndoItem(),
94344
94522
  new RedoItem(),
94345
94523
  new SeparatorItem(),
@@ -94364,14 +94542,15 @@ ${JSON.stringify(error2, null, 2)}`);
94364
94542
  new AlignCenterItem(),
94365
94543
  new AlignRightItem(),
94366
94544
  new SeparatorItem(),
94367
- new InsertImageItem(),
94368
- new SeparatorItem(),
94369
94545
  new InsertItem(editor),
94370
94546
  new SeparatorItem(),
94371
- new FindReplaceItem(),
94372
- new CommentItem(),
94373
- new MoreItem(editor)
94547
+ new FindReplaceItem()
94374
94548
  ];
94549
+ if (commentsEnabled) {
94550
+ items.push(new CommentItem());
94551
+ }
94552
+ items.push(new MoreItem(editor));
94553
+ return items;
94375
94554
  }
94376
94555
  const zhCN = {
94377
94556
  toolbar: {
@@ -94384,7 +94563,10 @@ ${JSON.stringify(error2, null, 2)}`);
94384
94563
  quote: "\u5F15\u7528",
94385
94564
  checkList: "\u4EFB\u52A1\u5217\u8868",
94386
94565
  orderedList: "\u6709\u5E8F\u5217\u8868",
94387
- unorderedList: "\u65E0\u5E8F\u5217\u8868"
94566
+ unorderedList: "\u65E0\u5E8F\u5217\u8868",
94567
+ fullscreen: "\u5168\u5C4F",
94568
+ file: "\u63D2\u5165\u6587\u4EF6",
94569
+ mention: "\u63D0\u53CA\u7528\u6237"
94388
94570
  }
94389
94571
  };
94390
94572
  const zhHK = {
@@ -94398,7 +94580,10 @@ ${JSON.stringify(error2, null, 2)}`);
94398
94580
  quote: "\u5F15\u7528",
94399
94581
  checkList: "\u4EFB\u52D9\u5217\u8868",
94400
94582
  orderedList: "\u6709\u5E8F\u5217\u8868",
94401
- unorderedList: "\u7121\u5E8F\u5217\u8868"
94583
+ unorderedList: "\u7121\u5E8F\u5217\u8868",
94584
+ fullscreen: "\u5168\u5C4F",
94585
+ file: "\u63D2\u5165\u6587\u4EF6",
94586
+ mention: "\u63D0\u53CA\u7528\u6236"
94402
94587
  }
94403
94588
  };
94404
94589
  const enUS = {
@@ -94412,7 +94597,10 @@ ${JSON.stringify(error2, null, 2)}`);
94412
94597
  quote: "Quote",
94413
94598
  checkList: "Check List",
94414
94599
  orderedList: "Ordered List",
94415
- unorderedList: "Unordered List"
94600
+ unorderedList: "Unordered List",
94601
+ fullscreen: "Full Screen",
94602
+ file: "File",
94603
+ mention: "Mention user"
94416
94604
  }
94417
94605
  };
94418
94606
  const jaJP = {
@@ -94426,7 +94614,10 @@ ${JSON.stringify(error2, null, 2)}`);
94426
94614
  quote: "\u5F15\u7528",
94427
94615
  checkList: "\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",
94428
94616
  orderedList: "\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",
94429
- unorderedList: "\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8"
94617
+ unorderedList: "\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",
94618
+ fullscreen: "\u5168\u753B\u9762\u8868\u793A",
94619
+ file: "\u30D5\u30A1\u30A4\u30EB\u3092\u633F\u5165",
94620
+ mention: "\u30E6\u30FC\u30B6\u30FC\u3092\u30E1\u30F3\u30B7\u30E7\u30F3"
94430
94621
  }
94431
94622
  };
94432
94623
  i18n$1.mergeLang({
@@ -94437,8 +94628,10 @@ ${JSON.stringify(error2, null, 2)}`);
94437
94628
  });
94438
94629
  const style = "";
94439
94630
  class MainToolbar {
94440
- constructor(editor, parent) {
94631
+ constructor(editor, parent, options = {}) {
94441
94632
  __publicField(this, "toolbar");
94633
+ __publicField(this, "toolbarFullScreen");
94634
+ __publicField(this, "root");
94442
94635
  __publicField(this, "handleClick", (bar2, item) => {
94443
94636
  const command = item;
94444
94637
  if (command.onClick) {
@@ -94475,7 +94668,13 @@ ${JSON.stringify(error2, null, 2)}`);
94475
94668
  this.updateState();
94476
94669
  });
94477
94670
  this.editor = editor;
94478
- this.toolbar = new FixedToolbar(parent, this.getItems(), {
94671
+ this.options = options;
94672
+ const root2 = createElement("div", ["editor-main-toolbar-root"], parent);
94673
+ const container = createElement("div", ["editor-main-toolbar-resizer"], root2);
94674
+ const resizer = createElement("div", ["editor-main-toolbar-container"], container);
94675
+ const items = getToolbarDefaultItems(editor);
94676
+ this.root = root2;
94677
+ this.toolbar = new FixedToolbar(resizer, items, {
94479
94678
  tooltipId: editor.clientId,
94480
94679
  id: "main-toolbar"
94481
94680
  });
@@ -94487,16 +94686,39 @@ ${JSON.stringify(error2, null, 2)}`);
94487
94686
  destroy: () => {
94488
94687
  }
94489
94688
  }));
94689
+ if (options.enableFullScreen) {
94690
+ const fullScreenItem = {
94691
+ id: "main-toolbar-fullscreen",
94692
+ icon: FullScreenIcon,
94693
+ name: i18n$1.t("toolbar.fullscreen")
94694
+ };
94695
+ this.toolbarFullScreen = new FixedToolbar(root2, [fullScreenItem], {
94696
+ tooltipId: editor.clientId,
94697
+ id: "main-toolbar-fullscreen",
94698
+ rootId: "main-toolbar-fullscreen"
94699
+ });
94700
+ this.toolbarFullScreen.addListener("click", (bar2, item) => {
94701
+ var _a;
94702
+ if (item.id === "main-toolbar-fullscreen") {
94703
+ (_a = options.onFullScreenClick) == null ? void 0 : _a.call(options, this.editor, item);
94704
+ this.handleSelectionChanged();
94705
+ }
94706
+ });
94707
+ }
94490
94708
  }
94491
94709
  destroy() {
94710
+ var _a;
94492
94711
  this.toolbar.destroy();
94712
+ this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
94713
+ (_a = this.toolbarFullScreen) == null ? void 0 : _a.destroy();
94714
+ this.root.remove();
94493
94715
  }
94494
94716
  setItems(items) {
94495
94717
  this.toolbar.updateItems(items);
94496
94718
  this.updateState();
94497
94719
  }
94498
94720
  getItems() {
94499
- return getToolbarDefaultItems(this.editor);
94721
+ return this.toolbar.items;
94500
94722
  }
94501
94723
  updateState() {
94502
94724
  const items = this.toolbar.items;
@@ -94534,9 +94756,311 @@ ${JSON.stringify(error2, null, 2)}`);
94534
94756
  }
94535
94757
  });
94536
94758
  }
94759
+ const CkeImageConverter = {
94760
+ filter: (node) => {
94761
+ if (node.nodeName !== "IMG") {
94762
+ return false;
94763
+ }
94764
+ const elem = node;
94765
+ const refId = elem.getAttribute("data-ref-id");
94766
+ const refType = elem.getAttribute("data-ref-type");
94767
+ const uuid = elem.getAttribute("data-uuid");
94768
+ return Boolean(refType === "task" && refId && uuid);
94769
+ },
94770
+ replacement: (content, node) => {
94771
+ const refType = node.getAttribute("data-ref-type");
94772
+ const refId = node.getAttribute("data-ref-id");
94773
+ const uuid = node.getAttribute("data-uuid");
94774
+ const src = `ones-file:${refType}/${refId}/${uuid}`;
94775
+ return `![${refType}](${src})`;
94776
+ }
94777
+ };
94778
+ const ckeHtmlConverters = /* @__PURE__ */ new Map();
94779
+ function registerCKEHtmlConvert(name, converter) {
94780
+ if (ckeHtmlConverters.has(name)) {
94781
+ return;
94782
+ }
94783
+ ckeHtmlConverters.set(name, converter);
94784
+ turndownService.use((ts) => {
94785
+ ts.addRule(name, converter);
94786
+ });
94787
+ }
94788
+ function getTurndownRootElement(node) {
94789
+ let parent = node;
94790
+ while (parent) {
94791
+ if (parent instanceof HTMLElement && parent.tagName === "BODY") {
94792
+ return parent;
94793
+ }
94794
+ if (!parent.parentNode) {
94795
+ return parent;
94796
+ }
94797
+ parent = parent.parentNode;
94798
+ }
94799
+ return node;
94800
+ }
94801
+ function patchForEmptyBlock(key, node, className) {
94802
+ const root2 = getTurndownRootElement(node);
94803
+ if (root2 && root2 instanceof HTMLElement) {
94804
+ const attributeKey = `data-${key}-processed`;
94805
+ if (!root2.getAttribute(attributeKey)) {
94806
+ root2.setAttribute(attributeKey, "true");
94807
+ const elements = root2.querySelectorAll(className);
94808
+ elements.forEach((elem) => {
94809
+ var _a;
94810
+ const text2 = (_a = elem.textContent) == null ? void 0 : _a.trim();
94811
+ if (!text2) {
94812
+ elem.innerText = "--temp-data--";
94813
+ }
94814
+ });
94815
+ }
94816
+ }
94817
+ }
94818
+ const CkeCommentConverter = {
94819
+ filter: (node) => {
94820
+ if (node.nodeName === "SPAN") {
94821
+ const span = node;
94822
+ const ref = span.getAttribute("data-annotate-ref");
94823
+ return Boolean(ref);
94824
+ }
94825
+ return false;
94826
+ },
94827
+ replacement: (content, node) => {
94828
+ var _a;
94829
+ const span = node;
94830
+ const ref = span.getAttribute("data-annotate-ref");
94831
+ const text2 = (_a = span.textContent) != null ? _a : "";
94832
+ return `[${text2}](comment://${ref})`;
94833
+ }
94834
+ };
94835
+ function processCkeCommentsLink(doc2) {
94836
+ const containers = doc2.blocks;
94837
+ Object.values(containers).forEach((blocks) => {
94838
+ blocks.forEach((block) => {
94839
+ const text2 = block.text;
94840
+ if (text2) {
94841
+ text2.forEach((op) => {
94842
+ if (op.attributes) {
94843
+ const attributes = op.attributes;
94844
+ const link2 = attributes.link;
94845
+ if (link2 == null ? void 0 : link2.startsWith("comment://")) {
94846
+ delete attributes.link;
94847
+ const commentId = link2.replace("comment://", "");
94848
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
94849
+ attributes[key] = commentId;
94850
+ }
94851
+ }
94852
+ });
94853
+ }
94854
+ });
94855
+ });
94856
+ }
94857
+ const CkeMentionConverter = {
94858
+ filter: (node) => {
94859
+ patchForEmptyBlock("mention", node, ".ones-at-user-block");
94860
+ if (node.nodeName === "SPAN") {
94861
+ const span = node;
94862
+ if (hasClass(span, "ones-at-user-block")) {
94863
+ const name = span.getAttribute("data-default-name");
94864
+ const refId = span.getAttribute("data-ref-id");
94865
+ return Boolean(name) && Boolean(refId);
94866
+ }
94867
+ }
94868
+ return false;
94869
+ },
94870
+ replacement: (content, node) => {
94871
+ const span = node;
94872
+ const name = span.getAttribute("data-default-name") || "";
94873
+ const refId = span.getAttribute("data-ref-id") || "";
94874
+ if (name && refId) {
94875
+ const box = {
94876
+ id: genId(),
94877
+ type: "mention",
94878
+ box: true,
94879
+ created: Date.now(),
94880
+ iconUrl: "",
94881
+ text: name,
94882
+ mentionId: refId
94883
+ };
94884
+ const text2 = [
94885
+ {
94886
+ insert: " ",
94887
+ attributes: box
94888
+ }
94889
+ ];
94890
+ const obj = {
94891
+ text: text2
94892
+ };
94893
+ const base64 = toBase64URL(JSON.stringify(obj));
94894
+ return `[[${base64}]]`;
94895
+ }
94896
+ return name;
94897
+ }
94898
+ };
94899
+ function convertMentionToCkeMention(editor, boxData, doc2, type) {
94900
+ const data2 = boxData;
94901
+ if (type === "html") {
94902
+ return `<ones-at-user data-ref-name="${data2.text}" data-ref-id="${data2.mentionId}" data-default-name="${data2.text}" class="ones-at-user-block" data-viewer="1"><span>@${data2.text}</span></ones-at-user>`;
94903
+ }
94904
+ return `@${data2.text}`;
94905
+ }
94906
+ function patchMentionConverter(editor) {
94907
+ const mentionBox = editor.editorBoxes.getBoxClass("mention");
94908
+ if (mentionBox) {
94909
+ const oldConvertTo = mentionBox.convertTo;
94910
+ if (oldConvertTo !== convertMentionToCkeMention) {
94911
+ mentionBox.convertTo = convertMentionToCkeMention;
94912
+ }
94913
+ }
94914
+ }
94915
+ function processLinks(doc2) {
94916
+ const containers = doc2.blocks;
94917
+ Object.values(containers).forEach((blocks) => {
94918
+ blocks.forEach((block) => {
94919
+ if (block.text) {
94920
+ const text2 = block.text;
94921
+ text2.forEach((op) => {
94922
+ const attributes = op.attributes;
94923
+ if (attributes) {
94924
+ attributes.link;
94925
+ }
94926
+ });
94927
+ }
94928
+ });
94929
+ });
94930
+ }
94931
+ const CkeMarkdownConverter = {
94932
+ filter: (node) => {
94933
+ if (node.nodeName !== "DIV") {
94934
+ return false;
94935
+ }
94936
+ const div = node;
94937
+ return hasClass(div, "ones-marked-card");
94938
+ },
94939
+ replacement: (content, node) => {
94940
+ const textToCodeBlock2 = (text2, language) => {
94941
+ const codeBlocks = text2.split("\n").map((line) => {
94942
+ const block = {
94943
+ type: "text",
94944
+ id: genId(),
94945
+ text: createRichText(line)
94946
+ };
94947
+ return block;
94948
+ });
94949
+ const containerId = genId();
94950
+ const doc22 = {
94951
+ blocks: {
94952
+ root: [
94953
+ {
94954
+ id: genId(),
94955
+ type: "code",
94956
+ language,
94957
+ children: [containerId]
94958
+ }
94959
+ ],
94960
+ [containerId]: codeBlocks
94961
+ },
94962
+ meta: {},
94963
+ comments: {}
94964
+ };
94965
+ return toBase64URL(JSON.stringify(doc22));
94966
+ };
94967
+ const nodeToCodeBlock2 = (node2, lang) => {
94968
+ const text2 = node2.textContent || "";
94969
+ return textToCodeBlock2(text2, lang);
94970
+ };
94971
+ const doc2 = nodeToCodeBlock2(node, "markdown");
94972
+ const fence = "```";
94973
+ return "\n\n" + fence + "\n" + doc2 + "\n" + fence + "\n\n";
94974
+ }
94975
+ };
94976
+ registerCKEHtmlConvert("image", CkeImageConverter);
94977
+ registerCKEHtmlConvert("comment", CkeCommentConverter);
94978
+ registerCKEHtmlConvert("mention", CkeMentionConverter);
94979
+ registerCKEHtmlConvert("markdown", CkeMarkdownConverter);
94980
+ function ckeHtml2Doc(html) {
94981
+ const doc2 = htmlToDoc(html) || createEmptyDoc$1();
94982
+ processCkeCommentsLink(doc2);
94983
+ processLinks(doc2);
94984
+ return doc2;
94985
+ }
94986
+ function injectDocToCkeHtmlFragment(htmlFragment, doc2, text2) {
94987
+ const meta = `<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${toBase64URL(
94988
+ JSON.stringify(doc2)
94989
+ )}::ones-editor-doc" />`;
94990
+ let textMeta = "";
94991
+ if (text2) {
94992
+ textMeta = `<meta name="ones-editor-text" content="${toBase64URL(text2)}" />`;
94993
+ }
94994
+ const html = `<!doctype html><html><head>${meta}${textMeta}</head><body>${htmlFragment}</body></html>`;
94995
+ return html;
94996
+ }
94997
+ function editorToCKEHtml(editor) {
94998
+ patchMentionConverter(editor);
94999
+ const docObject = editor.doc.toJSON();
95000
+ if (isEmptyDoc(docObject)) {
95001
+ return "";
95002
+ }
95003
+ let html = docToHtmlFragment(editor, docObject);
95004
+ const text2 = docToText(editor, docObject);
95005
+ html = injectDocToCkeHtmlFragment(html, docObject, text2);
95006
+ return html;
95007
+ }
95008
+ function combineDoc(doc1, doc2) {
95009
+ if (isEmptyDoc(doc1)) {
95010
+ return doc2;
95011
+ }
95012
+ if (isEmptyDoc(doc2)) {
95013
+ return doc1;
95014
+ }
95015
+ const splitterDoc = createEmptyDoc$1("", {
95016
+ firstLineAsTitle: false
95017
+ });
95018
+ return mergeDocs([doc1, splitterDoc, doc2]);
95019
+ }
95020
+ function mergeHTMLBodiesOnly(htmlA, htmlB) {
95021
+ const parser = new DOMParser();
95022
+ const docA = parser.parseFromString(htmlA, "text/html");
95023
+ const docB = parser.parseFromString(htmlB, "text/html");
95024
+ const mergedDoc = document.implementation.createHTMLDocument("Merged");
95025
+ const bodyA = docA.body;
95026
+ const bodyB = docB.body;
95027
+ const mergedBody = mergedDoc.body;
95028
+ Array.from(bodyA.childNodes).forEach((node) => {
95029
+ mergedBody.appendChild(mergedDoc.importNode(node, true));
95030
+ });
95031
+ Array.from(bodyB.childNodes).forEach((node) => {
95032
+ mergedBody.appendChild(mergedDoc.importNode(node, true));
95033
+ });
95034
+ return mergedBody.innerHTML;
95035
+ }
95036
+ function combineCkeHtml(html1, html2) {
95037
+ const doc1 = ckeHtml2Doc(html1);
95038
+ const doc2 = ckeHtml2Doc(html2);
95039
+ const newDoc = combineDoc(doc1, doc2);
95040
+ const newHtml = mergeHTMLBodiesOnly(html1, html2);
95041
+ const ret = injectDocToCkeHtmlFragment(newHtml, newDoc);
95042
+ return ret;
95043
+ }
95044
+ function combineRichTextValue(value1, value2) {
95045
+ return combineCkeHtml(value1, value2);
95046
+ }
94537
95047
  const logger = getLogger("create-editor");
95048
+ function getHooks(options, local) {
95049
+ var _a;
95050
+ const hooks = [];
95051
+ if (!options.disableLock) {
95052
+ hooks.push(new BlockLockerHook());
95053
+ }
95054
+ if (!local) {
95055
+ hooks.push(new BlockExclusiveHook());
95056
+ }
95057
+ if ((_a = options.components) == null ? void 0 : _a.blockHooks) {
95058
+ hooks.push(...options.components.blockHooks);
95059
+ }
95060
+ return hooks;
95061
+ }
94538
95062
  function getDefaultOnesEditorOptions(options) {
94539
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
95063
+ var _a, _b, _c, _d, _e, _f, _g, _h;
94540
95064
  const enableComments = options == null ? void 0 : options.enableComments;
94541
95065
  const quickMenu = (_b = (_a = options.componentsOptions) == null ? void 0 : _a.quickMenu) != null ? _b : { id: "quick-menu", trigger: ["/"], commandProviders: [] };
94542
95066
  (_c = quickMenu.commandProviders) == null ? void 0 : _c.push(new GraphCommandProvider());
@@ -94553,11 +95077,11 @@ ${JSON.stringify(error2, null, 2)}`);
94553
95077
  commandProviders: [new TableBlockCommandProvider(), ...((_g = options.components) == null ? void 0 : _g.commandProviders) || []],
94554
95078
  decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
94555
95079
  insertions: [RemoteCaretsInsertion],
94556
- blockHooks: [new BlockLockerHook(), new BlockExclusiveHook(), ...((_h = options.components) == null ? void 0 : _h.blockHooks) || []],
95080
+ blockHooks: getHooks(options, false),
94557
95081
  textRenders: [
94558
95082
  enableComments && new OnesEditorCommentsRender(),
94559
95083
  new BlockPaddingRender(),
94560
- ...((_i = options.components) == null ? void 0 : _i.textRenders) || []
95084
+ ...((_h = options.components) == null ? void 0 : _h.textRenders) || []
94561
95085
  ].filter(Boolean),
94562
95086
  options: { ...options.componentsOptions, quickMenu }
94563
95087
  },
@@ -94576,15 +95100,7 @@ ${JSON.stringify(error2, null, 2)}`);
94576
95100
  TextColorShortcuts,
94577
95101
  ...options.shortcuts || []
94578
95102
  ],
94579
- colors: [
94580
- "#B21B57",
94581
- "#008796",
94582
- "#7241CC",
94583
- "#CC4C08",
94584
- "#5D8F00",
94585
- "#BD2C1C",
94586
- "#D17D00"
94587
- ]
95103
+ colors: ["#B21B57", "#008796", "#7241CC", "#CC4C08", "#5D8F00", "#BD2C1C", "#D17D00"]
94588
95104
  };
94589
95105
  return ret;
94590
95106
  }
@@ -94682,11 +95198,14 @@ ${JSON.stringify(error2, null, 2)}`);
94682
95198
  editor.input.addHandler(new ListPasteHandler());
94683
95199
  editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
94684
95200
  editor.addCustom("remote-cursor", () => new RemoteCarets(editor));
94685
- editor.addCustom("editor-image-preview", () => new ImagePreviewHandler(editor, (editor2, img) => {
94686
- var _a2, _b2;
94687
- (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94688
- }));
94689
- if (options.blockMenuButton !== false) {
95201
+ editor.addCustom(
95202
+ "editor-image-preview",
95203
+ () => new ImagePreviewHandler(editor, (editor2, img) => {
95204
+ var _a2, _b2;
95205
+ (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
95206
+ })
95207
+ );
95208
+ if (options.blockMenuButton !== false && !clientType.isMobile) {
94690
95209
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94691
95210
  }
94692
95211
  if (!clientType.isMobile) {
@@ -94694,7 +95213,6 @@ ${JSON.stringify(error2, null, 2)}`);
94694
95213
  var _a2;
94695
95214
  return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
94696
95215
  });
94697
- editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94698
95216
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94699
95217
  (_c = editor.findCustom("editor-quick-menu")) == null ? void 0 : _c.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
94700
95218
  (_d = editor.findCustom("editor-block-menu")) == null ? void 0 : _d.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
@@ -94735,7 +95253,9 @@ ${JSON.stringify(error2, null, 2)}`);
94735
95253
  OnesEditorTocProvider.register(editor);
94736
95254
  OnesEditorExclusiveBlock.register(editor);
94737
95255
  if (!clientType.isMobile) {
94738
- editor.editorCommandProviders.registerCommandProvider(new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true }));
95256
+ editor.editorCommandProviders.registerCommandProvider(
95257
+ new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
95258
+ );
94739
95259
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94740
95260
  } else {
94741
95261
  editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
@@ -94782,14 +95302,14 @@ ${JSON.stringify(error2, null, 2)}`);
94782
95302
  }
94783
95303
  }
94784
95304
  });
94785
- editor.version = "2.9.7";
95305
+ editor.version = "2.9.8-beta.10";
94786
95306
  return editor;
94787
95307
  }
94788
95308
  function isDoc(doc2) {
94789
95309
  return doc2.toJSON !== void 0;
94790
95310
  }
94791
95311
  async function createLocalEditor(root2, docData, options) {
94792
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
95312
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
94793
95313
  assert(logger, root2, "app does not exists");
94794
95314
  const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
94795
95315
  serverUrl: options.serverUrl || ""
@@ -94805,6 +95325,7 @@ ${JSON.stringify(error2, null, 2)}`);
94805
95325
  id: options.id,
94806
95326
  scrollContainer: options == null ? void 0 : options.scrollContainer,
94807
95327
  enableResolveComments: options == null ? void 0 : options.enableResolveComments,
95328
+ enableComments,
94808
95329
  components: {
94809
95330
  blocks: [...StandardBlocks, ...(_f = (_e = options.components) == null ? void 0 : _e.blocks) != null ? _f : []],
94810
95331
  commandProviders: [new TableBlockCommandProvider()],
@@ -94812,7 +95333,7 @@ ${JSON.stringify(error2, null, 2)}`);
94812
95333
  embeds: [...StandardEmbeds, ...((_g = options.components) == null ? void 0 : _g.embeds) || []],
94813
95334
  boxes: [MathjaxBox, MentionBox, FileBox, StatusBox, ...((_h = options.components) == null ? void 0 : _h.boxes) || []],
94814
95335
  insertions: [RemoteCaretsInsertion],
94815
- blockHooks: [new BlockLockerHook(), ...((_i = options.components) == null ? void 0 : _i.blockHooks) || []],
95336
+ blockHooks: [...((_i = options.components) == null ? void 0 : _i.blockHooks) || []],
94816
95337
  textRenders: [
94817
95338
  enableComments && new OnesEditorCommentsRender(),
94818
95339
  new BlockPaddingRender(),
@@ -94845,11 +95366,14 @@ ${JSON.stringify(error2, null, 2)}`);
94845
95366
  editor.input.addHandler(new OnesEditorPasteHandler(editor));
94846
95367
  editor.input.addHandler(new BlockLockerPasteHandler());
94847
95368
  editor.input.addHandler(new ListPasteHandler());
94848
- editor.addCustom("editor-image-preview", () => new ImagePreviewHandler(editor, (editor2, img) => {
94849
- var _a2, _b2;
94850
- (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94851
- }));
94852
- if (options.blockMenuButton !== false) {
95369
+ editor.addCustom(
95370
+ "editor-image-preview",
95371
+ () => new ImagePreviewHandler(editor, (editor2, img) => {
95372
+ var _a2, _b2;
95373
+ (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
95374
+ })
95375
+ );
95376
+ if (options.blockMenuButton !== false && !clientType.isMobile) {
94853
95377
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94854
95378
  }
94855
95379
  if (!clientType.isMobile) {
@@ -94857,8 +95381,9 @@ ${JSON.stringify(error2, null, 2)}`);
94857
95381
  var _a2;
94858
95382
  return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
94859
95383
  });
94860
- editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94861
- editor.editorCommandProviders.registerCommandProvider(new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true }));
95384
+ editor.editorCommandProviders.registerCommandProvider(
95385
+ new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
95386
+ );
94862
95387
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94863
95388
  (_k = editor.findCustom("editor-quick-menu")) == null ? void 0 : _k.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
94864
95389
  (_l = editor.findCustom("editor-block-menu")) == null ? void 0 : _l.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
@@ -94876,6 +95401,16 @@ ${JSON.stringify(error2, null, 2)}`);
94876
95401
  if (options.enableContextMenu !== false) {
94877
95402
  editor.addCustom("editor-context-menu", (editor2) => new OnesEditorContextMenu(editor2));
94878
95403
  }
95404
+ editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
95405
+ editor.addCustom("drop-target", () => new OnesEditorDropTarget(editor));
95406
+ editor.addCustom("list-to-mindmap", () => new OnesEditorListMindmap(editor));
95407
+ editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
95408
+ editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
95409
+ editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
95410
+ if ((_m = options.componentsOptions) == null ? void 0 : _m.mention) {
95411
+ const mentionOptions = options.componentsOptions.mention;
95412
+ editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
95413
+ }
94879
95414
  if (options.headingButton !== false) {
94880
95415
  editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
94881
95416
  }
@@ -94896,7 +95431,10 @@ ${JSON.stringify(error2, null, 2)}`);
94896
95431
  }
94897
95432
  });
94898
95433
  OnesEditorToolbar.register(editor);
94899
- editor.version = "2.9.7";
95434
+ OnesEditorDropTarget.register(editor);
95435
+ OnesEditorTocProvider.register(editor);
95436
+ OnesEditorExclusiveBlock.register(editor);
95437
+ editor.version = "2.9.8-beta.10";
94900
95438
  return editor;
94901
95439
  }
94902
95440
  async function showDocVersions(editor, options, serverUrl) {
@@ -140689,6 +141227,7 @@ ${JSON.stringify(error2, null, 2)}`);
140689
141227
  exports2.ArrowLeftIcon = arrowLeft;
140690
141228
  exports2.ArrowRightIcon = ArrowRightIcon;
140691
141229
  exports2.ArrowUpIcon = arrowUp;
141230
+ exports2.AttachmentIcon = AttachmentIcon;
140692
141231
  exports2.AudioIcon = AudioIcon;
140693
141232
  exports2.AuthError = AuthError;
140694
141233
  exports2.AuthHeader = AuthHeader;
@@ -140822,9 +141361,11 @@ ${JSON.stringify(error2, null, 2)}`);
140822
141361
  exports2.InputtingInsertion = InputtingInsertion;
140823
141362
  exports2.InsertAfterIcon = InsertAfterIcon;
140824
141363
  exports2.InsertBeforeIcon = InsertBeforeIcon;
141364
+ exports2.InsertFileItem = InsertFileItem;
140825
141365
  exports2.InsertImageItem = InsertImageItem;
140826
141366
  exports2.InsertItem = InsertItem;
140827
141367
  exports2.InsertLinkItem = InsertLinkItem;
141368
+ exports2.InsertMentionItem = InsertMentionItem;
140828
141369
  exports2.InsertMenuProvider = InsertMenuProvider;
140829
141370
  exports2.ItalicIcon = ItalicIcon;
140830
141371
  exports2.LaunchIcon = LaunchIcon;
@@ -140855,6 +141396,7 @@ ${JSON.stringify(error2, null, 2)}`);
140855
141396
  exports2.MathIcon = mathIcon;
140856
141397
  exports2.MathMenuIcon = MathMenuIcon;
140857
141398
  exports2.MaxUserError = MaxUserError;
141399
+ exports2.Mention2Icon = Mention2Icon;
140858
141400
  exports2.MentionIcon = MentionIcon;
140859
141401
  exports2.MergeCellIcon = MergeCellIcon;
140860
141402
  exports2.Mindmap = Mindmap;
@@ -140994,12 +141536,15 @@ ${JSON.stringify(error2, null, 2)}`);
140994
141536
  exports2.blockToText = blockToText;
140995
141537
  exports2.blocksToDoc = blocksToDoc;
140996
141538
  exports2.changeButtonName = changeButtonName;
141539
+ exports2.ckeHtml2Doc = ckeHtml2Doc;
140997
141540
  exports2.clearAllSelection = clearAllSelection;
140998
141541
  exports2.clientType = clientType;
140999
141542
  exports2.cloneBlock = cloneBlock;
141000
141543
  exports2.cloneChildContainer = cloneChildContainer;
141001
141544
  exports2.cloneDoc = cloneDoc;
141002
141545
  exports2.cloneText = cloneText;
141546
+ exports2.combineCkeHtml = combineCkeHtml;
141547
+ exports2.combineRichTextValue = combineRichTextValue;
141003
141548
  exports2.commentToShareDbComment = commentToShareDbComment;
141004
141549
  exports2.compareElement = compareElement;
141005
141550
  exports2.comparePosition = comparePosition;
@@ -141155,6 +141700,7 @@ ${JSON.stringify(error2, null, 2)}`);
141155
141700
  exports2.editorSelectWordLeft = editorSelectWordLeft;
141156
141701
  exports2.editorSetTextColor = editorSetTextColor;
141157
141702
  exports2.editorShowFindDialog = editorShowFindDialog;
141703
+ exports2.editorToCKEHtml = editorToCKEHtml;
141158
141704
  exports2.editorToDocx = editorToDocx;
141159
141705
  exports2.editorUpdateBlockData = editorUpdateBlockData;
141160
141706
  exports2.editorUpdateCompositionText = editorUpdateCompositionText;
@@ -141321,6 +141867,7 @@ ${JSON.stringify(error2, null, 2)}`);
141321
141867
  exports2.i18n = i18n$1;
141322
141868
  exports2.includeBigTable = includeBigTable;
141323
141869
  exports2.injectBlockOptions = injectBlockOptions;
141870
+ exports2.injectDocToCkeHtmlFragment = injectDocToCkeHtmlFragment;
141324
141871
  exports2.injectDocToHtmlFragment = injectDocToHtmlFragment;
141325
141872
  exports2.injectSource = injectSource;
141326
141873
  exports2.injectStyle = injectStyle;