@ones-editor/editor 2.8.36 → 2.8.37-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.
@@ -3,13 +3,13 @@ import { TypedEmitter } from 'tiny-typed-emitter';
3
3
  import type { GetReferenceClientRect, Placement } from 'tippy.js';
4
4
  export { Placement };
5
5
  export interface CommandBarEvents {
6
- 'show': (bar: AbstractCommandBar) => void;
7
- 'shown': (bar: AbstractCommandBar) => void;
8
- 'click': (bar: AbstractCommandBar, item: CommandItem, elem: HTMLElement) => void;
9
- 'close': (bar: AbstractCommandBar) => void;
10
- 'selectionChange': (bar: AbstractCommandBar, id: string) => void;
11
- 'closing': (bar: AbstractCommandBar, event: MouseEvent | TouchEvent) => boolean | undefined;
12
- 'subBarShown': (bar: AbstractCommandBar, subBar: AbstractCommandBar) => void;
6
+ show: (bar: AbstractCommandBar) => void;
7
+ shown: (bar: AbstractCommandBar) => void;
8
+ click: (bar: AbstractCommandBar, item: CommandItem, elem: HTMLElement) => void;
9
+ close: (bar: AbstractCommandBar) => void;
10
+ selectionChange: (bar: AbstractCommandBar, id: string) => void;
11
+ closing: (bar: AbstractCommandBar, event: MouseEvent | TouchEvent) => boolean | undefined;
12
+ subBarShown: (bar: AbstractCommandBar, subBar: AbstractCommandBar) => void;
13
13
  }
