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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -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;
@@ -26071,9 +26089,11 @@ var __publicField = (obj, key, value) => {
26071
26089
  __publicField(this, "composingTimer");
26072
26090
  __publicField(this, "callbacks");
26073
26091
  __publicField(this, "inputElement");
26092
+ __publicField(this, "focused", false);
26074
26093
  __publicField(this, "handleBlur", () => {
26075
26094
  this.editor.emit("blur", this.editor);
26076
26095
  this.callbacks.onBlur();
26096
+ this.focused = false;
26077
26097
  });
26078
26098
  __publicField(this, "handleWindowFocus", () => {
26079
26099
  if (document.activeElement === this.inputElement) {
@@ -26090,6 +26110,7 @@ var __publicField = (obj, key, value) => {
26090
26110
  this.editor.emit("focus", this.editor);
26091
26111
  this.callbacks.onFocus();
26092
26112
  this.editor.input.focus();
26113
+ this.focused = true;
26093
26114
  });
26094
26115
  }
26095
26116
  return;
@@ -26098,7 +26119,9 @@ var __publicField = (obj, key, value) => {
26098
26119
  return;
26099
26120
  }
26100
26121
  setTimeout(() => {
26101
- this.handleBlur();
26122
+ if (this.focused) {
26123
+ this.handleBlur();
26124
+ }
26102
26125
  });
26103
26126
  });
26104
26127
  __publicField(this, "handleDocumentSelectionChange", () => {
@@ -26113,6 +26136,9 @@ var __publicField = (obj, key, value) => {
26113
26136
  return;
26114
26137
  }
26115
26138
  }
26139
+ if (!this.focused) {
26140
+ return;
26141
+ }
26116
26142
  this.handleBlur();
26117
26143
  }, 100);
26118
26144
  });
@@ -26278,6 +26304,7 @@ var __publicField = (obj, key, value) => {
26278
26304
  this.callbacks.onFocus();
26279
26305
  });
26280
26306
  }
26307
+ this.focused = true;
26281
26308
  }
26282
26309
  isInDisableScrollMask(target) {
26283
26310
  let elem = target;
@@ -26314,7 +26341,7 @@ var __publicField = (obj, key, value) => {
26314
26341
  }
26315
26342
  }
26316
26343
  function moveInputToScreenCenter(editor) {
26317
- const container = editor.rootElement;
26344
+ const container = getScrollContainer$1(editor.rootContainer);
26318
26345
  const rect = container.getBoundingClientRect();
26319
26346
  const scale = getElementScale(container);
26320
26347
  const windowWidth = window.innerWidth;
@@ -26326,7 +26353,7 @@ var __publicField = (obj, key, value) => {
26326
26353
  const centerX = (x1 + x2) / 2;
26327
26354
  const centerY = (y1 + y2) / 2;
26328
26355
  const x = 0 - rect.left + centerX;
26329
- const y = 0 - rect.top + centerY;
26356
+ const y = 0 - rect.top + centerY + container.scrollTop;
26330
26357
  const input2 = editor.input.inputElement;
26331
26358
  input2.style.left = `${x / scale}px`;
26332
26359
  input2.style.top = `${y / scale}px`;
@@ -29936,6 +29963,64 @@ ${codeText}
29936
29963
  }
29937
29964
  return doc2;
29938
29965
  }
29966
+ function removeUnknownComponents(editor, doc2) {
29967
+ const getAllBlockTypes = () => {
29968
+ const types2 = [];
29969
+ editor.editorBlocks.forEach((b) => {
29970
+ types2.push(b.blockType);
29971
+ });
29972
+ return types2;
29973
+ };
29974
+ const getAllEmbedTypes = () => {
29975
+ const embeds = [];
29976
+ editor.editorEmbeds.forEach((e2) => {
29977
+ embeds.push(e2.embedType);
29978
+ });
29979
+ return embeds;
29980
+ };
29981
+ const getAllBoxTypes = () => {
29982
+ const boxes = [];
29983
+ editor.editorBoxes.forEach((b) => {
29984
+ boxes.push(b.boxType);
29985
+ });
29986
+ return boxes;
29987
+ };
29988
+ const blockTypes = new Set(getAllBlockTypes());
29989
+ const embedTypes = new Set(getAllEmbedTypes());
29990
+ const boxTypes = new Set(getAllBoxTypes());
29991
+ Array.from(Object.keys(doc2.blocks)).forEach((containerId) => {
29992
+ const blocks = doc2.blocks[containerId];
29993
+ for (let i = blocks.length - 1; i >= 0; i--) {
29994
+ const block = blocks[i];
29995
+ const blockType = block.type;
29996
+ if (isTextKindBlockType(editor, blockType)) {
29997
+ const text2 = block.text;
29998
+ for (let j = text2.length - 1; j >= 0; j--) {
29999
+ const op = text2[j];
30000
+ if (isBoxOp(op)) {
30001
+ const box = op.attributes;
30002
+ if (!boxTypes.has(box.type)) {
30003
+ text2.splice(j, 1);
30004
+ }
30005
+ }
30006
+ }
30007
+ } else if (blockType === "embed") {
30008
+ const embed = block;
30009
+ const embedType = embed.embedType;
30010
+ if (!embedTypes.has(embedType)) {
30011
+ blocks.splice(i, 1);
30012
+ }
30013
+ } else {
30014
+ if (!blockTypes.has(block.type)) {
30015
+ blocks.splice(i, 1);
30016
+ }
30017
+ }
30018
+ }
30019
+ if (blocks.length === 0) {
30020
+ blocks.push(createEmptyTextBlockData());
30021
+ }
30022
+ });
30023
+ }
29939
30024
  class EditorInputHandlers {
29940
30025
  constructor(editor) {
29941
30026
  __publicField(this, "editor");
@@ -30194,6 +30279,7 @@ ${codeText}
30194
30279
  return;
30195
30280
  }
30196
30281
  }
