@ones-editor/editor 2.1.0-beta.3 → 2.1.0-beta.4
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
|
@@ -48004,7 +48004,7 @@ ${codeText}
|
|
|
48004
48004
|
}
|
|
48005
48005
|
}
|
|
48006
48006
|
const logger$1S = getLogger("toolbar-handler");
|
|
48007
|
-
const SEP = {
|
|
48007
|
+
const SEP$1 = {
|
|
48008
48008
|
id: "",
|
|
48009
48009
|
name: "",
|
|
48010
48010
|
type: "separator"
|
|
@@ -48279,7 +48279,7 @@ ${codeText}
|
|
|
48279
48279
|
});
|
|
48280
48280
|
toolbarCommands.push(...sortCommands);
|
|
48281
48281
|
if (index2 !== toolbarCommandsChunk.length - 1) {
|
|
48282
|
-
toolbarCommands.push(SEP);
|
|
48282
|
+
toolbarCommands.push(SEP$1);
|
|
48283
48283
|
}
|
|
48284
48284
|
});
|
|
48285
48285
|
if (toolbarCommands.length === 0) {
|
|
@@ -55931,6 +55931,11 @@ $$${mathData.mathjaxText}$$
|
|
|
55931
55931
|
"ja-JP": jaJP$s
|
|
55932
55932
|
});
|
|
55933
55933
|
const logger$1K = getLogger("readonly-toolbar");
|
|
55934
|
+
const SEP = {
|
|
55935
|
+
id: "",
|
|
55936
|
+
name: "",
|
|
55937
|
+
type: "separator"
|
|
55938
|
+
};
|
|
55934
55939
|
class ReadonlyToolbar {
|
|
55935
55940
|
constructor(editor) {
|
|
55936
55941
|
__publicField(this, "toolbar");
|
|
@@ -56028,6 +56033,35 @@ $$${mathData.mathjaxText}$$
|
|
|
56028
56033
|
}
|
|
56029
56034
|
this.showObjectToolbar(event);
|
|
56030
56035
|
});
|
|
56036
|
+
__publicField(this, "groupCommands", (allCommands) => {
|
|
56037
|
+
var _a, _b;
|
|
56038
|
+
const allCommandsMap = /* @__PURE__ */ new Map([["common", []]]);
|
|
56039
|
+
for (let i = 0; i < allCommands.length; i++) {
|
|
56040
|
+
const group = allCommands[i].group;
|
|
56041
|
+
if (!group) {
|
|
56042
|
+
(_a = allCommandsMap.get("common")) == null ? void 0 : _a.push(allCommands[i]);
|
|
56043
|
+
continue;
|
|
56044
|
+
}
|
|
56045
|
+
if (allCommandsMap.has(group)) {
|
|
56046
|
+
(_b = allCommandsMap.get(group)) == null ? void 0 : _b.push(allCommands[i]);
|
|
56047
|
+
} else {
|
|
56048
|
+
allCommandsMap.set(group, [allCommands[i]]);
|
|
56049
|
+
}
|
|
56050
|
+
}
|
|
56051
|
+
const commandsChunk = [];
|
|
56052
|
+
allCommandsMap.forEach((value) => {
|
|
56053
|
+
commandsChunk.push(value.sort((item1, item2) => {
|
|
56054
|
+
var _a2, _b2;
|
|
56055
|
+
return ((_a2 = item1.order) != null ? _a2 : 0) - ((_b2 = item2.order) != null ? _b2 : 0);
|
|
56056
|
+
}));
|
|
56057
|
+
});
|
|
56058
|
+
if (commandsChunk.length === 0) {
|
|
56059
|
+
return [];
|
|
56060
|
+
}
|
|
56061
|
+
const commands = commandsChunk.reduce((prev, curr) => prev.concat([SEP, ...curr]), []);
|
|
56062
|
+
commands.shift();
|
|
56063
|
+
return commands;
|
|
56064
|
+
});
|
|
56031
56065
|
this.editor = editor;
|
|
56032
56066
|
const popover = editor.options.componentsOptions.popover;
|
|
56033
56067
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
@@ -56076,7 +56110,7 @@ $$${mathData.mathjaxText}$$
|
|
|
56076
56110
|
}
|
|
56077
56111
|
showTextToolbar(reason) {
|
|
56078
56112
|
var _a, _b;
|
|
56079
|
-
|
|
56113
|
+
let commands = [];
|
|
56080
56114
|
const range = this.editor.selection.range;
|
|
56081
56115
|
this.providers.forEach((provider) => {
|
|
56082
56116
|
if (provider.getTextCommands) {
|
|
@@ -56090,6 +56124,7 @@ $$${mathData.mathjaxText}$$
|
|
|
56090
56124
|
commands.push(...textCommands);
|
|
56091
56125
|
}
|
|
56092
56126
|
});
|
|
56127
|
+
commands = this.groupCommands(commands);
|
|
56093
56128
|
if (commands.length === 0) {
|
|
56094
56129
|
this.toolbar.close("cancelBar");
|
|
56095
56130
|
return;
|
|
@@ -82865,7 +82900,7 @@ ${data2.flowchartText}
|
|
|
82865
82900
|
}
|
|
82866
82901
|
}
|
|
82867
82902
|
});
|
|
82868
|
-
editor.version = "2.1.0-beta.
|
|
82903
|
+
editor.version = "2.1.0-beta.4";
|
|
82869
82904
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
82870
82905
|
window.setReauthFail = (fail) => {
|
|
82871
82906
|
window.isReauthError = fail;
|
|
@@ -82960,7 +82995,7 @@ ${data2.flowchartText}
|
|
|
82960
82995
|
if (!clientType.isMobile) {
|
|
82961
82996
|
OnesEditorToolbar.register(editor);
|
|
82962
82997
|
}
|
|
82963
|
-
editor.version = "2.1.0-beta.
|
|
82998
|
+
editor.version = "2.1.0-beta.4";
|
|
82964
82999
|
return editor;
|
|
82965
83000
|
}
|
|
82966
83001
|
async function showDocVersions(editor, options, serverUrl) {
|