14
14
  export interface ManualShowCommandBarOptions {
15
15
  placement?: Placement;
@@ -50,6 +50,7 @@ export type CommandBarContentElement = HTMLElement & {
50
50
  __neverUse: 'CommandBarContentElement';
51
51
  };
52
52
  export interface CommandBarOptions {
53
+ rootId?: string;
53
54
  id?: string;
54
55
  parentItem?: CommandItem;
55
56
  itemElementTag?: keyof HTMLElementTagNameMap;
@@ -127,4 +127,5 @@ import ShiftTabIcon from './shift-tab.svg?raw';
127
127
  import TableEditIcon from './table-edit.svg?raw';
128
128
  import AdjustWidthIcon from './adjust-width.svg?raw';
129
129
  import TocIcon from './toc.svg?raw';
130
- export { TableEditIcon, TabIcon, ShiftTabIcon, DownloadIcon, AddEmojiIcon, BallIcon, CardIcon, FoodIcon, LightIcon, SmileIcon, SymbolIcon, TreeIcon, TimeIcon, ClearIcon, CloseIcon, PrevIcon, NextIcon, MoreIcon, TextColorIcon, AddIcon, ArrowDownIcon, ArrowUpIcon, ArrowLeftIcon, ArrowRightIcon, DeleteRowIcon, DeleteColIcon, MergeCellIcon, SplitCellIcon, DeleteTableIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, Heading7Icon, Heading8Icon, HeadingNIcon, OrderedListIcon, UnorderedListIcon, CheckListIcon, BlockquoteIcon, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, ImageIcon, ImageMenuIcon, ImageErrorIcon, ImageEmptyIcon, LinkIcon, LinkOffIcon, WarningIcon, PasteSpecialIcon, LaunchIcon, CodeIcon, LayoutIcon, AudioIcon, GraphIcon, VideoIcon, FileIcon, MathIcon, MathMenuIcon, TableIcon, TableMenuIcon, BilibiliIcon, YoukuIcon, ModaoIcon, FigmaIcon, EditIcon, CommentIcon, RefreshIcon, HelpIcon, CheckMarkIcon, CircleCheckMarkIcon, TextIcon, RightArrowIcon, TencentVideoIcon, WebPageIcon, UmlIcon, DividingLineIcon, HeadingH1Icon, HeadingH2Icon, HeadingH3Icon, HeadingH4Icon, HeadingH5Icon, HeadingH6Icon, HeadingH7Icon, HeadingH8Icon, CheckboxIcon, QuoteIcon, LinkHrefIcon, OrderedIcon, UnorderedIcon, CopyIcon, CutIcon, DeleteIcon, LockBlockIcon, UnLockBlockIcon, InsertBeforeIcon, InsertAfterIcon, MentionIcon, CircleAddIcon, LoadingIcon, DragIcon, UmlBrandIcon, OnesLoadingIcon, BoldIcon, ItalicIcon, UnderlineIcon, LineThroughIcon, SubscriptIcon, SuperscriptIcon, InlineCodeIcon, ToMindMapIcon, FitIcon, FullScreenIcon, ExitFullScreenIcon, CaretDownIcon, StatusIcon, AlertEmojiIcon, ForbiddenIcon, WarningFilledIcon, InformationFilledIcon, SearchIcon, CalloutIcon, LoadingCircleIcon, TextGroupIcon, AdjustWidthIcon, TocIcon, };
130
+ import AttachmentIcon from './attachment.svg?raw';
131
+ export { TableEditIcon, TabIcon, ShiftTabIcon, DownloadIcon, AddEmojiIcon, BallIcon, CardIcon, FoodIcon, LightIcon, SmileIcon, SymbolIcon, TreeIcon, TimeIcon, ClearIcon, CloseIcon, PrevIcon, NextIcon, MoreIcon, TextColorIcon, AddIcon, ArrowDownIcon, ArrowUpIcon, ArrowLeftIcon, ArrowRightIcon, DeleteRowIcon, DeleteColIcon, MergeCellIcon, SplitCellIcon, DeleteTableIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, Heading7Icon, Heading8Icon, HeadingNIcon, OrderedListIcon, UnorderedListIcon, CheckListIcon, BlockquoteIcon, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, ImageIcon, ImageMenuIcon, ImageErrorIcon, ImageEmptyIcon, LinkIcon, LinkOffIcon, WarningIcon, PasteSpecialIcon, LaunchIcon, CodeIcon, LayoutIcon, AudioIcon, GraphIcon, VideoIcon, FileIcon, MathIcon, MathMenuIcon, TableIcon, TableMenuIcon, BilibiliIcon, YoukuIcon, ModaoIcon, FigmaIcon, EditIcon, CommentIcon, RefreshIcon, HelpIcon, CheckMarkIcon, CircleCheckMarkIcon, TextIcon, RightArrowIcon, TencentVideoIcon, WebPageIcon, UmlIcon, DividingLineIcon, HeadingH1Icon, HeadingH2Icon, HeadingH3Icon, HeadingH4Icon, HeadingH5Icon, HeadingH6Icon, HeadingH7Icon, HeadingH8Icon, CheckboxIcon, QuoteIcon, LinkHrefIcon, OrderedIcon, UnorderedIcon, CopyIcon, CutIcon, DeleteIcon, LockBlockIcon, UnLockBlockIcon, InsertBeforeIcon, InsertAfterIcon, MentionIcon, CircleAddIcon, LoadingIcon, DragIcon, UmlBrandIcon, OnesLoadingIcon, BoldIcon, ItalicIcon, UnderlineIcon, LineThroughIcon, SubscriptIcon, SuperscriptIcon, InlineCodeIcon, ToMindMapIcon, FitIcon, FullScreenIcon, ExitFullScreenIcon, CaretDownIcon, StatusIcon, AlertEmojiIcon, ForbiddenIcon, WarningFilledIcon, InformationFilledIcon, SearchIcon, CalloutIcon, LoadingCircleIcon, TextGroupIcon, AdjustWidthIcon, TocIcon, AttachmentIcon, };
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ export { resetListStart, getListAllNextBrothers, toMindmap, Mindmap } from '../@
42
42
  export * from '../@ones-editor/exclusive-block';
43
43
  export * from '../@ones-editor/templates';
44
44
  export * from 'tiny-typed-emitter';
45
- export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter, MobileCommandHandler, PasteSpecialHandler };
45
+ export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter, MobileCommandHandler, PasteSpecialHandler, };
46
46
  export type { FileBoxData, FileEmbedData } from '../@ones-editor/file';
47
47
  export * from './helper';
48
48
  export { OnesEditorComments, OnesEditorCommentsRender } from '../@ones-editor/comments';
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
  }
@@ -5728,10 +5728,10 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
5728
5728
  height: 24px;
5729
5729
  }
5730
5730
  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;
5731
+ min-width: 200px;
5732
5732
  }
5733
5733
  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;
5734
+ min-width: 200px;
5735
5735
  }:root {
5736
5736
  --editor-version-button-border: black;
5737
5737
  --editor-bg-color: #ffffff;
@@ -8875,6 +8875,35 @@ div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
8875
8875
  }
