@ones-editor/editor 2.1.0-beta.3 → 2.1.0-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
|
@@ -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,31 @@ $$${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();
|
|
56039
|
+
for (let i = 0; i < allCommands.length; i++) {
|
|
56040
|
+
const groupOrder = (_a = allCommands[i].groupOrder) != null ? _a : 0;
|
|
56041
|
+
if (allCommandsMap.has(groupOrder)) {
|
|
56042
|
+
(_b = allCommandsMap.get(groupOrder)) == null ? void 0 : _b.push(allCommands[i]);
|
|
56043
|
+
} else {
|
|
56044
|
+
allCommandsMap.set(groupOrder, [allCommands[i]]);
|
|
56045
|
+
}
|
|
56046
|
+
}
|
|
56047
|
+
const commandsChunk = [];
|
|
56048
|
+
allCommandsMap.forEach((value) => {
|
|
56049
|
+
commandsChunk.push(value.sort((item1, item2) => {
|
|
56050
|
+
var _a2, _b2;
|
|
56051
|
+
return ((_a2 = item1.order) != null ? _a2 : 0) - ((_b2 = item2.order) != null ? _b2 : 0);
|
|
56052
|
+
}));
|
|
56053
|
+
});
|
|
56054
|
+
if (commandsChunk.length === 0) {
|
|
56055
|
+
return [];
|
|
56056
|
+
}
|
|
56057
|
+
const commands = commandsChunk.reduce((prev, curr) => prev.concat([SEP, ...curr]), []);
|
|
56058
|
+
commands.shift();
|
|
56059
|
+
return commands;
|
|
56060
|
+
});
|
|
56031
56061
|
this.editor = editor;
|
|
56032
56062
|
const popover = editor.options.componentsOptions.popover;
|
|
56033
56063
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
@@ -56076,7 +56106,7 @@ $$${mathData.mathjaxText}$$
|
|
|
56076
56106
|
}
|
|
56077
56107
|
showTextToolbar(reason) {
|
|
56078
56108
|
var _a, _b;
|
|
56079
|
-
|
|
56109
|
+
let commands = [];
|
|
56080
56110
|
const range = this.editor.selection.range;
|
|
56081
56111
|
this.providers.forEach((provider) => {
|
|
56082
56112
|
if (provider.getTextCommands) {
|
|
@@ -56090,6 +56120,7 @@ $$${mathData.mathjaxText}$$
|
|
|
56090
56120
|
commands.push(...textCommands);
|
|
56091
56121
|
}
|
|
56092
56122
|
});
|
|
56123
|
+
commands = this.groupCommands(commands);
|
|
56093
56124
|
if (commands.length === 0) {
|
|
56094
56125
|
this.toolbar.close("cancelBar");
|
|
56095
56126
|
return;
|
|
@@ -82865,7 +82896,7 @@ ${data2.flowchartText}
|
|
|
82865
82896
|
}
|
|
82866
82897
|
}
|
|
82867
82898
|
});
|
|
82868
|
-
editor.version = "2.1.0-beta.
|
|
82899
|
+
editor.version = "2.1.0-beta.5";
|
|
82869
82900
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
82870
82901
|
window.setReauthFail = (fail) => {
|
|
82871
82902
|
window.isReauthError = fail;
|
|
@@ -82960,7 +82991,7 @@ ${data2.flowchartText}
|
|
|
82960
82991
|
if (!clientType.isMobile) {
|
|
82961
82992
|
OnesEditorToolbar.register(editor);
|
|
82962
82993
|
}
|
|
82963
|
-
editor.version = "2.1.0-beta.
|
|
82994
|
+
editor.version = "2.1.0-beta.5";
|
|
82964
82995
|
return editor;
|
|
82965
82996
|
}
|
|
82966
82997
|
async function showDocVersions(editor, options, serverUrl) {
|