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

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: "",
@@ -64566,7 +64610,9 @@ ${codeText}
64566
64610
  {
64567
64611
  id: "addComment",
64568
64612
  name: i18n$1.t("comment.quickMenuCommand"),
64569
- icon: CommentIcon$1
64613
+ icon: CommentIcon$1,
64614
+ groupOrder: 1e3,
64615
+ order: 100
64570
64616
  }
64571
64617
  ]);
64572
64618
  __publicField(this, "isHoveringImageEmpty", () => {
@@ -73718,7 +73764,9 @@ ${codeText}
73718
73764
  {
73719
73765
  id: "add-comment",
73720
73766
  name: i18n$1.t("file.commands.comment"),
73721
- icon: CommentIcon$1
73767
+ icon: CommentIcon$1,
73768
+ groupOrder: 1e3,
73769
+ order: 100
73722
73770
  },
73723
73771
  {
73724
73772
  id: "sep",
@@ -74040,7 +74088,9 @@ ${codeText}
74040
74088
  }, {
74041
74089
  id: "add-comment",
74042
74090
  name: i18n$1.t("file.commands.comment"),
74043
- icon: CommentIcon$1
74091
+ icon: CommentIcon$1,
74092
+ groupOrder: 1e3,
74093
+ order: 100
74044
74094
  }, {
74045
74095
  id: "sep",
74046
74096
  name: "",
@@ -82942,7 +82992,9 @@ ${data2.flowchartText}
82942
82992
  {
82943
82993
  id: "addComment",
82944
82994
  name: i18n$1.t("comment.quickMenuCommand"),
82945
- icon: CommentIcon$1
82995
+ icon: CommentIcon$1,
82996
+ groupOrder: 1e3,
82997
+ order: 100
82946
82998
  },
82947
82999
  {
82948
83000
  id: "sep",
@@ -84980,7 +85032,7 @@ ${data2.flowchartText}
84980
85032
  }
84981
85033
  }
84982
85034
  });
84983
- editor.version = "2.1.1-beta.34";
85035
+ editor.version = "2.1.1-beta.36";
84984
85036
  if (Logger$2.level === LogLevel.DEBUG) {
84985
85037
  window.setReauthFail = (fail) => {
84986
85038
  window.isReauthError = fail;
@@ -85079,7 +85131,7 @@ ${data2.flowchartText}
85079
85131
  });
85080
85132
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
85081
85133
  OnesEditorToolbar.register(editor);
85082
- editor.version = "2.1.1-beta.34";
85134
+ editor.version = "2.1.1-beta.36";
85083
85135
  return editor;
85084
85136
  }
85085
85137
  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.36",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",