8876
8876
  [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
8877
  display: flex;
8878
+ }
8879
+ .editor-main-toolbar-root {
8880
+ display: flex;
8881
+ width: 100%;
8882
+ min-height: 35px;
8883
+ }
8884
+ .editor-main-toolbar-root .editor-main-toolbar-resizer {
8885
+ position: relative;
8886
+ flex-grow: 1;
8887
+ flex-shrink: 1;
8888
+ }
8889
+ .editor-main-toolbar-root .editor-main-toolbar-resizer .editor-main-toolbar-container {
8890
+ position: absolute;
8891
+ left: 0;
8892
+ right: 0;
8893
+ top: 0;
8894
+ bottom: 0;
8895
+ display: flex;
8896
+ align-items: center;
8897
+ }
8898
+ .editor-main-toolbar-root .editor-main-toolbar-resizer .editor-main-toolbar-container .editor-command-bar-root {
8899
+ overflow: hidden !important;
8900
+ }
8901
+ .editor-main-toolbar-root [data-command-bar-root-id=main-toolbar-fullscreen] {
8902
+ flex-grow: 0 !important;
8903
+ flex-shrink: 0 !important;
8904
+ display: flex;
8905
+ align-items: center;
8906
+ justify-content: center;
8878
8907
  }`)),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
8879
8908
  var __defProp = Object.defineProperty;
8880
8909
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -41003,6 +41032,7 @@ ${codeText}
41003
41032
  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';
41004
41033
  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';
41005
41034
  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';
41035
+ 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';
41006
41036
  const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41007
41037
  __proto__: null,
41008
41038
  TableEditIcon,
@@ -41133,7 +41163,8 @@ ${codeText}
41133
41163
  LoadingCircleIcon,
41134
41164
  TextGroupIcon,
41135
41165
  AdjustWidthIcon,
41136
- TocIcon
41166
+ TocIcon,
41167
+ AttachmentIcon
41137
41168
  }, Symbol.toStringTag, { value: "Module" }));
41138
41169
  function createLoading() {
41139
41170
  const loading2 = createElement("span", ["editor-loading-icon"], null);
@@ -41754,6 +41785,9 @@ ${codeText}
41754
41785
  }
41755
41786
  const content = createElement("div", ["editor-command-bar-root"], null);
41756
41787
  content.setAttribute("data-keep-editor-focus", "");
41788
+ if (this.options.rootId) {
41789
+ content.setAttribute("data-command-bar-root-id", this.options.rootId);
41790
+ }
41757
41791
  if (this.options.header) {
41758
41792
  const headerElem = createElement("div", ["editor-command-bar-header"], null);
41759
41793
  if (this.options.header instanceof Function) {
@@ -54814,7 +54848,7 @@ ${codeText}
54814
54848
  const svg = await mathjax2Svg(editor, tex);
54815
54849
  const data2 = svg;
54816
54850
  const file2 = new File([data2], "math.svg");
54817
- const path = await editor.doc.uploadResource(file2);
54851
+ const path = await editor.doc.uploadResource(file2, { resourceType: "graph" });
54818
54852
  return path.resourceId;
54819
54853
  }
54820
54854
  async function convertAndUploadMathjaxForEmbed(editor, tex) {
@@ -54822,7 +54856,7 @@ ${codeText}
54822
54856
  const perfectState = analyzeMathjaxSvgWidth(svg);
54823
54857
  const data2 = svg;
54824
54858
  const file2 = new File([data2], "math.svg");
54825
- const path = await editor.doc.uploadResource(file2);
54859
+ const path = await editor.doc.uploadResource(file2, { resourceType: "graph" });
54826
54860
  return {
54827
54861
  resourceId: path.resourceId,
54828
54862
  ...perfectState
@@ -64826,7 +64860,8 @@ $$${mathData.mathjaxText}$$
64826
64860
  const res = await this.editor.doc.uploadResource(file2, {
64827
64861
  onProgress: (progress) => {
64828
64862
  setImageUploading(imageContainer, progress);
64829
- }
64863
+ },
64864
+ resourceType: "image"
64830
64865
  });
64831
64866
  removeClass(imageContainer, "uploading");
64832
64867
  this.images[index2].src = res.resourceId;
@@ -68803,7 +68838,7 @@ ${codeText}
68803
68838
  }
68804
68839
  const fileName = `image.${ext}`;
68805
68840
  const file2 = new File([blob], fileName, { type: mimeString });
68806
- const ret = await editor.doc.uploadResource(file2);
68841
+ const ret = await editor.doc.uploadResource(file2, { resourceType: "paste" });
68807
68842
  return ret.resourceId;
68808
68843
  }
68809
68844
  return src;
@@ -85902,7 +85937,7 @@ ${docStr}
85902
85937
  const file2 = new File([buffer], `${genId()}.svg`, {
85903
85938
  type: "image/svg+xml"
85904
85939
  });
85905
- const ret = await editor.doc.uploadResource(file2);
85940
+ const ret = await editor.doc.uploadResource(file2, { resourceType: "graph" });
85906
85941
  return ret.resourceId;
85907
85942
  }
85908
85943
  const _MermaidInstance = class extends GraphBase {
@@ -86140,7 +86175,7 @@ ${data2.mermaidText}
86140
86175
  const file2 = new File([buffer], `${genId()}.svg`, {
86141
86176
  type: "image/svg+xml"
86142
86177
  });
86143
- const resource = await editor.doc.uploadResource(file2);
86178
+ const resource = await editor.doc.uploadResource(file2, { resourceType: "graph" });
86144
86179
  return resource.resourceId;
86145
86180
  }
86146
86181
  const _FlowChartInstance = class extends GraphBase {
@@ -86595,7 +86630,7 @@ ${data2.flowchartText}
86595
86630
  });
86596
86631
  const targetBlock = editor.findBlockById(getBlockId(block));
86597
86632
  if (targetBlock) {
86598
- const res = await editor.doc.uploadResource(file2);
86633
+ const res = await editor.doc.uploadResource(file2, { resourceType: "graph" });
86599
86634
  const { resourceId } = res;
86600
86635
  const oldData = editor.getBlockData(targetBlock);
86601
86636
  const oldEmbedData = oldData.embedData;
@@ -86647,31 +86682,40 @@ ${data2.flowchartText}
86647
86682
  const xml = drawIoData.xmlSvg || drawIoData.xml || "";
86648
86683
  switch (msg.event) {
86649
86684
  case "configure":
86650
- iframe.contentWindow.postMessage(JSON.stringify({
86651
- action: "configure",
86652
- config: {
86653
- defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
86654
- }
86655
- }), "*");
86685
+ iframe.contentWindow.postMessage(
86686
+ JSON.stringify({
86687
+ action: "configure",
86688
+ config: {
86689
+ defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
86690
+ }
86691
+ }),
86692
+ "*"
86693
+ );
86656
86694
  break;
86657
86695
  case "init":
86658
- iframe.contentWindow.postMessage(JSON.stringify({
86659
- action: "load",
86660
- saveAndExit: 1,
86661
- noSaveBtn: 1,
86662
- noExitBtn: 0,
86663
- xml
86664
- }), "*");
86696
+ iframe.contentWindow.postMessage(
86697
+ JSON.stringify({
86698
+ action: "load",
86699
+ saveAndExit: 1,
86700
+ noSaveBtn: 1,
86701
+ noExitBtn: 0,
86702
+ xml
86703
+ }),
86704
+ "*"
86705
+ );
86665
86706
  loaded();
86666
86707
  loadingHandler.removeLoading();
86667
86708
  break;
86668
86709
  case "save":
86669
86710
  exportFlag = "save";
86670
- iframe.contentWindow.postMessage(JSON.stringify({
86671
- action: "export",
86672
- format: "xmlsvg",
86673
- spin: "Saving graph"
86674
- }), "*");
86711
+ iframe.contentWindow.postMessage(
86712
+ JSON.stringify({
86713
+ action: "export",
86714
+ format: "xmlsvg",
86715
+ spin: "Saving graph"
86716
+ }),
86717
+ "*"
86718
+ );
86675
86719
  break;
86676
86720
  case "export":
86677
86721
  if (exportFlag !== "auto") {
@@ -86697,12 +86741,15 @@ ${data2.flowchartText}
86697
86741
  allowRetry: true,
86698
86742
  onOk: () => {
86699
86743
  setTimeout(() => {
86700
- drawioIframeWindow.postMessage(JSON.stringify({
86701
- action: "export",
86702
- format: "xmlsvg",
86703
- spin: i18n$1.t("drawio.save"),
86704
- autoSave: exportFlag
86705
- }), "*");
86744
+ drawioIframeWindow.postMessage(
86745
+ JSON.stringify({
86746
+ action: "export",
86747
+ format: "xmlsvg",
86748
+ spin: i18n$1.t("drawio.save"),
86749
+ autoSave: exportFlag
86750
+ }),
86751
+ "*"
86752
+ );
86706
86753
  }, 1e3);
86707
86754
  },
86708
86755
  onClose: () => {
@@ -86768,12 +86815,15 @@ ${data2.flowchartText}
86768
86815
  if (!drawioIframe || !drawioIframe.contentWindow) {
86769
86816
  return;
86770
86817
  }
86771
- drawioIframe.contentWindow.postMessage(JSON.stringify({
86772
- action: "export",
86773
- format: "xmlsvg",
86774
- spin: "Saving graph",
86775
- autoSave: true
86776
- }), "*");
86818
+ drawioIframe.contentWindow.postMessage(
86819
+ JSON.stringify({
86820
+ action: "export",
86821
+ format: "xmlsvg",
86822
+ spin: "Saving graph",
86823
+ autoSave: true
86824
+ }),
86825
+ "*"
86826
+ );
86777
86827
  }, SAVE_DELAY_TIME);
86778
86828
  };
86779
86829
  const exit = () => {
@@ -86913,10 +86963,12 @@ ${data2.flowchartText}
86913
86963
  }
86914
86964
  function updateGraphByXml(mxFile, embed, editor) {
86915
86965
  assert(logger$i, editor, "parameter missing");
86916
- initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
86917
- checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
86918
- maxRetryTime: 5e3
86919
- })).then(() => {
86966
+ initDrawIo(editor).then(
86967
+ () => loopCheckResourceWasLoaded({
86968
+ checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
86969
+ maxRetryTime: 5e3
86970
+ })
86971
+ ).then(() => {
86920
86972
  const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec, Graph } = window;
86921
86973
  assert(logger$i, mxUtils, "External resource loading exception: mxUtils");
86922
86974
  assert(logger$i, MxGraph, "External resource loading exception: MxGraph");
@@ -86936,7 +86988,10 @@ ${data2.flowchartText}
86936
86988
  const raw = atob(diagramBase64);
86937
86989
  const pako = window.pako;
86938
86990
  assert(logger$i, pako, "External resource loading exception: pako");
86939
- const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
86991
+ const encodedXml = pako.inflateRaw(
86992
+ Uint8Array.from(raw, (c) => c.charCodeAt(0)),
86993
+ { to: "string" }
86994
+ );
86940
86995
  const xml = decodeURIComponent(encodedXml);
86941
86996
  xmlDoc = mxUtils.parseXml(xml);
86942
86997
  } else {
@@ -87270,7 +87325,7 @@ ${data2.flowchartText}
87270
87325
  if (!plantumlImgFile) {
87271
87326
  return await Promise.resolve(url);
87272
87327
  }
87273
- const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile);
87328
+ const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile, { resourceType: "graph" });
87274
87329
  return uploadResourceResult.resourceId;
87275
87330
  } catch (error2) {
87276
87331
  return Promise.resolve(url);
@@ -90805,7 +90860,8 @@ ${data2.plantumlText}
90805
90860
  const { resourceId } = await editor.doc.uploadResource(file2, {
90806
90861
  onProgress: (progress) => {
90807
90862
  this.renderProgress(progress, file2);
90808
- }
90863
+ },
90864
+ resourceType: "media"
90809
90865
  });
90810
90866
  const { name, type, size } = file2;
90811
90867
  const newBlockData = {
@@ -90943,7 +90999,11 @@ ${data2.plantumlText}
90943
90999
  renderEmpty(blockData) {
90944
91000
  assert(logger$9, this.abstract, "no abstract");
90945
91001
  assert(logger$9, this.mediaContainer, "The media element not exist");
90946
- const empty = createElement("div", ["media-empty", "embed-selected-content", "embed-hover-content"], this.mediaContainer);
91002
+ const empty = createElement(
91003
+ "div",
91004
+ ["media-empty", "embed-selected-content", "embed-hover-content"],
91005
+ this.mediaContainer
91006
+ );
90947
91007
  empty.innerHTML = this.abstract.mediaIcon;
90948
91008
  this.updateMediaContent(empty);
90949
91009
  const { editor } = this.options;
@@ -90964,7 +91024,7 @@ ${data2.plantumlText}
90964
91024
  }
90965
91025
  await editor.doc.addResources([resourceId]);
90966
91026
  const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
90967
- if (resourceUrl !== blockData.embedData.src && (serviceAppId && blockData.embedData.src.includes(serviceAppId))) {
91027
+ if (resourceUrl !== blockData.embedData.src && serviceAppId && blockData.embedData.src.includes(serviceAppId)) {
90968
91028
  const block = getParentBlock(content);
90969
91029
  if (block && !editor.readonly && editor.isBlockWritable(block)) {
90970
91030
  const newBlockData = cloneDeep__default.default(blockData);
@@ -94101,11 +94161,11 @@ ${JSON.stringify(error2, null, 2)}`);
94101
94161
  this.fixedToolbar = (_a = editor.findCustom("main-toolbar-fixed-toolbar")) == null ? void 0 : _a.toolbar;