30282
+ removeUnknownComponents(this.editor, doc2);
30197
30283
  const cloneDocResult = { blockIdMap: /* @__PURE__ */ new Map(), containerIdMap: /* @__PURE__ */ new Map(), boxIdMap: /* @__PURE__ */ new Map() };
30198
30284
  await editorInsertDocWithResources(this.editor, doc2, cloneDocResult);
30199
30285
  for (let i = 0; i < this.handlers.length; i++) {
@@ -41038,6 +41124,8 @@ ${codeText}
41038
41124
  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
41125
  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
41126
  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';
41127
+ 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';
41128
+ 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
41129
  const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41042
41130
  __proto__: null,
41043
41131
  TableEditIcon,
@@ -41168,7 +41256,9 @@ ${codeText}
41168
41256
  LoadingCircleIcon,
41169
41257
  TextGroupIcon,
41170
41258
  AdjustWidthIcon,
41171
- TocIcon
41259
+ TocIcon,
41260
+ AttachmentIcon,
41261
+ Mention2Icon
41172
41262
  }, Symbol.toStringTag, { value: "Module" }));
41173
41263
  function createLoading() {
41174
41264
  const loading2 = createElement("span", ["editor-loading-icon"], null);
@@ -41789,6 +41879,9 @@ ${codeText}
41789
41879
  }
41790
41880
  const content = createElement("div", ["editor-command-bar-root"], null);
41791
41881
  content.setAttribute("data-keep-editor-focus", "");
41882
+ if (this.options.rootId) {
41883
+ content.setAttribute("data-command-bar-root-id", this.options.rootId);
41884
+ }
41792
41885
  if (this.options.header) {
41793
41886
  const headerElem = createElement("div", ["editor-command-bar-header"], null);
41794
41887
  if (this.options.header instanceof Function) {
@@ -42598,7 +42691,7 @@ ${codeText}
42598
42691
  });
42599
42692
  }
42600
42693
  initCommandBarElement(elem) {
42601
- addClass(elem, "dialog", "manual");
42694
+ addClass(elem, "command-dialog", "manual");
42602
42695
  }
42603
42696
  initItemElement(item, elem) {
42604
42697
  }
@@ -54875,7 +54968,7 @@ ${codeText}
54875
54968
  const svg = await mathjax2Svg(editor, tex);
54876
54969
  const data2 = svg;
54877
54970
  const file2 = new File([data2], "math.svg");
54878
- const path = await editor.doc.uploadResource(file2);
54971
+ const path = await editor.doc.uploadResource(file2, { resourceType: "graph" });
54879
54972
  return path.resourceId;
54880
54973
  }
54881
54974
  async function convertAndUploadMathjaxForEmbed(editor, tex) {
@@ -54883,7 +54976,7 @@ ${codeText}
54883
54976
  const perfectState = analyzeMathjaxSvgWidth(svg);
54884
54977
  const data2 = svg;
54885
54978
  const file2 = new File([data2], "math.svg");
54886
- const path = await editor.doc.uploadResource(file2);
54979
+ const path = await editor.doc.uploadResource(file2, { resourceType: "graph" });
54887
54980
  return {
54888
54981
  resourceId: path.resourceId,
54889
54982
  ...perfectState
@@ -55156,7 +55249,7 @@ ${codeText}
55156
55249
  return ` $${math.tex}$ `;
55157
55250
  }
55158
55251
  if (math.src) {
55159
- return `<img src="${editor.doc.buildResourceUrl(math.src, { withToken: true })}" />`;
55252
+ return `<img data-embed-type="mathjax" data-uuid="mathjax:${math.src}" src="${editor.doc.buildResourceUrl(math.src, { withToken: true })}" />`;
55160
55253
  }
55161
55254
  return `<code>$${math.tex}$</code>`;
55162
55255
  }
