@ones-editor/editor 2.1.1-beta.34 → 2.1.1-beta.35

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
@@ -29685,7 +29685,7 @@ ${codeText}
29685
29685
  });
29686
29686
  return allCommands;
29687
29687
  }
29688
- const SEP$1 = {
29688
+ const SEP$2 = {
29689
29689
  id: "",
29690
29690
  name: "",
29691
29691
  type: "separator"
@@ -29710,7 +29710,7 @@ ${codeText}
29710
29710
  if (commandsChunk.length === 0) {
29711
29711
  return [];
29712
29712
  }
29713
- const commands = commandsChunk.reduce((prev, curr) => prev.concat([SEP$1, ...curr]), []);
29713
+ const commands = commandsChunk.reduce((prev, curr) => prev.concat([SEP$2, ...curr]), []);
29714
29714
  commands.shift();
29715
29715
  return commands;
29716
29716
  };
@@ -45762,6 +45762,48 @@ ${codeText}
45762
45762
  return rects[0];
45763
45763
  }
45764
45764
  const logger$22 = getLogger("object-commands");
45765
+ const SEP$1 = {
45766
+ id: "",
45767
+ name: "",
45768
+ type: "separator"
45769
+ };
45770
+ const groupCommands = (allCommands) => {
45771
+ var _a, _b;
45772
+ const allCommandsMap = /* @__PURE__ */ new Map();
45773
+ for (let i = 0; i < allCommands.length; i++) {
45774
+ const groupOrder = (_a = allCommands[i].groupOrder) != null ? _a : 0;
45775
+ if (allCommandsMap.has(groupOrder)) {
45776
+ (_b = allCommandsMap.get(groupOrder)) == null ? void 0 : _b.push(allCommands[i]);
45777
+ } else {
45778
+ allCommandsMap.set(groupOrder, [allCommands[i]]);
45779
+ }
45780
+ }
45781
+ const commandsChunk = [];
45782
+ allCommandsMap.forEach((value) => {
45783
+ commandsChunk.push(value.sort((item1, item2) => {
45784
+ var _a2, _b2;
45785
+ return ((_a2 = item1.order) != null ? _a2 : 0) - ((_b2 = item2.order) != null ? _b2 : 0);
45786
+ }));
45787
+ });
45788
+ if (commandsChunk.length === 0) {
45789
+ return [];
45790
+ }
45791
+ const commands = commandsChunk.reduce((prev, curr) => prev.concat([SEP$1, ...curr]), []);
45792
+ commands.shift();
45793
+ let start = 0;
45794
+ return commands.filter((item, index2) => {
45795
+ if (item.type === "separator") {
45796
+ if (index2 === 0 || index2 === commands.length - 1) {
45797
+ return false;
45798
+ }
45799
+ if (index2 - start === 1) {
45800
+ return false;
45801
+ }
45802
+ start = index2;
45803
+ }
45804
+ return true;
45805
+ });
45806
+ };
45765
45807
  function getObjectCommands(editor, block, child) {
45766
45808
  const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
45767
45809
  const { element: targetElement, boxCommands, blockCommands } = result;
@@ -45793,7 +45835,7 @@ ${codeText}
45793
45835
  element = element || block;
45794
45836
  return {
45795
45837
  element,
45796
- commands
45838
+ commands: groupCommands(commands)
45797
45839
  };
45798
45840
  }
45799
45841
  function executeObjectCommand(editor, block, child, item) {
@@ -64396,7 +64438,9 @@ ${codeText}
64396
64438
  }, {
64397
64439
  id: "add-comment",
64398
64440
  name: i18n$1.t("embedProperties.addComment"),
64399
- icon: CommentIcon$1
64441
+ icon: CommentIcon$1,
64442
+ groupOrder: 1e3,
64443
+ order: 100
64400
64444
  }, {
64401
64445
  id: "separator",
64402
64446
  name: "",
@@ -73718,7 +73762,9 @@ ${codeText}
73718
73762
  {
73719
73763
  id: "add-comment",
73720
73764
  name: i18n$1.t("file.commands.comment"),
73721
- icon: CommentIcon$1
73765
+ icon: CommentIcon$1,
73766
+ groupOrder: 1e3,
73767
+ order: 100
73722
73768
  },
73723
73769
  {
73724
73770
  id: "sep",
@@ -74040,7 +74086,9 @@ ${codeText}
74040
74086
  }, {
74041
74087
  id: "add-comment",
74042
74088
  name: i18n$1.t("file.commands.comment"),
74043
- icon: CommentIcon$1
74089
+ icon: CommentIcon$1,
74090
+ groupOrder: 1e3,
74091
+ order: 100
74044
74092
  }, {
74045
74093
  id: "sep",
74046
74094
  name: "",
@@ -84980,7 +85028,7 @@ ${data2.flowchartText}
84980
85028
  }
84981
85029
  }
84982
85030
  });
84983
- editor.version = "2.1.1-beta.34";
85031
+ editor.version = "2.1.1-beta.35";
84984
85032
  if (Logger$2.level === LogLevel.DEBUG) {
84985
85033
  window.setReauthFail = (fail) => {
84986
85034
  window.isReauthError = fail;
@@ -85079,7 +85127,7 @@ ${data2.flowchartText}
85079
85127
  });
85080
85128
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
85081
85129
  OnesEditorToolbar.register(editor);
85082
- editor.version = "2.1.1-beta.34";
85130
+ editor.version = "2.1.1-beta.35";
85083
85131
  return editor;
85084
85132
  }
85085
85133
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.1-beta.34",
3
+ "version": "2.1.1-beta.35",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",