94102
94162
  if (this.fixedToolbar) {
94103
94163
  const content = this.fixedToolbar.content;
94104
- const toolbar2 = content.closest(".editor-command-bar-root");
94164
+ const resizer = content.closest(".editor-main-toolbar-resizer");
94105
94165
  this.observer = new ResizeObserver(() => {
94106
94166
  this.updateItems();
94107
94167
  });
94108
- this.observer.observe(toolbar2);
94168
+ this.observer.observe(resizer);
94109
94169
  editor.addCustom("main-toolbar-more-item", () => this);
94110
94170
  }
94111
94171
  });
@@ -94132,7 +94192,7 @@ ${JSON.stringify(error2, null, 2)}`);
94132
94192
  return;
94133
94193
  }
94134
94194
  const content = toolbar2.content;
94135
- const toolbarRoot = content.closest(".editor-command-bar-root");
94195
+ const toolbarRoot = content.closest(".editor-main-toolbar-resizer");
94136
94196
  const toolbarRect = toolbarRoot.getBoundingClientRect();
94137
94197
  const toolbarRight = toolbarRect.right;
94138
94198
  items.forEach((item) => {
@@ -94197,8 +94257,39 @@ ${JSON.stringify(error2, null, 2)}`);
94197
94257
  toolbar2.updateItems(items);