@@ -55337,7 +55430,7 @@ ${codeText}
55337
55430
  function convertTo$g(editor, blockData, doc2, type) {
55338
55431
  const mathData = blockData.embedData;
55339
55432
  if (type === "html") {
55340
- return `<img src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
55433
+ return `<img data-embed-type="mathjax" data-uuid="mathjax:${mathData.src}" src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
55341
55434
  }
55342
55435
  if (type === "markdown") {
55343
55436
  return `
@@ -64110,6 +64203,17 @@ $$${mathData.mathjaxText}$$
64110
64203
  const failedLoad = !!block.querySelector(".images > .image-container.error, .images > .image-container.empty ");
64111
64204
  const width = calImageBlockStyleWidth(editor, blockData, parentContainer, failedLoad);
64112
64205
  const height = calBlockHeight(editor, blockData, parentContainer, failedLoad);
64206
+ if (width.startsWith("0") && height.startsWith("0")) {
64207
+ const image = block.querySelector("img");
64208
+ if (image) {
64209
+ image.onload = () => {
64210
+ setTimeout(() => {
64211
+ updateImageBlockSize(editor, blockData, blockElement, parentContainerElement);
64212
+ }, 300);
64213
+ };
64214
+ }
64215
+ return;
64216
+ }
64113
64217
  const content = getBlockContent(block);
64114
64218
  if (width === "auto") {
64115
64219
  content.style.width = width;
@@ -64887,7 +64991,8 @@ $$${mathData.mathjaxText}$$
64887
64991
  const res = await this.editor.doc.uploadResource(file2, {
64888
64992
  onProgress: (progress) => {
64889
64993
  setImageUploading(imageContainer, progress);
64890
- }
64994
+ },
64995
+ resourceType: "image"
64891
64996
  });
64892
64997
  removeClass(imageContainer, "uploading");
64893
64998
  this.images[index2].src = res.resourceId;
@@ -68864,7 +68969,7 @@ ${codeText}
68864
68969
  }
68865
68970
  const fileName = `image.${ext}`;
68866
68971
  const file2 = new File([blob], fileName, { type: mimeString });
68867
- const ret = await editor.doc.uploadResource(file2);
68972
+ const ret = await editor.doc.uploadResource(file2, { resourceType: "paste" });
68868
68973
  return ret.resourceId;
68869
68974
  }
68870
68975
  return src;
@@ -69076,7 +69181,7 @@ ${codeText}
69076
69181
  const data2 = blockData.embedData;
69077
69182
  const images = getImages$1(data2);
69078
69183
  if (type === "html") {
69079
- return images.map((image) => `<img src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
69184
+ return images.map((image) => `<img data-embed-type="image" data-uuid="image:${data2.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
69080
69185
  }
69081
69186
  if (type === "markdown") {
69082
69187
  const markdown = images.map((image) => `![img](${editor.doc.buildResourceUrl(image.src, { withToken: true })})`).join("\n");
@@ -80336,7 +80441,7 @@ ${docStr}
80336
80441
  const data2 = boxData;
80337
80442
  if (type === "html") {
80338
80443
  if (data2.src) {
80339
- return `<a href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a>`;
80444
+ return `<a data-embed-type="file" data-uuid="file:${data2.src}" href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a>`;
80340
80445
  }
80341
80446
  return `[${data2.fileName}]`;
80342
80447
  }
@@ -80451,14 +80556,10 @@ ${docStr}
80451
80556
  }
80452
80557
  nameElement.title = fileName;
80453
80558
  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));
80559
+ const timeText = i18n$1.t("file.uploadedTime", { time: formatDate(new Date(created), "YYYY-MM-DD hh:mm") });
80560
+ const sizeText = formatBytes(fileSize);
80561
+ const infoText = `${creator} ${timeText} ${sizeText}`;
80562
+ createElement("div", ["info"], infos, infoText);
80462
80563
  const actions2 = createElement("div", ["file-actions"], card);
80463
80564
  const options = editor.getComponentOptions("file");
80464
80565
  let copilotButton;
@@ -80638,7 +80739,7 @@ ${docStr}
80638
80739
  const data2 = embedData;
80639
80740
  if (type === "html") {
80640
80741
  if (data2.src) {
80641
- return `<p><a href="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" >${data2.fileName}</a></p>`;
80742
+ 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
80743
  }
80643
80744
  return `<p>[${data2.fileName}]</p>`;
80644
80745
  }
@@ -85993,7 +86094,7 @@ ${docStr}
85993
86094
  const file2 = new File([buffer], `${genId()}.svg`, {
85994
86095
  type: "image/svg+xml"
85995
86096
  });
85996
- const ret = await editor.doc.uploadResource(file2);
86097
+ const ret = await editor.doc.uploadResource(file2, { resourceType: "graph" });
85997
86098
  return ret.resourceId;
85998
86099
  }
85999
86100
  const _MermaidInstance = class extends GraphBase {
@@ -86162,7 +86263,7 @@ ${docStr}
86162
86263
  const data2 = embedData;
86163
86264
  if (type === "html") {
86164
86265
  if (data2.src) {
86165
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86266
+ return `<img data-embed-type="mermaid" data-uuid="mermaid:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86166
86267
  }
86167
86268
  if (data2.mermaidText) {
86168
86269
  return `<div class="mermaid">${data2.mermaidText}</div>`;
@@ -86231,7 +86332,7 @@ ${data2.mermaidText}
86231
86332
  const file2 = new File([buffer], `${genId()}.svg`, {
86232
86333
  type: "image/svg+xml"
86233
86334
  });
86234
- const resource = await editor.doc.uploadResource(file2);
86335
+ const resource = await editor.doc.uploadResource(file2, { resourceType: "graph" });
86235
86336
  return resource.resourceId;
86236
86337
  }
86237
86338
  const _FlowChartInstance = class extends GraphBase {
@@ -86328,7 +86429,7 @@ ${data2.mermaidText}
86328
86429
  const data2 = embedData;
86329
86430
  if (type === "html") {
86330
86431
  if (data2.src) {
86331
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86432
+ return `<img data-embed-type="flowchart" data-uuid="flowchart:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
86332
86433
  }
86333
86434
  if (data2.flowchartText) {
86334
86435
  return `<div>${data2.flowchartText}</div>`;
@@ -86686,7 +86787,7 @@ ${data2.flowchartText}
86686
86787
  });
86687
86788
  const targetBlock = editor.findBlockById(getBlockId(block));
86688
86789
  if (targetBlock) {
86689
- const res = await editor.doc.uploadResource(file2);
86790
+ const res = await editor.doc.uploadResource(file2, { resourceType: "graph" });
86690
86791
  const { resourceId } = res;
86691
86792
  const oldData = editor.getBlockData(targetBlock);
86692
86793
  const oldEmbedData = oldData.embedData;
@@ -86738,31 +86839,40 @@ ${data2.flowchartText}
86738
86839
  const xml = drawIoData.xmlSvg || drawIoData.xml || "";
86739
86840
  switch (msg.event) {
86740
86841
  case "configure":
86741
- iframe.contentWindow.postMessage(JSON.stringify({
86742
- action: "configure",
86743
- config: {
86744
- defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
86745
- }
86746
- }), "*");
86842
+ iframe.contentWindow.postMessage(
86843
+ JSON.stringify({
86844
+ action: "configure",
86845
+ config: {
86846
+ defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
86847
+ }
86848
+ }),
86849
+ "*"
86850
+ );
86747
86851
  break;
86748
86852
  case "init":
86749
- iframe.contentWindow.postMessage(JSON.stringify({
86750
- action: "load",
86751
- saveAndExit: 1,
86752
- noSaveBtn: 1,
86753
- noExitBtn: 0,
86754
- xml
86755
- }), "*");
86853
+ iframe.contentWindow.postMessage(
86854
+ JSON.stringify({
86855
+ action: "load",
86856
+ saveAndExit: 1,
86857
+ noSaveBtn: 1,
86858
+ noExitBtn: 0,
86859
+ xml
86860
+ }),
86861
+ "*"
86862
+ );
86756
86863
  loaded();
86757
86864
  loadingHandler.removeLoading();
86758
86865
  break;
86759
86866
  case "save":
86760
86867
  exportFlag = "save";
86761
- iframe.contentWindow.postMessage(JSON.stringify({
86762
- action: "export",
86763
- format: "xmlsvg",
86764
- spin: "Saving graph"
86765
- }), "*");
86868
+ iframe.contentWindow.postMessage(
86869
+ JSON.stringify({
86870
+ action: "export",
86871
+ format: "xmlsvg",
86872
+ spin: "Saving graph"
86873
+ }),
86874
+ "*"
86875
+ );
86766
86876
  break;
86767
86877
  case "export":
86768
86878
  if (exportFlag !== "auto") {
@@ -86788,12 +86898,15 @@ ${data2.flowchartText}
86788
86898
  allowRetry: true,
86789
86899
  onOk: () => {
86790
86900
  setTimeout(() => {
86791
- drawioIframeWindow.postMessage(JSON.stringify({
86792
- action: "export",
86793
- format: "xmlsvg",
86794
- spin: i18n$1.t("drawio.save"),
86795
- autoSave: exportFlag
86796
- }), "*");
86901
+ drawioIframeWindow.postMessage(
86902
+ JSON.stringify({
86903
+ action: "export",
86904
+ format: "xmlsvg",
86905
+ spin: i18n$1.t("drawio.save"),
86906
+ autoSave: exportFlag
86907
+ }),
86908
+ "*"
86909
+ );
86797
86910
  }, 1e3);
86798
86911
  },
86799
86912
  onClose: () => {
@@ -86859,12 +86972,15 @@ ${data2.flowchartText}
86859
86972
  if (!drawioIframe || !drawioIframe.contentWindow) {
86860
86973
  return;
86861
86974
  }
86862
- drawioIframe.contentWindow.postMessage(JSON.stringify({
86863
- action: "export",
86864
- format: "xmlsvg",
86865
- spin: "Saving graph",
86866
- autoSave: true
86867
- }), "*");
86975
+ drawioIframe.contentWindow.postMessage(
86976
+ JSON.stringify({
86977
+ action: "export",
86978
+ format: "xmlsvg",
86979
+ spin: "Saving graph",
86980
+ autoSave: true
86981
+ }),
86982
+ "*"
86983
+ );
86868
86984
  }, SAVE_DELAY_TIME);
86869
86985
  };
86870
86986
  const exit = () => {
@@ -87004,10 +87120,12 @@ ${data2.flowchartText}
87004
87120
  }
87005
87121
  function updateGraphByXml(mxFile, embed, editor) {
87006
87122
  assert(logger$i, editor, "parameter missing");
87007
- initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
87008
- checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
87009
- maxRetryTime: 5e3
87010
- })).then(() => {
87123
+ initDrawIo(editor).then(
87124
+ () => loopCheckResourceWasLoaded({
87125
+ checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
87126
+ maxRetryTime: 5e3
87127
+ })
87128
+ ).then(() => {
87011
87129
  const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec, Graph } = window;
87012
87130
  assert(logger$i, mxUtils, "External resource loading exception: mxUtils");
87013
87131
  assert(logger$i, MxGraph, "External resource loading exception: MxGraph");
@@ -87027,7 +87145,10 @@ ${data2.flowchartText}
87027
87145
  const raw = atob(diagramBase64);
87028
87146
  const pako = window.pako;
87029
87147
  assert(logger$i, pako, "External resource loading exception: pako");
87030
- const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
87148
+ const encodedXml = pako.inflateRaw(
87149
+ Uint8Array.from(raw, (c) => c.charCodeAt(0)),
87150
+ { to: "string" }
87151
+ );
87031
87152
  const xml = decodeURIComponent(encodedXml);
87032
87153
  xmlDoc = mxUtils.parseXml(xml);
87033
87154
  } else {
@@ -87271,7 +87392,7 @@ ${data2.flowchartText}
87271
87392
  const data2 = embedData;
87272
87393
  if (type === "html") {
87273
87394
  if (data2.src) {
87274
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87395
+ return `<img data-embed-type="drawio" data-uuid="drawio:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87275
87396
  }
87276
87397
  if (data2.xmlSvg) {
87277
87398
  return data2.xmlSvg;
@@ -87361,7 +87482,7 @@ ${data2.flowchartText}
87361
87482
  if (!plantumlImgFile) {
87362
87483
  return await Promise.resolve(url);
87363
87484
  }
87364
- const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile);
87485
+ const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile, { resourceType: "graph" });
87365
87486
  return uploadResourceResult.resourceId;
87366
87487
  } catch (error2) {
87367
87488
  return Promise.resolve(url);
@@ -87465,7 +87586,7 @@ ${data2.flowchartText}
87465
87586
  const data2 = embedData;
87466
87587
  if (type === "html") {
87467
87588
  if (data2.src) {
87468
- return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87589
+ return `<img data-embed-type="plantuml" data-uuid="plantuml:${data2.src}" src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
87469
87590
  }
87470
87591
  if (data2.plantumlText) {
87471
87592
  return `<div>${data2.plantumlText}</div>`;
@@ -90896,7 +91017,8 @@ ${data2.plantumlText}
90896
91017
  const { resourceId } = await editor.doc.uploadResource(file2, {
90897
91018
  onProgress: (progress) => {
90898
91019
  this.renderProgress(progress, file2);
90899
- }
91020
+ },
91021
+ resourceType: "media"
90900
91022
  });
90901
91023
  const { name, type, size } = file2;
90902
91024
  const newBlockData = {
@@ -91034,7 +91156,11 @@ ${data2.plantumlText}
91034
91156
  renderEmpty(blockData) {
91035
91157
  assert(logger$9, this.abstract, "no abstract");
91036
91158
  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);
91159
+ const empty = createElement(
91160
+ "div",
91161
+ ["media-empty", "embed-selected-content", "embed-hover-content"],
91162
+ this.mediaContainer
91163
+ );
91038
91164
  empty.innerHTML = this.abstract.mediaIcon;
91039
91165
  this.updateMediaContent(empty);
91040
91166
  const { editor } = this.options;
@@ -91055,7 +91181,7 @@ ${data2.plantumlText}
91055
91181
  }
91056
91182
  await editor.doc.addResources([resourceId]);
91057
91183
  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))) {
91184
+ if (resourceUrl !== blockData.embedData.src && serviceAppId && blockData.embedData.src.includes(serviceAppId)) {
91059
91185
  const block = getParentBlock(content);
91060
91186
  if (block && !editor.readonly && editor.isBlockWritable(block)) {
91061
91187
  const newBlockData = cloneDeep__default.default(blockData);
@@ -91196,7 +91322,7 @@ ${data2.plantumlText}
91196
91322
  const mediaData = blockData.embedData;
91197
91323
  const url = editor.doc.buildResourceUrl(mediaData.src, { withToken: true });
91198
91324
  if (type === "html") {
91199
- return `<${mediaData.type} src="${url}" />`;
91325
+ return `<${this.embedType} data-embed-type="${this.embedType}" data-uuid="${this.embedType}:${mediaData.src}" src="${url}" />`;
91200
91326
  }
91201
91327
  if (type === "markdown") {
91202
91328
  return `![${mediaData.src}](${url})`;
@@ -94237,11 +94363,11 @@ ${JSON.stringify(error2, null, 2)}`);
94237
94363
  this.fixedToolbar = (_a = editor.findCustom("main-toolbar-fixed-toolbar")) == null ? void 0 : _a.toolbar;
94238
94364
  if (this.fixedToolbar) {
94239
94365
  const content = this.fixedToolbar.content;
94240
- const toolbar2 = content.closest(".editor-command-bar-root");
94366
+ const resizer = content.closest(".editor-main-toolbar-resizer");
94241
94367
  this.observer = new ResizeObserver(() => {
94242
94368
  this.updateItems();
94243
94369
  });
94244
- this.observer.observe(toolbar2);
94370
+ this.observer.observe(resizer);
94245
94371
  editor.addCustom("main-toolbar-more-item", () => this);
94246
94372
  }
94247
94373
  });
@@ -94268,7 +94394,7 @@ ${JSON.stringify(error2, null, 2)}`);
94268
94394
  return;
94269
94395
  }
94270
94396
  const content = toolbar2.content;
94271
- const toolbarRoot = content.closest(".editor-command-bar-root");
94397
+ const toolbarRoot = content.closest(".editor-main-toolbar-resizer");
94272
94398
  const toolbarRect = toolbarRoot.getBoundingClientRect();
94273
94399
  const toolbarRight = toolbarRect.right;
94274
94400
  items.forEach((item) => {
@@ -94338,8 +94464,67 @@ ${JSON.stringify(error2, null, 2)}`);
94338
94464
  toolbar2.updateItems(items);
94339
94465
  }
