@ones-editor/editor 2.1.1-beta.3 → 2.1.1-beta.5
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.
|
@@ -24,6 +24,7 @@ export declare class ReadonlyToolbar implements OnesEditorCustom {
|
|
|
24
24
|
handleDocumentMouseUp: () => void;
|
|
25
25
|
handleSelectionChange: import("lodash").DebouncedFunc<(editor: OnesEditor) => void>;
|
|
26
26
|
private handleHoveringBlockChildChange;
|
|
27
|
+
groupCommands: (allCommands: CommandItem[]) => CommandItem[];
|
|
27
28
|
showTextToolbar(reason: string): void;
|
|
28
29
|
showObjectToolbar(event: MouseEvent | null): void;
|
|
29
30
|
}
|
package/dist/index.js
CHANGED
|
@@ -48224,7 +48224,7 @@ ${codeText}
|
|
|
48224
48224
|
}
|
|
48225
48225
|
}
|
|
48226
48226
|
const logger$1S = getLogger("toolbar-handler");
|
|
48227
|
-
const SEP = {
|
|
48227
|
+
const SEP$1 = {
|
|
48228
48228
|
id: "",
|
|
48229
48229
|
name: "",
|
|
48230
48230
|
type: "separator"
|
|
@@ -48499,7 +48499,7 @@ ${codeText}
|
|
|
48499
48499
|
});
|
|
48500
48500
|
toolbarCommands.push(...sortCommands);
|
|
48501
48501
|
if (index2 !== toolbarCommandsChunk.length - 1) {
|
|
48502
|
-
toolbarCommands.push(SEP);
|
|
48502
|
+
toolbarCommands.push(SEP$1);
|
|
48503
48503
|
}
|
|
48504
48504
|
});
|
|
48505
48505
|
if (toolbarCommands.length === 0) {
|
|
@@ -56151,6 +56151,11 @@ $$${mathData.mathjaxText}$$
|
|
|
56151
56151
|
"ja-JP": jaJP$s
|
|
56152
56152
|
});
|
|
56153
56153
|
const logger$1K = getLogger("readonly-toolbar");
|
|
56154
|
+
const SEP = {
|
|
56155
|
+
id: "",
|
|
56156
|
+
name: "",
|
|
56157
|
+
type: "separator"
|
|
56158
|
+
};
|
|
56154
56159
|
class ReadonlyToolbar {
|
|
56155
56160
|
constructor(editor) {
|
|
56156
56161
|
__publicField(this, "toolbar");
|
|
@@ -56248,6 +56253,31 @@ $$${mathData.mathjaxText}$$
|
|
|
56248
56253
|
}
|
|
56249
56254
|
this.showObjectToolbar(event);
|
|
56250
56255
|
});
|
|
56256
|
+
__publicField(this, "groupCommands", (allCommands) => {
|
|
56257
|
+
var _a, _b;
|
|
56258
|
+
const allCommandsMap = /* @__PURE__ */ new Map();
|
|
56259
|
+
for (let i = 0; i < allCommands.length; i++) {
|
|
56260
|
+
const groupOrder = (_a = allCommands[i].groupOrder) != null ? _a : 0;
|
|
56261
|
+
if (allCommandsMap.has(groupOrder)) {
|
|
56262
|
+
(_b = allCommandsMap.get(groupOrder)) == null ? void 0 : _b.push(allCommands[i]);
|
|
56263
|
+
} else {
|
|
56264
|
+
allCommandsMap.set(groupOrder, [allCommands[i]]);
|
|
56265
|
+
}
|
|
56266
|
+
}
|
|
56267
|
+
const commandsChunk = [];
|
|
56268
|
+
allCommandsMap.forEach((value) => {
|
|
56269
|
+
commandsChunk.push(value.sort((item1, item2) => {
|
|
56270
|
+
var _a2, _b2;
|
|
56271
|
+
return ((_a2 = item1.order) != null ? _a2 : 0) - ((_b2 = item2.order) != null ? _b2 : 0);
|
|
56272
|
+
}));
|
|
56273
|
+
});
|
|
56274
|
+
if (commandsChunk.length === 0) {
|
|
56275
|
+
return [];
|
|
56276
|
+
}
|
|
56277
|
+
const commands = commandsChunk.reduce((prev, curr) => prev.concat([SEP, ...curr]), []);
|
|
56278
|
+
commands.shift();
|
|
56279
|
+
return commands;
|
|
56280
|
+
});
|
|
56251
56281
|
this.editor = editor;
|
|
56252
56282
|
const popover = editor.options.componentsOptions.popover;
|
|
56253
56283
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
@@ -56296,7 +56326,7 @@ $$${mathData.mathjaxText}$$
|
|
|
56296
56326
|
}
|
|
56297
56327
|
showTextToolbar(reason) {
|
|
56298
56328
|
var _a, _b;
|
|
56299
|
-
|
|
56329
|
+
let commands = [];
|
|
56300
56330
|
const range = this.editor.selection.range;
|
|
56301
56331
|
this.providers.forEach((provider) => {
|
|
56302
56332
|
if (provider.getTextCommands) {
|
|
@@ -56337,6 +56367,7 @@ $$${mathData.mathjaxText}$$
|
|
|
56337
56367
|
this.toolbar.close("selectionChange");
|
|
56338
56368
|
return;
|
|
56339
56369
|
}
|
|
56370
|
+
commands = this.groupCommands(commands);
|
|
56340
56371
|
this.toolbar.updateItems(commands);
|
|
56341
56372
|
const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
|
|
56342
56373
|
const reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
|
|
@@ -65788,7 +65819,10 @@ ${codeText}
|
|
|
65788
65819
|
return [{
|
|
65789
65820
|
id: "add-comment-to-old-doc/text",
|
|
65790
65821
|
name: i18n$1.t("comment.quickMenuCommand"),
|
|
65791
|
-
icon: CommentIcon$1
|
|
65822
|
+
icon: CommentIcon$1,
|
|
65823
|
+
group: "common",
|
|
65824
|
+
groupOrder: 200,
|
|
65825
|
+
order: 110
|
|
65792
65826
|
}];
|
|
65793
65827
|
}
|
|
65794
65828
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
@@ -65796,7 +65830,10 @@ ${codeText}
|
|
|
65796
65830
|
return [{
|
|
65797
65831
|
id: "add-comment-to-old-doc/text",
|
|
65798
65832
|
name: i18n$1.t("comment.quickMenuCommand"),
|
|
65799
|
-
icon: CommentIcon$1
|
|
65833
|
+
icon: CommentIcon$1,
|
|
65834
|
+
group: "common",
|
|
65835
|
+
groupOrder: 200,
|
|
65836
|
+
order: 110
|
|
65800
65837
|
}];
|
|
65801
65838
|
}
|
|
65802
65839
|
return [];
|
|
@@ -83130,7 +83167,7 @@ ${data2.flowchartText}
|
|
|
83130
83167
|
}
|
|
83131
83168
|
}
|
|
83132
83169
|
});
|
|
83133
|
-
editor.version = "2.1.1-beta.
|
|
83170
|
+
editor.version = "2.1.1-beta.5";
|
|
83134
83171
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
83135
83172
|
window.setReauthFail = (fail) => {
|
|
83136
83173
|
window.isReauthError = fail;
|
|
@@ -83225,7 +83262,7 @@ ${data2.flowchartText}
|
|
|
83225
83262
|
if (!clientType.isMobile) {
|
|
83226
83263
|
OnesEditorToolbar.register(editor);
|
|
83227
83264
|
}
|
|
83228
|
-
editor.version = "2.1.1-beta.
|
|
83265
|
+
editor.version = "2.1.1-beta.5";
|
|
83229
83266
|
return editor;
|
|
83230
83267
|
}
|
|
83231
83268
|
async function showDocVersions(editor, options, serverUrl) {
|