94198
94258
  }
94199
94259
  }
94260
+ class InsertFileItem {
94261
+ constructor() {
94262
+ __publicField(this, "id", "insert-file");
94263
+ __publicField(this, "name", i18n$1.t("toolbar.file"));
94264
+ __publicField(this, "icon", AttachmentIcon);
94265
+ }
94266
+ async onClick(editor, item) {
94267
+ const block = editor.getBlockById(editor.selection.range.start.blockId);
94268
+ const container = editor.getParentContainer(block);
94269
+ const index2 = editor.getBlockIndex(block);
94270
+ const file2 = await selectFile("*");
94271
+ if (!file2) {
94272
+ return;
94273
+ }
94274
+ const res = await editor.doc.uploadResource(file2);
94275
+ if (!res.resourceId) {
94276
+ return;
94277
+ }
94278
+ const data2 = {
94279
+ src: res.resourceId,
94280
+ fileName: file2.name,
94281
+ fileSize: file2.size,
94282
+ fileType: file2.type,
94283
+ created: Date.now(),
94284
+ creator: editor.doc.getUser().displayName,
94285
+ previewType: FilePreviewType.Card
94286
+ };
94287
+ editor.insertEmbed(getContainerId(container), index2 + 1, "office", data2);
94288
+ }
94289
+ }
94200
94290
  function getToolbarDefaultItems(editor) {
94201
- return [
94291
+ const commentsEnabled = !!editor.options.enableComments;
94292
+ const items = [
94202
94293
  new UndoItem(),
94203
94294
  new RedoItem(),
94204
94295
  new SeparatorItem(),
@@ -94223,14 +94314,15 @@ ${JSON.stringify(error2, null, 2)}`);
94223
94314
  new AlignCenterItem(),
94224
94315
  new AlignRightItem(),
94225
94316
  new SeparatorItem(),
94226
- new InsertImageItem(),
94227
- new SeparatorItem(),
94228
94317
  new InsertItem(editor),
94229
94318
  new SeparatorItem(),
94230
- new FindReplaceItem(),
94231
- new CommentItem(),
94232
- new MoreItem(editor)
94319
+ new FindReplaceItem()
94233
94320
  ];
94321
+ if (commentsEnabled) {
94322
+ items.push(new CommentItem());
94323
+ }
94324
+ items.push(new MoreItem(editor));
94325
+ return items;
94234
94326
  }
94235
94327
  const zhCN = {
94236
94328
  toolbar: {
@@ -94296,8 +94388,9 @@ ${JSON.stringify(error2, null, 2)}`);
94296
94388
  });