94340
94466
  }
94467
+ class InsertFileItem {
94468
+ constructor() {
94469
+ __publicField(this, "id", "insert-file");
94470
+ __publicField(this, "name", i18n$1.t("toolbar.file"));
94471
+ __publicField(this, "icon", AttachmentIcon);
94472
+ }
94473
+ async onClick(editor, item) {
94474
+ const block = editor.getBlockById(editor.selection.range.start.blockId);
94475
+ const container = editor.getParentContainer(block);
94476
+ const index2 = editor.getBlockIndex(block);
94477
+ const file2 = await selectFile("*");
94478
+ if (!file2) {
94479
+ return;
94480
+ }
94481
+ const res = await editor.doc.uploadResource(file2);
94482
+ if (!res.resourceId) {
94483
+ return;
94484
+ }
94485
+ const data2 = {
94486
+ src: res.resourceId,
94487
+ fileName: file2.name,
94488
+ fileSize: file2.size,
94489
+ fileType: file2.type,
94490
+ created: Date.now(),
94491
+ creator: editor.doc.getUser().displayName,
94492
+ previewType: FilePreviewType.Card
94493
+ };
94494
+ editor.insertEmbed(getContainerId(container), index2 + 1, "office", data2);
94495
+ }
94496
+ }
94497
+ class InsertMentionItem {
94498
+ constructor() {
94499
+ __publicField(this, "id", "insert-mention");
94500
+ __publicField(this, "name", i18n$1.t("toolbar.mention"));
94501
+ __publicField(this, "icon", Mention2Icon);
94502
+ }
94503
+ onClick(editor, item) {
94504
+ editor.clearSelectedContents();
94505
+ const focus = editor.selection.range.focus;
94506
+ if (!focus.isSimple()) {
94507
+ return;
94508
+ }
94509
+ const block = editor.getBlockById(focus.blockId);
94510
+ if (!isTextKindBlock(editor, block)) {
94511
+ return;
94512
+ }
94513
+ editor.focus();
94514
+ editor.insertTextToBlock(block, focus.offset, "@");
94515
+ const mention = editor.findCustom("mention");
94516
+ if (mention) {
94517
+ const suggest = mention.suggest;
94518
+ if (suggest) {
94519
+ const container = getParentContainer(block);
94520
+ suggest.handleAfterInsertText(editor, getContainerId(container), getBlockIndex(block), focus.offset, "@");
94521
+ }
94522
+ }
94523
+ }
94524
+ }
94341
94525
  function getToolbarDefaultItems(editor) {
94342
- return [
94526
+ const commentsEnabled = !!editor.options.enableComments;
94527
+ const items = [
94343
94528
  new UndoItem(),
94344
94529
  new RedoItem(),
94345
94530
  new SeparatorItem(),
@@ -94364,14 +94549,15 @@ ${JSON.stringify(error2, null, 2)}`);
94364
94549
  new AlignCenterItem(),
94365
94550
  new AlignRightItem(),
94366
94551
  new SeparatorItem(),
94367
- new InsertImageItem(),
94368
- new SeparatorItem(),
94369
94552
  new InsertItem(editor),
94370
94553
  new SeparatorItem(),
94371
- new FindReplaceItem(),
94372
- new CommentItem(),
94373
- new MoreItem(editor)
94554
+ new FindReplaceItem()
94374
94555
  ];
94556
+ if (commentsEnabled) {
94557
+ items.push(new CommentItem());
94558
+ }
94559
+ items.push(new MoreItem(editor));
94560
+ return items;
94375
94561
  }
94376
94562
  const zhCN = {
94377
94563
  toolbar: {
@@ -94384,7 +94570,10 @@ ${JSON.stringify(error2, null, 2)}`);
94384
94570
  quote: "\u5F15\u7528",
94385
94571
  checkList: "\u4EFB\u52A1\u5217\u8868",
94386
94572
  orderedList: "\u6709\u5E8F\u5217\u8868",
94387
- unorderedList: "\u65E0\u5E8F\u5217\u8868"
94573
+ unorderedList: "\u65E0\u5E8F\u5217\u8868",
94574
+ fullscreen: "\u5168\u5C4F",
94575
+ file: "\u63D2\u5165\u6587\u4EF6",
94576
+ mention: "\u63D0\u53CA\u7528\u6237"
94388
94577
  }
94389
94578
  };
