@ones-editor/editor 2.1.1-beta.23 → 2.1.1-beta.24

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 withPlainText;
4
+ private options?;
5
5
  id: string;
6
- constructor(editor: OnesEditor, withPlainText?: boolean);
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, withPlainText = true) {
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.withPlainText = withPlainText;
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)
@@ -84904,7 +84909,7 @@ ${data2.flowchartText}
84904
84909
  }
84905
84910
  }
84906
84911
  });
84907
- editor.version = "2.1.1-beta.23";
84912
+ editor.version = "2.1.1-beta.24";
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.23";
85009
+ editor.version = "2.1.1-beta.24";
85005
85010
  return editor;
85006
85011
  }
85007
85012
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.1-beta.23",
3
+ "version": "2.1.1-beta.24",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",