94297
94389
  const style = "";
94298
94390
  class MainToolbar {
94299
- constructor(editor, parent) {
94391
+ constructor(editor, parent, options = {}) {
94300
94392
  __publicField(this, "toolbar");
94393
+ __publicField(this, "toolbarFullScreen");
94301
94394
  __publicField(this, "handleClick", (bar2, item) => {
94302
94395
  const command = item;
94303
94396
  if (command.onClick) {
@@ -94334,7 +94427,12 @@ ${JSON.stringify(error2, null, 2)}`);
94334
94427
  this.updateState();
94335
94428
  });
94336
94429
  this.editor = editor;
94337
- this.toolbar = new FixedToolbar(parent, this.getItems(), {
94430
+ this.options = options;
94431
+ const root2 = createElement("div", ["editor-main-toolbar-root"], parent);
94432
+ const container = createElement("div", ["editor-main-toolbar-resizer"], root2);
94433
+ const resizer = createElement("div", ["editor-main-toolbar-container"], container);
94434
+ const items = getToolbarDefaultItems(editor);
94435
+ this.toolbar = new FixedToolbar(resizer, items, {
94338
94436
  tooltipId: editor.clientId,
94339
94437
  id: "main-toolbar"
94340
94438
  });
@@ -94346,16 +94444,38 @@ ${JSON.stringify(error2, null, 2)}`);
94346
94444
  destroy: () => {
94347
94445
  }
94348
94446
  }));
94447
+ if (options.enableFullScreen) {
94448
+ const fullScreenItem = {
94449
+ id: "main-toolbar-fullscreen",
94450
+ icon: FullScreenIcon,
94451
+ name: i18n$1.t("toolbar.fullscreen")
94452
+ };
94453
+ this.toolbarFullScreen = new FixedToolbar(root2, [fullScreenItem], {
94454
+ tooltipId: editor.clientId,
94455
+ id: "main-toolbar-fullscreen",
94456
+ rootId: "main-toolbar-fullscreen"
94457
+ });
94458
+ this.toolbarFullScreen.addListener("click", (bar2, item) => {
94459
+ var _a;
94460
+ if (item.id === "main-toolbar-fullscreen") {
94461
+ (_a = options.onFullScreenClick) == null ? void 0 : _a.call(options, this.editor, item);
94462
+ this.handleSelectionChanged();
94463
+ }
94464
+ });
94465
+ }
94349
94466
  }
94350
94467
  destroy() {
94468
+ var _a;
94351
94469
  this.toolbar.destroy();
94470
+ this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
94471
+ (_a = this.toolbarFullScreen) == null ? void 0 : _a.destroy();
94352
94472
  }
94353
94473
  setItems(items) {
94354
94474
  this.toolbar.updateItems(items);
94355
94475
  this.updateState();
94356
94476
  }
94357
94477
  getItems() {
94358
- return getToolbarDefaultItems(this.editor);
94478
+ return this.toolbar.items;
94359
94479
  }
94360
94480
  updateState() {
94361
94481
  const items = this.toolbar.items;
@@ -94435,15 +94555,7 @@ ${JSON.stringify(error2, null, 2)}`);
94435
94555
  TextColorShortcuts,
94436
94556
  ...options.shortcuts || []
94437
94557
  ],
94438
- colors: [
94439
- "#B21B57",
94440
- "#008796",
94441
- "#7241CC",
94442
- "#CC4C08",
94443
- "#5D8F00",
94444
- "#BD2C1C",
94445
- "#D17D00"
94446
- ]
94558
+ colors: ["#B21B57", "#008796", "#7241CC", "#CC4C08", "#5D8F00", "#BD2C1C", "#D17D00"]
94447
94559
  };
94448
94560
  return ret;
94449
94561
  }
@@ -94541,10 +94653,13 @@ ${JSON.stringify(error2, null, 2)}`);
94541
94653
  editor.input.addHandler(new ListPasteHandler());
94542
94654
  editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
94543
94655
  editor.addCustom("remote-cursor", () => new RemoteCarets(editor));
94544
- editor.addCustom("editor-image-preview", () => new ImagePreviewHandler(editor, (editor2, img) => {
94545
- var _a2, _b2;
94546
- (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94547
- }));
94656
+ editor.addCustom(
94657
+ "editor-image-preview",
94658
+ () => new ImagePreviewHandler(editor, (editor2, img) => {
94659
+ var _a2, _b2;
94660
+ (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94661
+ })
94662
+ );
94548
94663
  if (options.blockMenuButton !== false) {
94549
94664
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94550
94665
  }
@@ -94594,7 +94709,9 @@ ${JSON.stringify(error2, null, 2)}`);
94594
94709
  OnesEditorTocProvider.register(editor);
94595
94710
  OnesEditorExclusiveBlock.register(editor);
94596
94711
  if (!clientType.isMobile) {
94597
- editor.editorCommandProviders.registerCommandProvider(new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true }));
94712
+ editor.editorCommandProviders.registerCommandProvider(
94713
+ new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
94714
+ );
94598
94715
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94599
94716
  } else {
94600
94717
  editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
@@ -94641,14 +94758,14 @@ ${JSON.stringify(error2, null, 2)}`);
94641
94758
  }
94642
94759
  }