94390
94579
  const zhHK = {
@@ -94398,7 +94587,10 @@ ${JSON.stringify(error2, null, 2)}`);
94398
94587
  quote: "\u5F15\u7528",
94399
94588
  checkList: "\u4EFB\u52D9\u5217\u8868",
94400
94589
  orderedList: "\u6709\u5E8F\u5217\u8868",
94401
- unorderedList: "\u7121\u5E8F\u5217\u8868"
94590
+ unorderedList: "\u7121\u5E8F\u5217\u8868",
94591
+ fullscreen: "\u5168\u5C4F",
94592
+ file: "\u63D2\u5165\u6587\u4EF6",
94593
+ mention: "\u63D0\u53CA\u7528\u6236"
94402
94594
  }
94403
94595
  };
94404
94596
  const enUS = {
@@ -94412,7 +94604,10 @@ ${JSON.stringify(error2, null, 2)}`);
94412
94604
  quote: "Quote",
94413
94605
  checkList: "Check List",
94414
94606
  orderedList: "Ordered List",
94415
- unorderedList: "Unordered List"
94607
+ unorderedList: "Unordered List",
94608
+ fullscreen: "Full Screen",
94609
+ file: "File",
94610
+ mention: "Mention user"
94416
94611
  }
94417
94612
  };
