@ones-editor/editor 2.1.1-beta.22 → 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)
@@ -58019,7 +58024,9 @@ $$${mathData.mathjaxText}$$
58019
58024
  }
58020
58025
  if (!(params == null ? void 0 : params.isFilter)) {
58021
58026
  commands.forEach((item) => {
58022
- item.states = disable ? ["disabled"] : [];
58027
+ if (disable) {
58028
+ item.states = ["disabled"];
58029
+ }
58023
58030
  });
58024
58031
  }
58025
58032
  return commands;
@@ -58102,7 +58109,7 @@ $$${mathData.mathjaxText}$$
58102
58109
  return [];
58103
58110
  }
58104
58111
  this.updateButtonColor(range);
58105
- return [{ ...this.colorItem, states: disable ? ["disabled"] : [] }];
58112
+ return [{ ...this.colorItem, states: disable ? ["disabled"] : [], childrenPlacement: "bottom" }];
58106
58113
  }
58107
58114
  getInsertCommands() {
58108
58115
  return [];
@@ -58162,7 +58169,9 @@ $$${mathData.mathjaxText}$$
58162
58169
  }
58163
58170
  if (!(params == null ? void 0 : params.isFilter)) {
58164
58171
  commands.forEach((item) => {
58165
- item.states = disable ? ["disabled"] : [];
58172
+ if (disable) {
58173
+ item.states = ["disabled"];
58174
+ }
58166
58175
  });
58167
58176
  }
58168
58177
  return commands;
@@ -84900,7 +84909,7 @@ ${data2.flowchartText}
84900
84909
  }
84901
84910
  }
84902
84911
  });
84903
- editor.version = "2.1.1-beta.22";
84912
+ editor.version = "2.1.1-beta.24";
84904
84913
  if (Logger$2.level === LogLevel.DEBUG) {
84905
84914
  window.setReauthFail = (fail) => {
84906
84915
  window.isReauthError = fail;
@@ -84997,7 +85006,7 @@ ${data2.flowchartText}
84997
85006
  });
84998
85007
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
84999
85008
  OnesEditorToolbar.register(editor);
85000
- editor.version = "2.1.1-beta.22";
85009
+ editor.version = "2.1.1-beta.24";
85001
85010
  return editor;
85002
85011
  }
85003
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.22",
3
+ "version": "2.1.1-beta.24",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",