94643
94760
  });
94644
- editor.version = "2.8.36";
94761
+ editor.version = "2.8.37-beta.10";
94645
94762
  return editor;
94646
94763
  }
94647
94764
  function isDoc(doc2) {
94648
94765
  return doc2.toJSON !== void 0;
94649
94766
  }
94650
94767
  async function createLocalEditor(root2, docData, options) {
94651
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
94768
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
94652
94769
  assert(logger, root2, "app does not exists");
94653
94770
  const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
94654
94771
  serverUrl: options.serverUrl || ""
@@ -94664,6 +94781,7 @@ ${JSON.stringify(error2, null, 2)}`);
94664
94781
  id: options.id,
94665
94782
  scrollContainer: options == null ? void 0 : options.scrollContainer,
94666
94783
  enableResolveComments: options == null ? void 0 : options.enableResolveComments,
94784
+ enableComments,
94667
94785
  components: {
94668
94786
  blocks: [...StandardBlocks, ...(_f = (_e = options.components) == null ? void 0 : _e.blocks) != null ? _f : []],
94669
94787
  commandProviders: [new TableBlockCommandProvider()],
@@ -94704,10 +94822,13 @@ ${JSON.stringify(error2, null, 2)}`);
94704
94822
  editor.input.addHandler(new OnesEditorPasteHandler(editor));