94418
94613
  const jaJP = {
@@ -94426,7 +94621,10 @@ ${JSON.stringify(error2, null, 2)}`);
94426
94621
  quote: "\u5F15\u7528",
94427
94622
  checkList: "\u30C1\u30A7\u30C3\u30AF\u30EA\u30B9\u30C8",
94428
94623
  orderedList: "\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",
94429
- unorderedList: "\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8"
94624
+ unorderedList: "\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",
94625
+ fullscreen: "\u5168\u753B\u9762\u8868\u793A",
94626
+ file: "\u30D5\u30A1\u30A4\u30EB\u3092\u633F\u5165",
94627
+ mention: "\u30E6\u30FC\u30B6\u30FC\u3092\u30E1\u30F3\u30B7\u30E7\u30F3"
94430
94628
  }
94431
94629
  };
94432
94630
  i18n$1.mergeLang({
@@ -94437,8 +94635,10 @@ ${JSON.stringify(error2, null, 2)}`);
94437
94635
  });
94438
94636
  const style = "";
94439
94637
  class MainToolbar {
94440
- constructor(editor, parent) {
94638
+ constructor(editor, parent, options = {}) {
94441
94639
  __publicField(this, "toolbar");
94640
+ __publicField(this, "toolbarFullScreen");
94641
+ __publicField(this, "root");
94442
94642
  __publicField(this, "handleClick", (bar2, item) => {
94443
94643
  const command = item;
94444
94644
  if (command.onClick) {
@@ -94475,7 +94675,13 @@ ${JSON.stringify(error2, null, 2)}`);
94475
94675
  this.updateState();
94476
94676
  });
94477
94677
  this.editor = editor;
94478
- this.toolbar = new FixedToolbar(parent, this.getItems(), {
94678
+ this.options = options;
94679
+ const root2 = createElement("div", ["editor-main-toolbar-root"], parent);
94680
+ const container = createElement("div", ["editor-main-toolbar-resizer"], root2);
94681
+ const resizer = createElement("div", ["editor-main-toolbar-container"], container);
94682
+ const items = getToolbarDefaultItems(editor);
94683
+ this.root = root2;
94684
+ this.toolbar = new FixedToolbar(resizer, items, {
94479
94685
  tooltipId: editor.clientId,
94480
94686
  id: "main-toolbar"
94481
94687
  });
@@ -94487,16 +94693,39 @@ ${JSON.stringify(error2, null, 2)}`);
94487
94693
  destroy: () => {
94488
94694
  }
94489
94695
  }));
94696
+ if (options.enableFullScreen) {
94697
+ const fullScreenItem = {
94698
+ id: "main-toolbar-fullscreen",
94699
+ icon: FullScreenIcon,
94700
+ name: i18n$1.t("toolbar.fullscreen")
94701
+ };
94702
+ this.toolbarFullScreen = new FixedToolbar(root2, [fullScreenItem], {
94703
+ tooltipId: editor.clientId,
94704
+ id: "main-toolbar-fullscreen",
94705
+ rootId: "main-toolbar-fullscreen"
94706
+ });
94707
+ this.toolbarFullScreen.addListener("click", (bar2, item) => {
94708
+ var _a;
94709
+ if (item.id === "main-toolbar-fullscreen") {
94710
+ (_a = options.onFullScreenClick) == null ? void 0 : _a.call(options, this.editor, item);
94711
+ this.handleSelectionChanged();
94712
+ }
94713
+ });
94714
+ }
94490
94715
  }
94491
94716
  destroy() {
94717
+ var _a;
94492
94718
  this.toolbar.destroy();
94719
+ this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
94720
+ (_a = this.toolbarFullScreen) == null ? void 0 : _a.destroy();
94721
+ this.root.remove();
94493
94722
  }
94494
94723
  setItems(items) {
94495
94724
  this.toolbar.updateItems(items);
94496
94725
  this.updateState();
94497
94726
  }
94498
94727
  getItems() {
94499
- return getToolbarDefaultItems(this.editor);
94728
+ return this.toolbar.items;
94500
94729
  }
94501
94730
  updateState() {
94502
94731
  const items = this.toolbar.items;
@@ -94535,8 +94764,22 @@ ${JSON.stringify(error2, null, 2)}`);
94535
94764
  });
94536
94765
  }
94537
94766
  const logger = getLogger("create-editor");
94767
+ function getHooks(options, local) {
94768
+ var _a;
94769
+ const hooks = [];
94770
+ if (!options.disableLock) {
94771
+ hooks.push(new BlockLockerHook());
94772
+ }
94773
+ if (!local) {
94774
+ hooks.push(new BlockExclusiveHook());
94775
+ }
94776
+ if ((_a = options.components) == null ? void 0 : _a.blockHooks) {
94777
+ hooks.push(...options.components.blockHooks);
94778
+ }
94779
+ return hooks;
94780
+ }
94538
94781
  function getDefaultOnesEditorOptions(options) {
94539
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
94782
+ var _a, _b, _c, _d, _e, _f, _g, _h;
94540
94783
  const enableComments = options == null ? void 0 : options.enableComments;
94541
94784
  const quickMenu = (_b = (_a = options.componentsOptions) == null ? void 0 : _a.quickMenu) != null ? _b : { id: "quick-menu", trigger: ["/"], commandProviders: [] };
94542
94785
  (_c = quickMenu.commandProviders) == null ? void 0 : _c.push(new GraphCommandProvider());
@@ -94553,11 +94796,11 @@ ${JSON.stringify(error2, null, 2)}`);
94553
94796
  commandProviders: [new TableBlockCommandProvider(), ...((_g = options.components) == null ? void 0 : _g.commandProviders) || []],
94554
94797
  decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
94555
94798
  insertions: [RemoteCaretsInsertion],
94556
- blockHooks: [new BlockLockerHook(), new BlockExclusiveHook(), ...((_h = options.components) == null ? void 0 : _h.blockHooks) || []],
94799
+ blockHooks: getHooks(options, false),
94557
94800
  textRenders: [
94558
94801
  enableComments && new OnesEditorCommentsRender(),
94559
94802
  new BlockPaddingRender(),
94560
- ...((_i = options.components) == null ? void 0 : _i.textRenders) || []
94803
+ ...((_h = options.components) == null ? void 0 : _h.textRenders) || []
94561
94804
  ].filter(Boolean),
94562
94805
  options: { ...options.componentsOptions, quickMenu }
94563
94806
  },
