@ones-editor/editor 2.1.1-beta.23 → 2.1.1-beta.25
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,9 +1,9 @@
|
|
|
1
|
-
import { BlockElement, CommandItem, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
|
|
1
|
+
import { BlockElement, CommandItem, CommandParams, OnesEditor, OnesEditorCommandProvider, SelectionRange } from '../../../../@ones-editor/core';
|
|
2
2
|
export default class HeadingProvider implements OnesEditorCommandProvider {
|
|
3
3
|
private editor;
|
|
4
|
-
private
|
|
4
|
+
private options?;
|
|
5
5
|
id: string;
|
|
6
|
-
constructor(editor: OnesEditor,
|
|
6
|
+
constructor(editor: OnesEditor, options?: CommandParams | undefined);
|
|
7
7
|
getHeadingIndex(): number;
|
|
8
8
|
createHeadingCommandItem(heading: number): CommandItem[];
|
|
9
9
|
getAvailableCommands(editor: OnesEditor, block: BlockElement): CommandItem[];
|
package/dist/index.js
CHANGED
|
@@ -45885,7 +45885,7 @@ ${codeText}
|
|
|
45885
45885
|
Heading8Icon
|
|
45886
45886
|
];
|
|
45887
45887
|
class HeadingProvider {
|
|
45888
|
-
constructor(editor,
|
|
45888
|
+
constructor(editor, options) {
|
|
45889
45889
|
__publicField(this, "id", "HeadingProvider");
|
|
45890
45890
|
__publicField(this, "executeInsertCommand", (editor, containerId, blockIndex, command) => {
|
|
45891
45891
|
if (!command.id.startsWith("heading-") && command.id !== "text") {
|
|
@@ -45901,9 +45901,13 @@ ${codeText}
|
|
|
45901
45901
|
return false;
|
|
45902
45902
|
});
|
|
45903
45903
|
this.editor = editor;
|
|
45904
|
-
this.
|
|
45904
|
+
this.options = options;
|
|
45905
45905
|
}
|
|
45906
45906
|
getHeadingIndex() {
|
|
45907
|
+
var _a;
|
|
45908
|
+
if ((_a = this.options) == null ? void 0 : _a.maxHeading) {
|
|
45909
|
+
return this.options.maxHeading;
|
|
45910
|
+
}
|
|
45907
45911
|
let maxHeading = maxHeadingContainDocument();
|
|
45908
45912
|
if (maxHeading <= 4) {
|
|
45909
45913
|
maxHeading = 5;
|
|
@@ -45913,8 +45917,9 @@ ${codeText}
|
|
|
45913
45917
|
return maxHeading;
|
|
45914
45918
|
}
|
|
45915
45919
|
createHeadingCommandItem(heading) {
|
|
45920
|
+
var _a;
|
|
45916
45921
|
const children = [];
|
|
45917
|
-
if (this.withPlainText) {
|
|
45922
|
+
if ((_a = this.options) == null ? void 0 : _a.withPlainText) {
|
|
45918
45923
|
children.push({
|
|
45919
45924
|
id: "text",
|
|
45920
45925
|
name: i18n$1.t("commands.text"),
|
|
@@ -50170,7 +50175,7 @@ ${codeText}
|
|
|
50170
50175
|
this.editor = editor;
|
|
50171
50176
|
this.withPlainText = withPlainText;
|
|
50172
50177
|
this.providers = [
|
|
50173
|
-
new HeadingProvider(this.editor, this.withPlainText),
|
|
50178
|
+
new HeadingProvider(this.editor, { withPlainText: this.withPlainText }),
|
|
50174
50179
|
new ListProvider(this.editor),
|
|
50175
50180
|
new QuotedProvider(this.editor),
|
|
50176
50181
|
new AlignProvider(this.editor)
|
|
@@ -58092,7 +58097,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58092
58097
|
});
|
|
58093
58098
|
__publicField(this, "executeInsertCommand", () => false);
|
|
58094
58099
|
this.editor = editor;
|
|
58095
|
-
this.colorItem =
|
|
58100
|
+
this.colorItem = new TextColorItem(editor);
|
|
58096
58101
|
this.colorItem.addListener("onClick", this.handleChangeColor);
|
|
58097
58102
|
}
|
|
58098
58103
|
get blockAttributesHandler() {
|
|
@@ -58156,7 +58161,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58156
58161
|
return [];
|
|
58157
58162
|
}
|
|
58158
58163
|
let commands;
|
|
58159
|
-
if (getBlockTextLength$6(editor, block) === 0) {
|
|
58164
|
+
if (getBlockTextLength$6(editor, block) === 0 || !isTextKindBlock(editor, block)) {
|
|
58160
58165
|
commands = getCommands([]);
|
|
58161
58166
|
} else {
|
|
58162
58167
|
const subText2 = getSubText(editor, block, range);
|
|
@@ -58403,7 +58408,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58403
58408
|
states: disable && !(params == null ? void 0 : params.isFilter) ? ["disabled"] : [],
|
|
58404
58409
|
icon: InlineCodeIcon
|
|
58405
58410
|
}];
|
|
58406
|
-
if (getBlockTextLength$6(editor, block) === 0) {
|
|
58411
|
+
if (getBlockTextLength$6(editor, block) === 0 || !isTextKindBlock(editor, block)) {
|
|
58407
58412
|
commands = getStandardTextStyles(commands, []);
|
|
58408
58413
|
} else {
|
|
58409
58414
|
const subText2 = getSubText(editor, block, range);
|
|
@@ -84904,7 +84909,7 @@ ${data2.flowchartText}
|
|
|
84904
84909
|
}
|
|
84905
84910
|
}
|
|
84906
84911
|
});
|
|
84907
|
-
editor.version = "2.1.1-beta.
|
|
84912
|
+
editor.version = "2.1.1-beta.25";
|
|
84908
84913
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
84909
84914
|
window.setReauthFail = (fail) => {
|
|
84910
84915
|
window.isReauthError = fail;
|
|
@@ -85001,7 +85006,7 @@ ${data2.flowchartText}
|
|
|
85001
85006
|
});
|
|
85002
85007
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
85003
85008
|
OnesEditorToolbar.register(editor);
|
|
85004
|
-
editor.version = "2.1.1-beta.
|
|
85009
|
+
editor.version = "2.1.1-beta.25";
|
|
85005
85010
|
return editor;
|
|
85006
85011
|
}
|
|
85007
85012
|
async function showDocVersions(editor, options, serverUrl) {
|