@ones-editor/editor 2.1.1-beta.31 → 2.1.1-beta.33
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandItem, BlockOptions, OnesEditor, BlockElement } from '../../../../@ones-editor/core';
|
|
1
|
+
import { CommandItem, BlockOptions, OnesEditor, BlockElement, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
2
|
export interface QuickMenuItem extends CommandItem {
|
|
3
3
|
itemType: 'insert-block';
|
|
4
4
|
blockType?: string;
|
|
@@ -26,6 +26,7 @@ export interface QuickMenuCommandBetween extends QuickMenuCommandParams {
|
|
|
26
26
|
export interface QuickMenuCommandProvider {
|
|
27
27
|
getCommands: (editor: OnesEditor, params: QuickMenuCommandParams) => CommandItem[];
|
|
28
28
|
executeCommand: (editor: OnesEditor, item: CommandItem, params: QuickMenuCommandInline | QuickMenuCommandBetween | AddMenuCommand) => Promise<BlockElement | null>;
|
|
29
|
+
filterCommands?: (editor: OnesEditor, items: CommandItem[], range: SelectionRange) => CommandItem[];
|
|
29
30
|
}
|
|
30
31
|
export interface QuickMenuOptions {
|
|
31
32
|
id?: string;
|
|
@@ -16,7 +16,7 @@ declare class EditorInput {
|
|
|
16
16
|
private options;
|
|
17
17
|
private unbindKeyDownEvent;
|
|
18
18
|
constructor(parent: HTMLElement, options: EditorInputOptions);
|
|
19
|
-
private
|
|
19
|
+
private container;
|
|
20
20
|
private get errorContent();
|
|
21
21
|
private get input();
|
|
22
22
|
private get suffix();
|
|
@@ -30,7 +30,7 @@ declare class EditorInput {
|
|
|
30
30
|
hideSuffix: () => void;
|
|
31
31
|
handleInput: (e: Event) => void;
|
|
32
32
|
handleClose: (e: Event) => void;
|
|
33
|
-
init():
|
|
33
|
+
init(): HTMLDivElement;
|
|
34
34
|
destroy(): void;
|
|
35
35
|
}
|
|
36
36
|
export declare function createInput(parent: HTMLElement, options: EditorInputOptions): EditorInput;
|
package/dist/index.js
CHANGED
|
@@ -40818,6 +40818,7 @@ ${codeText}
|
|
|
40818
40818
|
class EditorInput {
|
|
40819
40819
|
constructor(parent, options) {
|
|
40820
40820
|
__publicField(this, "unbindKeyDownEvent");
|
|
40821
|
+
__publicField(this, "container");
|
|
40821
40822
|
__publicField(this, "getField", () => this.input);
|
|
40822
40823
|
__publicField(this, "getInputValue", () => this.input.value);
|
|
40823
40824
|
__publicField(this, "setFieldError", (error2) => {
|
|
@@ -40872,24 +40873,21 @@ ${codeText}
|
|
|
40872
40873
|
});
|
|
40873
40874
|
this.parent = parent;
|
|
40874
40875
|
this.options = options;
|
|
40875
|
-
this.init();
|
|
40876
|
+
this.container = this.init();
|
|
40876
40877
|
this.input.addEventListener("input", this.handleInput);
|
|
40877
40878
|
this.unbindKeyDownEvent = bindKeyDownEvent(this.input, this.handleKeyDown);
|
|
40878
40879
|
}
|
|
40879
|
-
get container() {
|
|
40880
|
-
return this.parent.querySelector(".editor-input-wrap");
|
|
40881
|
-
}
|
|
40882
40880
|
get errorContent() {
|
|
40883
|
-
return this.
|
|
40881
|
+
return this.container.querySelector(".editor-input-error");
|
|
40884
40882
|
}
|
|
40885
40883
|
get input() {
|
|
40886
|
-
return this.
|
|
40884
|
+
return this.container.querySelector(".editor-input");
|
|
40887
40885
|
}
|
|
40888
40886
|
get suffix() {
|
|
40889
|
-
return this.
|
|
40887
|
+
return this.container.querySelector(".editor-input-suffix");
|
|
40890
40888
|
}
|
|
40891
40889
|
get prefix() {
|
|
40892
|
-
return this.
|
|
40890
|
+
return this.container.querySelector(".editor-input-prefix");
|
|
40893
40891
|
}
|
|
40894
40892
|
init() {
|
|
40895
40893
|
const options = this.options;
|
|
@@ -40936,7 +40934,7 @@ ${codeText}
|
|
|
40936
40934
|
}
|
|
40937
40935
|
inputContainer.appendChild(input2);
|
|
40938
40936
|
createElement("div", ["editor-input-error"], container);
|
|
40939
|
-
return
|
|
40937
|
+
return container;
|
|
40940
40938
|
}
|
|
40941
40939
|
destroy() {
|
|
40942
40940
|
this.input.removeEventListener("input", this.handleInput);
|
|
@@ -49035,8 +49033,8 @@ ${codeText}
|
|
|
49035
49033
|
} else {
|
|
49036
49034
|
blockIndex = getBlockIndex(nextBlock);
|
|
49037
49035
|
}
|
|
49036
|
+
editor.insertTextBlock("", containerId, blockIndex);
|
|
49038
49037
|
}
|
|
49039
|
-
editor.insertTextBlock("", containerId, blockIndex);
|
|
49040
49038
|
insertLink(editor, containerId, blockIndex);
|
|
49041
49039
|
return true;
|
|
49042
49040
|
}
|
|
@@ -56724,8 +56722,8 @@ $$${mathData.mathjaxText}$$
|
|
|
56724
56722
|
} else {
|
|
56725
56723
|
blockIndex = getBlockIndex(nextBlock);
|
|
56726
56724
|
}
|
|
56725
|
+
editor.insertTextBlock("", containerId, blockIndex);
|
|
56727
56726
|
}
|
|
56728
|
-
editor.insertTextBlock("", containerId, blockIndex);
|
|
56729
56727
|
switch (item.id) {
|
|
56730
56728
|
case "insert-math":
|
|
56731
56729
|
insertMath(editor, containerId, blockIndex);
|
|
@@ -77755,6 +77753,7 @@ ${codeText}
|
|
|
77755
77753
|
});
|
|
77756
77754
|
}
|
|
77757
77755
|
filter(editor, range, items, source) {
|
|
77756
|
+
var _a;
|
|
77758
77757
|
if (!range.isCollapsed())
|
|
77759
77758
|
return items;
|
|
77760
77759
|
const { anchor: anchor2 } = range;
|
|
@@ -77764,17 +77763,25 @@ ${codeText}
|
|
|
77764
77763
|
return items;
|
|
77765
77764
|
if (getBlockType(parentBlock) !== "callout")
|
|
77766
77765
|
return items;
|
|
77767
|
-
|
|
77768
|
-
|
|
77769
|
-
|
|
77770
|
-
|
|
77771
|
-
|
|
77772
|
-
|
|
77773
|
-
|
|
77766
|
+
const filterItems = [];
|
|
77767
|
+
items.forEach((item) => {
|
|
77768
|
+
var _a2, _b;
|
|
77769
|
+
const lastItem = filterItems[filterItems.length - 1];
|
|
77770
|
+
if ((lastItem == null ? void 0 : lastItem.type) === "section" && item.type === "section")
|
|
77771
|
+
return;
|
|
77772
|
+
if (item.blockOptions)
|
|
77773
|
+
return;
|
|
77774
|
+
const ret = (_b = (_a2 = item.commandProvider) == null ? void 0 : _a2.filterCommands) == null ? void 0 : _b.call(_a2, editor, items, range);
|
|
77775
|
+
if (ret) {
|
|
77776
|
+
filterItems.push(...ret);
|
|
77777
|
+
return;
|
|
77774
77778
|
}
|
|
77775
|
-
|
|
77779
|
+
filterItems.push(item);
|
|
77780
|
+
});
|
|
77781
|
+
if (((_a = filterItems[filterItems.length - 1]) == null ? void 0 : _a.type) === "section") {
|
|
77782
|
+
filterItems.pop();
|
|
77776
77783
|
}
|
|
77777
|
-
return
|
|
77784
|
+
return filterItems;
|
|
77778
77785
|
}
|
|
77779
77786
|
destroy() {
|
|
77780
77787
|
}
|
|
@@ -84967,7 +84974,7 @@ ${data2.flowchartText}
|
|
|
84967
84974
|
}
|
|
84968
84975
|
}
|
|
84969
84976
|
});
|
|
84970
|
-
editor.version = "2.1.1-beta.
|
|
84977
|
+
editor.version = "2.1.1-beta.33";
|
|
84971
84978
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
84972
84979
|
window.setReauthFail = (fail) => {
|
|
84973
84980
|
window.isReauthError = fail;
|
|
@@ -85066,7 +85073,7 @@ ${data2.flowchartText}
|
|
|
85066
85073
|
});
|
|
85067
85074
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
85068
85075
|
OnesEditorToolbar.register(editor);
|
|
85069
|
-
editor.version = "2.1.1-beta.
|
|
85076
|
+
editor.version = "2.1.1-beta.33";
|
|
85070
85077
|
return editor;
|
|
85071
85078
|
}
|
|
85072
85079
|
async function showDocVersions(editor, options, serverUrl) {
|