@@ -94576,15 +94819,7 @@ ${JSON.stringify(error2, null, 2)}`);
94576
94819
  TextColorShortcuts,
94577
94820
  ...options.shortcuts || []
94578
94821
  ],
94579
- colors: [
94580
- "#B21B57",
94581
- "#008796",
94582
- "#7241CC",
94583
- "#CC4C08",
94584
- "#5D8F00",
94585
- "#BD2C1C",
94586
- "#D17D00"
94587
- ]
94822
+ colors: ["#B21B57", "#008796", "#7241CC", "#CC4C08", "#5D8F00", "#BD2C1C", "#D17D00"]
94588
94823
  };
94589
94824
  return ret;
94590
94825
  }
@@ -94682,11 +94917,14 @@ ${JSON.stringify(error2, null, 2)}`);
94682
94917
  editor.input.addHandler(new ListPasteHandler());
94683
94918
  editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
94684
94919
  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) {
94920
+ editor.addCustom(
94921
+ "editor-image-preview",
94922
+ () => new ImagePreviewHandler(editor, (editor2, img) => {
94923
+ var _a2, _b2;
94924
+ (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94925
+ })
94926
+ );
94927
+ if (options.blockMenuButton !== false && !clientType.isMobile) {
94690
94928
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94691
94929
  }
94692
94930
  if (!clientType.isMobile) {
@@ -94694,7 +94932,6 @@ ${JSON.stringify(error2, null, 2)}`);
94694
94932
  var _a2;
94695
94933
  return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
94696
94934
  });
94697
- editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94698
94935
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94699
94936
  (_c = editor.findCustom("editor-quick-menu")) == null ? void 0 : _c.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
94700
94937
  (_d = editor.findCustom("editor-block-menu")) == null ? void 0 : _d.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
@@ -94735,7 +94972,9 @@ ${JSON.stringify(error2, null, 2)}`);
94735
94972
  OnesEditorTocProvider.register(editor);
94736
94973
  OnesEditorExclusiveBlock.register(editor);
94737
94974
  if (!clientType.isMobile) {
94738
- editor.editorCommandProviders.registerCommandProvider(new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true }));
94975
+ editor.editorCommandProviders.registerCommandProvider(
94976
+ new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
94977
+ );
94739
94978
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94740
94979
  } else {
94741
94980
  editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
@@ -94782,14 +95021,14 @@ ${JSON.stringify(error2, null, 2)}`);
94782
95021
  }
94783
95022
  }
94784
95023
  });
94785
- editor.version = "2.9.7";
95024
+ editor.version = "2.9.8-beta.2";
94786
95025
  return editor;
94787
95026
  }
94788
95027
  function isDoc(doc2) {
94789
95028
  return doc2.toJSON !== void 0;
94790
95029
  }
94791
95030
  async function createLocalEditor(root2, docData, options) {
94792
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
95031
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
94793
95032
  assert(logger, root2, "app does not exists");
94794
95033
  const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
94795
95034
  serverUrl: options.serverUrl || ""
@@ -94805,6 +95044,7 @@ ${JSON.stringify(error2, null, 2)}`);
94805
95044
  id: options.id,
94806
95045
  scrollContainer: options == null ? void 0 : options.scrollContainer,
94807
95046
  enableResolveComments: options == null ? void 0 : options.enableResolveComments,