94705
94823
  editor.input.addHandler(new BlockLockerPasteHandler());
94706
94824
  editor.input.addHandler(new ListPasteHandler());
94707
- editor.addCustom("editor-image-preview", () => new ImagePreviewHandler(editor, (editor2, img) => {
94708
- var _a2, _b2;
94709
- (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94710
- }));
94825
+ editor.addCustom(
94826
+ "editor-image-preview",
94827
+ () => new ImagePreviewHandler(editor, (editor2, img) => {
94828
+ var _a2, _b2;
94829
+ (_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
94830
+ })
94831
+ );
94711
94832
  if (options.blockMenuButton !== false) {
94712
94833
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94713
94834
  }
@@ -94717,7 +94838,9 @@ ${JSON.stringify(error2, null, 2)}`);
94717
94838
  return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
94718
94839
  });
94719
94840
  editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
94720
- editor.editorCommandProviders.registerCommandProvider(new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true }));
94841
+ editor.editorCommandProviders.registerCommandProvider(
94842
+ new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
94843
+ );
94721
94844
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
94722
94845
  (_k = editor.findCustom("editor-quick-menu")) == null ? void 0 : _k.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
94723
94846
  (_l = editor.findCustom("editor-block-menu")) == null ? void 0 : _l.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
@@ -94735,6 +94858,16 @@ ${JSON.stringify(error2, null, 2)}`);
94735
94858
  if (options.enableContextMenu !== false) {
94736
94859
  editor.addCustom("editor-context-menu", (editor2) => new OnesEditorContextMenu(editor2));
94737
94860
  }
94861
+ editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
94862
+ editor.addCustom("drop-target", () => new OnesEditorDropTarget(editor));
94863
+ editor.addCustom("list-to-mindmap", () => new OnesEditorListMindmap(editor));
94864
+ editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
94865
+ editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
94866
+ editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
94867
+ if ((_m = options.componentsOptions) == null ? void 0 : _m.mention) {
94868
+ const mentionOptions = options.componentsOptions.mention;
94869
+ editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
94870
+ }
94738
94871
  if (options.headingButton !== false) {
94739
94872
  editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
94740
94873
  }
@@ -94755,7 +94888,10 @@ ${JSON.stringify(error2, null, 2)}`);
94755
94888
  }
94756
94889
  });
94757
94890
  OnesEditorToolbar.register(editor);
94758
- editor.version = "2.8.36";
94891
+ OnesEditorDropTarget.register(editor);
94892
+ OnesEditorTocProvider.register(editor);
94893
+ OnesEditorExclusiveBlock.register(editor);
94894
+ editor.version = "2.8.37-beta.10";
94759
94895
  return editor;
94760
94896
  }
94761
94897
  async function showDocVersions(editor, options, serverUrl) {
@@ -140548,6 +140684,7 @@ ${JSON.stringify(error2, null, 2)}`);
140548
140684
  exports2.ArrowLeftIcon = arrowLeft;
140549
140685
  exports2.ArrowRightIcon = ArrowRightIcon;
140550
140686
  exports2.ArrowUpIcon = arrowUp;
140687
+ exports2.AttachmentIcon = AttachmentIcon;
140551
140688
  exports2.AudioIcon = AudioIcon;
140552
140689
  exports2.AuthError = AuthError;
140553
140690
  exports2.AuthHeader = AuthHeader;
@@ -140681,6 +140818,7 @@ ${JSON.stringify(error2, null, 2)}`);
140681
140818
  exports2.InputtingInsertion = InputtingInsertion;
140682
140819
  exports2.InsertAfterIcon = InsertAfterIcon;
140683
140820
  exports2.InsertBeforeIcon = InsertBeforeIcon;
140821
+ exports2.InsertFileItem = InsertFileItem;
140684
140822
  exports2.InsertImageItem = InsertImageItem;
140685
140823
  exports2.InsertItem = InsertItem;
140686
140824
  exports2.InsertLinkItem = InsertLinkItem;