95047
+ enableComments,
94808
95048
  components: {
94809
95049
  blocks: [...StandardBlocks, ...(_f = (_e = options.components) == null ? void 0 : _e.blocks) != null ? _f : []],
94810
95050
  commandProviders: [new TableBlockCommandProvider()],
@@ -94812,7 +95052,7 @@ ${JSON.stringify(error2, null, 2)}`);
94812
95052
  embeds: [...StandardEmbeds, ...((_g = options.components) == null ? void 0 : _g.embeds) || []],
94813
95053
  boxes: [MathjaxBox, MentionBox, FileBox, StatusBox, ...((_h = options.components) == null ? void 0 : _h.boxes) || []],
94814
95054
  insertions: [RemoteCaretsInsertion],
94815
- blockHooks: [new BlockLockerHook(), ...((_i = options.components) == null ? void 0 : _i.blockHooks) || []],
95055
+ blockHooks: [...((_i = options.components) == null ? void 0 : _i.blockHooks) || []],
94816
95056
  textRenders: [
94817
95057
  enableComments && new OnesEditorCommentsRender(),
94818
95058
  new BlockPaddingRender(),
@@ -94845,11 +95085,14 @@ ${JSON.stringify(error2, null, 2)}`);
94845
95085
  editor.input.addHandler(new OnesEditorPasteHandler(editor));
94846
95086
  editor.input.addHandler(new BlockLockerPasteHandler());
94847
95087
  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) {
95088
+ editor.addCustom(
95089
+ "editor-image-preview",
95090
+ () => new ImagePreviewHandler(editor, (editor2, img) => {
95091
+ var _a2, _b2;
95092
+ (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
95093
+ })
95094
+ );
95095
+ if (options.blockMenuButton !== false && !clientType.isMobile) {
94853
95096
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94854
95097
  }
94855
95098
  if (!clientType.isMobile) {
@@ -94857,8 +95100,9 @@ ${JSON.stringify(error2, null, 2)}`);
94857
95100
  var _a2;
94858
95101
  return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
94859
95102
  });
94860
- editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94861
- editor.editorCommandProviders.registerCommandProvider(new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true }));
95103
+ editor.editorCommandProviders.registerCommandProvider(
95104
+ new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
95105
+ );
94862
95106
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94863
95107
  (_k = editor.findCustom("editor-quick-menu")) == null ? void 0 : _k.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
94864
95108
  (_l = editor.findCustom("editor-block-menu")) == null ? void 0 : _l.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
@@ -94876,6 +95120,16 @@ ${JSON.stringify(error2, null, 2)}`);
94876
95120
  if (options.enableContextMenu !== false) {
94877
95121
  editor.addCustom("editor-context-menu", (editor2) => new OnesEditorContextMenu(editor2));
94878
95122
  }
95123
+ editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
95124
+ editor.addCustom("drop-target", () => new OnesEditorDropTarget(editor));
95125
+ editor.addCustom("list-to-mindmap", () => new OnesEditorListMindmap(editor));
95126
+ editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
95127
+ editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
95128
+ editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
95129
+ if ((_m = options.componentsOptions) == null ? void 0 : _m.mention) {
95130
+ const mentionOptions = options.componentsOptions.mention;
95131
+ editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
95132
+ }
94879
95133
  if (options.headingButton !== false) {
94880
95134
  editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
94881
95135
  }
@@ -94896,7 +95150,10 @@ ${JSON.stringify(error2, null, 2)}`);
94896
95150
  }
94897
95151
  });
94898
95152
  OnesEditorToolbar.register(editor);
94899
- editor.version = "2.9.7";
95153
+ OnesEditorDropTarget.register(editor);
95154
+ OnesEditorTocProvider.register(editor);
95155
+ OnesEditorExclusiveBlock.register(editor);
95156
+ editor.version = "2.9.8-beta.2";
94900
95157
  return editor;
94901
95158
  }
94902
95159
  async function showDocVersions(editor, options, serverUrl) {
@@ -140689,6 +140946,7 @@ ${JSON.stringify(error2, null, 2)}`);
140689
140946
  exports2.ArrowLeftIcon = arrowLeft;
140690
140947
  exports2.ArrowRightIcon = ArrowRightIcon;
140691
140948
  exports2.ArrowUpIcon = arrowUp;
140949
+ exports2.AttachmentIcon = AttachmentIcon;
140692
140950
  exports2.AudioIcon = AudioIcon;
140693
140951
  exports2.AuthError = AuthError;
140694
140952
  exports2.AuthHeader = AuthHeader;
@@ -140822,9 +141080,11 @@ ${JSON.stringify(error2, null, 2)}`);
140822
141080
  exports2.InputtingInsertion = InputtingInsertion;
140823
141081
  exports2.InsertAfterIcon = InsertAfterIcon;
140824
141082
  exports2.InsertBeforeIcon = InsertBeforeIcon;
141083
+ exports2.InsertFileItem = InsertFileItem;
140825
141084
  exports2.InsertImageItem = InsertImageItem;
140826
141085
  exports2.InsertItem = InsertItem;
140827
141086
  exports2.InsertLinkItem = InsertLinkItem;
141087
+ exports2.InsertMentionItem = InsertMentionItem;
140828
141088
  exports2.InsertMenuProvider = InsertMenuProvider;
140829
141089
  exports2.ItalicIcon = ItalicIcon;
140830
141090
  exports2.LaunchIcon = LaunchIcon;
@@ -140855,6 +141115,7 @@ ${JSON.stringify(error2, null, 2)}`);
140855
141115
  exports2.MathIcon = mathIcon;
140856
141116
  exports2.MathMenuIcon = MathMenuIcon;
140857
141117
  exports2.MaxUserError = MaxUserError;
141118
+ exports2.Mention2Icon = Mention2Icon;
140858
141119
  exports2.MentionIcon = MentionIcon;
140859
141120
  exports2.MergeCellIcon = MergeCellIcon;
140860
141121
  exports2.Mindmap = Mindmap;