@ones-editor/editor 2.1.7-beta.2 → 2.1.7-beta.4

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.
package/dist/index.js CHANGED
@@ -439,7 +439,10 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
439
439
  position: absolute;
440
440
  pointer-events: none;
441
441
  z-index: -1;
442
- }.editor-command-bar.toolbar .color-button {
442
+ }.editor-command-bar.toolbar .command-item.disabled .color-button {
443
+ color: #c7c7c7;
444
+ }
445
+ .editor-command-bar.toolbar .command-item .color-button {
443
446
  width: 24px;
444
447
  height: 24px;
445
448
  display: flex;
@@ -454,70 +457,70 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
454
457
  cursor: pointer;
455
458
  color: #2D2D2E;
456
459
  }
457
- .editor-command-bar.toolbar .color-button[data-color="0"] {
460
+ .editor-command-bar.toolbar .command-item .color-button[data-color="0"] {
458
461
  color: var(--color-0);
459
462
  }
460
- .editor-command-bar.toolbar .color-button[data-color="1"] {
463
+ .editor-command-bar.toolbar .command-item .color-button[data-color="1"] {
461
464
  color: var(--color-1);
462
465
  }
463
- .editor-command-bar.toolbar .color-button[data-color="2"] {
466
+ .editor-command-bar.toolbar .command-item .color-button[data-color="2"] {
464
467
  color: var(--color-2);
465
468
  }
466
- .editor-command-bar.toolbar .color-button[data-color="3"] {
469
+ .editor-command-bar.toolbar .command-item .color-button[data-color="3"] {
467
470
  color: var(--color-3);
468
471
  }
469
- .editor-command-bar.toolbar .color-button[data-color="4"] {
472
+ .editor-command-bar.toolbar .command-item .color-button[data-color="4"] {
470
473
  color: var(--color-4);
471
474
  }
472
- .editor-command-bar.toolbar .color-button[data-color="5"] {
475
+ .editor-command-bar.toolbar .command-item .color-button[data-color="5"] {
473
476
  color: var(--color-5);
474
477
  }
475
- .editor-command-bar.toolbar .color-button[data-color="6"] {
478
+ .editor-command-bar.toolbar .command-item .color-button[data-color="6"] {
476
479
  color: var(--color-6);
477
480
  }
478
- .editor-command-bar.toolbar .color-button[data-background-color="0"] {
481
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="0"] {
479
482
  background-color: var(--background-color-0);
480
483
  }
481
- .editor-command-bar.toolbar .color-button[data-background-color="1"] {
484
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="1"] {
482
485
  background-color: var(--background-color-1);
483
486
  }
484
- .editor-command-bar.toolbar .color-button[data-background-color="2"] {
487
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="2"] {
485
488
  background-color: var(--background-color-2);
486
489
  }
487
- .editor-command-bar.toolbar .color-button[data-background-color="3"] {
490
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="3"] {
488
491
  background-color: var(--background-color-3);
489
492
  }
490
- .editor-command-bar.toolbar .color-button[data-background-color="4"] {
493
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="4"] {
491
494
  background-color: var(--background-color-4);
492
495
  }
493
- .editor-command-bar.toolbar .color-button[data-background-color="5"] {
496
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="5"] {
494
497
  background-color: var(--background-color-5);
495
498
  }
496
- .editor-command-bar.toolbar .color-button[data-background-color="6"] {
499
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="6"] {
497
500
  background-color: var(--background-color-6);
498
501
  }
499
- .editor-command-bar.toolbar .color-button[data-background-color="7"] {
502
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="7"] {
500
503
  background-color: var(--background-color-7);
501
504
  }
502
- .editor-command-bar.toolbar .color-button[data-background-color="8"] {
505
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="8"] {
503
506
  background-color: var(--background-color-8);
504
507
  }
505
- .editor-command-bar.toolbar .color-button[data-background-color="9"] {
508
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="9"] {
506
509
  background-color: var(--background-color-9);
507
510
  }
508
- .editor-command-bar.toolbar .color-button[data-background-color="10"] {
511
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="10"] {
509
512
  background-color: var(--background-color-10);
510
513
  }
511
- .editor-command-bar.toolbar .color-button[data-background-color="11"] {
514
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="11"] {
512
515
  background-color: var(--background-color-11);
513
516
  }
514
- .editor-command-bar.toolbar .color-button[data-background-color="12"] {
517
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="12"] {
515
518
  background-color: var(--background-color-12);
516
519
  }
517
- .editor-command-bar.toolbar .color-button[data-background-color="13"] {
520
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="13"] {
518
521
  background-color: var(--background-color-13);
519
522
  }
520
- .editor-command-bar.toolbar .color-button[data-background-color="14"] {
523
+ .editor-command-bar.toolbar .command-item .color-button[data-background-color="14"] {
521
524
  background-color: var(--background-color-14);
522
525
  }
523
526
  .tippy-content {
@@ -40084,7 +40087,12 @@ ${codeText}
40084
40087
  button2.setAttribute("data-background-color", `${backgroundColor}`);
40085
40088
  }
40086
40089
  }
40087
- class TextColorItem extends tinyTypedEmitter.TypedEmitter {
40090
+ function getButtonColor(button2) {
40091
+ const color = button2.getAttribute("data-color");
40092
+ const backgroundColor = button2.getAttribute("data-background-color");
40093
+ return [color === null ? null : parseInt(color, 10), backgroundColor === null ? null : parseInt(backgroundColor, 10)];
40094
+ }
40095
+ class TextColorItem$1 extends tinyTypedEmitter.TypedEmitter {
40088
40096
  constructor(editor) {
40089
40097
  super();
40090
40098
  __publicField(this, "id", "text-color-item");
@@ -40114,6 +40122,7 @@ ${codeText}
40114
40122
  this.updatePaletteColor(this.latestColors);
40115
40123
  this.emit("beforePopup");
40116
40124
  });
40125
+ __publicField(this, "getButtonColor", () => getButtonColor(this.element));
40117
40126
  this.editor = editor;
40118
40127
  this.colorPaletteItem = new ColorPaletteItem("text-color-palette-item");
40119
40128
  this.colorPaletteItem.palette.addListener("onClick", this.handlePaletteClick);
@@ -73044,7 +73053,7 @@ ${content}
73044
73053
  this.emptyTextBlockAttributes.set(blockId, attributes);
73045
73054
  });
73046
73055
  this.editor = editor;
73047
- this.colorItem = editor.addCustom("text-color-item", () => new TextColorItem(editor));
73056
+ this.colorItem = editor.addCustom("text-color-item", () => new TextColorItem$1(editor));
73048
73057
  this.colorItem.addListener("onClick", this.handleChangeColor);
73049
73058
  }
73050
73059
  destroy() {
@@ -83750,6 +83759,493 @@ ${data2.flowchartText}
83750
83759
  }
83751
83760
  return buffer;
83752
83761
  }
83762
+ class FontStyleBaseItem {
83763
+ constructor(name, id) {
83764
+ __publicField(this, "states", []);
83765
+ this.name = name;
83766
+ this.id = id;
83767
+ }
83768
+ getCommand(editor) {
83769
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "main-toolbar");
83770
+ return commands.find((c) => c.id === this.id);
83771
+ }
83772
+ onClick(editor) {
83773
+ const command = this.getCommand(editor);
83774
+ if (command) {
83775
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
83776
+ }
83777
+ }
83778
+ updateState(editor) {
83779
+ const command = this.getCommand(editor);
83780
+ if (command) {
83781
+ this.states = command.states || [];
83782
+ } else {
83783
+ this.states = ["disabled"];
83784
+ }
83785
+ }
83786
+ }
83787
+ class FontBoldItem extends FontStyleBaseItem {
83788
+ constructor() {
83789
+ super("bold", "text/style-bold");
83790
+ __publicField(this, "icon", BoldIcon);
83791
+ }
83792
+ }
83793
+ class FontItalicItem extends FontStyleBaseItem {
83794
+ constructor() {
83795
+ super("italic", "text/style-italic");
83796
+ __publicField(this, "icon", ItalicIcon);
83797
+ }
83798
+ }
83799
+ class FontUnderlineItem extends FontStyleBaseItem {
83800
+ constructor() {
83801
+ super("underline", "text/style-underline");
83802
+ __publicField(this, "icon", UnderlineIcon);
83803
+ }
83804
+ }
83805
+ class FontStrikethroughItem extends FontStyleBaseItem {
83806
+ constructor() {
83807
+ super("strikethrough", "text/style-strikethrough");
83808
+ __publicField(this, "icon", LineThroughIcon);
83809
+ }
83810
+ }
83811
+ class TextColorItem extends TextColorItem$1 {
83812
+ constructor(editor) {
83813
+ super(editor);
83814
+ __publicField(this, "childrenPlacement", "bottom-start");
83815
+ __publicField(this, "states");
83816
+ __publicField(this, "handleMousedown", (event) => {
83817
+ event.preventDefault();
83818
+ event.stopPropagation();
83819
+ });
83820
+ this.addListener("onClick", this.handleChangeColor);
83821
+ this.element.addEventListener("mousedown", this.handleMousedown);
83822
+ }
83823
+ handleChangeColor(type, value) {
83824
+ const provider = this.editor.editorCommandProviders.getCommandProvider("TextCommandProvider");
83825
+ if (provider) {
83826
+ provider.handleChangeColor(type, value);
83827
+ }
83828
+ this.setLatestColors(type, value);
83829
+ }
83830
+ updateState(editor) {
83831
+ const provider = this.editor.editorCommandProviders.getCommandProvider("TextCommandProvider");
83832
+ if (provider) {
83833
+ const selection = editor.selection;
83834
+ const blocks = selection.range.getSelectedBlocks();
83835
+ const startBlock = blocks[0];
83836
+ if (startBlock && startBlock.start.isSimple() && startBlock.end.isSimple()) {
83837
+ const range = createBlockSimpleRange(this.editor, startBlock.block, startBlock.start.offset, startBlock.end.offset);
83838
+ const commands = provider.getAvailableCommands(this.editor, startBlock.block, range);
83839
+ const color = commands.find((c) => c.id === "text-color-item");
83840
+ if (color) {
83841
+ this.states = [];
83842
+ const button2 = color.element;
83843
+ if (button2) {
83844
+ const color2 = button2.getAttribute("data-color");
83845
+ const backgroundColor = button2.getAttribute("data-background-color");
83846
+ const colors = [color2 === null ? null : parseInt(color2, 10), backgroundColor === null ? null : parseInt(backgroundColor, 10)];
83847
+ this.updateButtonColor(colors);
83848
+ }
83849
+ } else {
83850
+ this.states = ["disabled"];
83851
+ }
83852
+ }
83853
+ }
83854
+ }
83855
+ }
83856
+ class AlignBaseItem {
83857
+ constructor(id, name, icon) {
83858
+ __publicField(this, "states", []);
83859
+ this.id = id;
83860
+ this.name = name;
83861
+ this.icon = icon;
83862
+ }
83863
+ getCommand(editor) {
83864
+ var _a;
83865
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "main-toolbar");
83866
+ const parentCommand = commands.find((c) => c.id === "align");
83867
+ if (!parentCommand) {
83868
+ return null;
83869
+ }
83870
+ const command = (_a = parentCommand.children) == null ? void 0 : _a.find((c) => c.id === this.id);
83871
+ return command || null;
83872
+ }
83873
+ onClick(editor, item) {
83874
+ const command = {
83875
+ ...item,
83876
+ group: "BlockAlignProvider"
83877
+ };
83878
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
83879
+ }
83880
+ updateState(editor) {
83881
+ const command = this.getCommand(editor);
83882
+ if (command) {
83883
+ this.states = command.states || [];
83884
+ } else {
83885
+ this.states = ["disabled"];
83886
+ }
83887
+ }
83888
+ }
83889
+ class AlignLeftItem extends AlignBaseItem {
83890
+ constructor() {
83891
+ super("align-left", "Align left", AlignLeftIcon);
83892
+ }
83893
+ }
83894
+ class AlignCenterItem extends AlignBaseItem {
83895
+ constructor() {
83896
+ super("align-center", "Align center", AlignCenterIcon);
83897
+ }
83898
+ }
83899
+ class AlignRightItem extends AlignBaseItem {
83900
+ constructor() {
83901
+ super("align-right", "Align right", AlignRightIcon);
83902
+ }
83903
+ }
83904
+ class ParagraphItem {
83905
+ constructor() {
83906
+ __publicField(this, "children", []);
83907
+ __publicField(this, "id", "paragraph");
83908
+ __publicField(this, "name", "Paragraph");
83909
+ __publicField(this, "states", []);
83910
+ __publicField(this, "dropdown", true);
83911
+ __publicField(this, "manualShowChildren", true);
83912
+ __publicField(this, "childrenPlacement", "bottom-start");
83913
+ this.children = [{
83914
+ name: "Plain text",
83915
+ id: "text",
83916
+ icon: TextIcon
83917
+ }, {
83918
+ name: "",
83919
+ id: "separator",
83920
+ type: "separator"
83921
+ }];
83922
+ const icons = [
83923
+ Heading1Icon,
83924
+ Heading2Icon,
83925
+ Heading3Icon,
83926
+ Heading4Icon,
83927
+ Heading5Icon,
83928
+ Heading6Icon
83929
+ ];
83930
+ for (let i = 1; i <= 6; i++) {
83931
+ this.children.push({
83932
+ name: `Heading ${i}`,
83933
+ id: `heading-${i}`,
83934
+ icon: icons[i - 1],
83935
+ value: `${i}`
83936
+ });
83937
+ }
83938
+ }
83939
+ updateState(editor) {
83940
+ const block = editor.getBlockById(editor.selection.range.start.blockId);
83941
+ if (!block || !isTextKindBlock(editor, block)) {
83942
+ this.states = ["disabled"];
83943
+ return;
83944
+ }
83945
+ this.states = [];
83946
+ let heading;
83947
+ if (isHeadingBlock$1(block)) {
83948
+ heading = getBlockHeading(block);
83949
+ }
83950
+ const children = this.children;
83951
+ for (let i = 0; i < children.length; i++) {
83952
+ const child = children[i];
83953
+ if (child.id === "text") {
83954
+ child.states = heading === void 0 ? ["checked"] : [];
83955
+ } else if (child.id === "separator")
83956
+ ;
83957
+ else if (child.id.startsWith("heading-")) {
83958
+ child.states = child.value === `${heading}` ? ["checked"] : [];
83959
+ }
83960
+ }
83961
+ if (heading === void 0) {
83962
+ this.name = "Plain Text";
83963
+ } else {
83964
+ this.name = `Heading ${heading}`;
83965
+ }
83966
+ }
83967
+ onClick(editor, item) {
83968
+ const command = {
83969
+ ...item,
83970
+ group: "BlockTurnIntoCommandProvider"
83971
+ };
83972
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {
83973
+ value: item.value
83974
+ });
83975
+ }
83976
+ }
83977
+ class SeparatorItem {
83978
+ constructor() {
83979
+ __publicField(this, "id", `separator-${Date.now()}`);
83980
+ __publicField(this, "type", "separator");
83981
+ __publicField(this, "name", "");
83982
+ }
83983
+ }
83984
+ class OrderedListItem {
83985
+ constructor() {
83986
+ __publicField(this, "id", "ordered-list");
83987
+ __publicField(this, "name", "Ordered List");
83988
+ __publicField(this, "icon", OrderedListIcon);
83989
+ __publicField(this, "states", []);
83990
+ }
83991
+ getCommand(editor) {
83992
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "");
83993
+ const command = commands.find((c) => c.id === this.id);
83994
+ return command;
83995
+ }
83996
+ updateState(editor) {
83997
+ const command = this.getCommand(editor);
83998
+ if (command) {
83999
+ this.name = command.name;
84000
+ this.states = command.states || [];
84001
+ } else {
84002
+ this.states = ["disabled"];
84003
+ }
84004
+ }
84005
+ onClick(editor, item) {
84006
+ const command = {
84007
+ ...item,
84008
+ group: "BlockParagraphProvider"
84009
+ };
84010
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
84011
+ }
84012
+ }
84013
+ class UnorderedListItem {
84014
+ constructor() {
84015
+ __publicField(this, "id", "unordered-list");
84016
+ __publicField(this, "name", "Unordered List");
84017
+ __publicField(this, "icon", UnorderedListIcon);
84018
+ __publicField(this, "states", []);
84019
+ }
84020
+ getCommand(editor) {
84021
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "");
84022
+ const command = commands.find((c) => c.id === this.id);
84023
+ return command;
84024
+ }
84025
+ updateState(editor) {
84026
+ const command = this.getCommand(editor);
84027
+ if (command) {
84028
+ this.name = command.name;
84029
+ this.states = command.states || [];
84030
+ } else {
84031
+ this.states = ["disabled"];
84032
+ }
84033
+ }
84034
+ onClick(editor, item) {
84035
+ const command = {
84036
+ ...item,
84037
+ group: "BlockParagraphProvider"
84038
+ };
84039
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
84040
+ }
84041
+ }
84042
+ class CheckListItem {
84043
+ constructor() {
84044
+ __publicField(this, "id", "check-list");
84045
+ __publicField(this, "name", "Check List");
84046
+ __publicField(this, "icon", CheckListIcon);
84047
+ __publicField(this, "states", []);
84048
+ }
84049
+ getCommand(editor) {
84050
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "");
84051
+ const command = commands.find((c) => c.id === this.id);
84052
+ return command;
84053
+ }
84054
+ updateState(editor) {
84055
+ const command = this.getCommand(editor);
84056
+ if (command) {
84057
+ this.name = command.name;
84058
+ this.states = command.states || [];
84059
+ } else {
84060
+ this.states = ["disabled"];
84061
+ }
84062
+ }
84063
+ onClick(editor, item) {
84064
+ const command = {
84065
+ ...item,
84066
+ group: "BlockParagraphProvider"
84067
+ };
84068
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
84069
+ }
84070
+ }
84071
+ class InsertImageItem {
84072
+ constructor() {
84073
+ __publicField(this, "id", "insert-image");
84074
+ __publicField(this, "name", "Insert Image");
84075
+ __publicField(this, "icon", ImageIcon);
84076
+ }
84077
+ onClick(editor, item) {
84078
+ const block = editor.getBlockById(editor.selection.range.start.blockId);
84079
+ const items = getAllInsertBlockItems(editor, block, "insert-block", {
84080
+ withPlainText: false,
84081
+ from: "block-menu",
84082
+ type: "sibling"
84083
+ });
84084
+ const imageItem = items.find((item2) => item2.id === "insert-image");
84085
+ if (imageItem) {
84086
+ executeInsertBlockCommand(editor, block, imageItem, false);
84087
+ }
84088
+ }
84089
+ }
84090
+ class InsertLinkItem {
84091
+ constructor() {
84092
+ __publicField(this, "id", "insert-link");
84093
+ __publicField(this, "name", "Insert Link");
84094
+ __publicField(this, "icon", LinkIcon);
84095
+ __publicField(this, "states", []);
84096
+ }
84097
+ getCommand(editor) {
84098
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "link");
84099
+ return commands.find((command) => command.id === "link");
84100
+ }
84101
+ updateState(editor) {
84102
+ const command = this.getCommand(editor);
84103
+ if (command) {
84104
+ this.states = command.states || [];
84105
+ } else {
84106
+ this.states = ["disabled"];
84107
+ }
84108
+ }
84109
+ onClick(editor, item) {
84110
+ const command = this.getCommand(editor);
84111
+ if (!command) {
84112
+ return;
84113
+ }
84114
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
84115
+ }
84116
+ }
84117
+ class QuoteItem {
84118
+ constructor() {
84119
+ __publicField(this, "id", "quoted");
84120
+ __publicField(this, "name", "Quote");
84121
+ __publicField(this, "icon", QuoteIcon);
84122
+ __publicField(this, "states", []);
84123
+ }
84124
+ getCommand(editor) {
84125
+ const commands = editor.editorCommandProviders.getCommands(editor.selection.range, "quoted");
84126
+ return commands.find((command) => command.id === "quoted");
84127
+ }
84128
+ updateState(editor) {
84129
+ const command = this.getCommand(editor);
84130
+ if (command) {
84131
+ this.states = command.states || [];
84132
+ } else {
84133
+ this.states = ["disabled"];
84134
+ }
84135
+ }
84136
+ onClick(editor, item) {
84137
+ const command = this.getCommand(editor);
84138
+ if (!command) {
84139
+ return;
84140
+ }
84141
+ editor.editorCommandProviders.executeCommand(editor.selection.range, command, {});
84142
+ }
84143
+ }
84144
+ function getToolbarDefaultItems(editor) {
84145
+ return [
84146
+ new ParagraphItem(),
84147
+ new SeparatorItem(),
84148
+ new FontBoldItem(),
84149
+ new FontItalicItem(),
84150
+ new FontUnderlineItem(),
84151
+ new FontStrikethroughItem(),
84152
+ new TextColorItem$1(editor),
84153
+ new SeparatorItem(),
84154
+ new AlignLeftItem(),
84155
+ new AlignCenterItem(),
84156
+ new AlignRightItem(),
84157
+ new SeparatorItem(),
84158
+ new OrderedListItem(),
84159
+ new UnorderedListItem(),
84160
+ new CheckListItem(),
84161
+ new SeparatorItem(),
84162
+ new InsertImageItem(),
84163
+ new InsertLinkItem(),
84164
+ new QuoteItem()
84165
+ ];
84166
+ }
84167
+ class MainToolbar {
84168
+ constructor(editor, parent) {
84169
+ __publicField(this, "toolbar");
84170
+ __publicField(this, "handleClick", (bar2, item) => {
84171
+ const command = item;
84172
+ if (command.onClick) {
84173
+ command.onClick(this.editor, command);
84174
+ this.handleSelectionChanged();
84175
+ return;
84176
+ }
84177
+ const findParent = (item2, id) => {
84178
+ if (item2.children) {
84179
+ for (const child of item2.children) {
84180
+ if (child.id === id) {
84181
+ return item2;
84182
+ }
84183
+ const parent = findParent(child, id);
84184
+ if (parent) {
84185
+ return parent;
84186
+ }
84187
+ }
84188
+ }
84189
+ return null;
84190
+ };
84191
+ for (const i of this.toolbar.items) {
84192
+ const parent = findParent(i, item.id);
84193
+ if (parent) {
84194
+ if (parent.onClick) {
84195
+ parent.onClick(this.editor, item);
84196
+ this.handleSelectionChanged();
84197
+ return;
84198
+ }
84199
+ }
84200
+ }
84201
+ });
84202
+ __publicField(this, "handleSelectionChanged", () => {
84203
+ this.updateState();
84204
+ });
84205
+ this.editor = editor;
84206
+ this.toolbar = new FixedToolbar(parent, this.getItems());
84207
+ this.toolbar.addListener("click", this.handleClick);
84208
+ this.editor.addListener("selectionChanged", this.handleSelectionChanged);
84209
+ this.updateState();
84210
+ }
84211
+ destroy() {
84212
+ }
84213
+ setItems(items) {
84214
+ this.toolbar.updateItems(items);
84215
+ this.updateState();
84216
+ }
84217
+ getItems() {
84218
+ return [
84219
+ new ParagraphItem(),
84220
+ new SeparatorItem(),
84221
+ new FontBoldItem(),
84222
+ new FontItalicItem(),
84223
+ new FontUnderlineItem(),
84224
+ new FontStrikethroughItem(),
84225
+ new TextColorItem(this.editor),
84226
+ new SeparatorItem(),
84227
+ new AlignLeftItem(),
84228
+ new AlignCenterItem(),
84229
+ new AlignRightItem(),
84230
+ new SeparatorItem(),
84231
+ new OrderedListItem(),
84232
+ new UnorderedListItem(),
84233
+ new CheckListItem(),
84234
+ new SeparatorItem(),
84235
+ new InsertImageItem(),
84236
+ new InsertLinkItem(),
84237
+ new QuoteItem()
84238
+ ];
84239
+ }
84240
+ updateState() {
84241
+ const items = this.toolbar.items;
84242
+ items.forEach((item) => {
84243
+ var _a;
84244
+ (_a = item.updateState) == null ? void 0 : _a.call(item, this.editor);
84245
+ });
84246
+ this.toolbar.updateItems(items);
84247
+ }
84248
+ }
83753
84249
  const logger = getLogger("create-editor");
83754
84250
  function getDefaultOnesEditorOptions(options) {
83755
84251
  var _a, _b, _c, _d, _e, _f;
@@ -83869,7 +84365,9 @@ ${data2.flowchartText}
83869
84365
  return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
83870
84366
  });
83871
84367
  editor.addCustom("remote-cursor", () => new RemoteCarets(editor));
83872
- editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
84368
+ if (options.blockMenuButton !== false) {
84369
+ editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
84370
+ }
83873
84371
  if (!clientType.isMobile) {
83874
84372
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
83875
84373
  }
@@ -83894,9 +84392,11 @@ ${data2.flowchartText}
83894
84392
  const mentionOptions = options.componentsOptions.mention;
83895
84393
  editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
83896
84394
  }
83897
- editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
84395
+ if (options.headingButton !== false) {
84396
+ editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
84397
+ }
83898
84398
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
83899
- if (!clientType.isMobile) {
84399
+ if (!clientType.isMobile && options.floatingToolbar !== false) {
83900
84400
  OnesEditorToolbar.register(editor);
83901
84401
  }
83902
84402
  OnesEditorDropTarget.register(editor);
@@ -83941,7 +84441,7 @@ ${data2.flowchartText}
83941
84441
  }
83942
84442
  }
83943
84443
  });
83944
- editor.version = "2.1.7-beta.2";
84444
+ editor.version = "2.1.7-beta.4";
83945
84445
  if (Logger$2.level === LogLevel.DEBUG) {
83946
84446
  window.setReauthFail = (fail) => {
83947
84447
  window.isReauthError = fail;
@@ -84000,8 +84500,10 @@ ${data2.flowchartText}
84000
84500
  editor.input.addHandler(new OnesEditorPasteHandler(editor));
84001
84501
  editor.input.addHandler(new BlockLockerPasteHandler());
84002
84502
  editor.input.addHandler(new ListPasteHandler());
84003
- editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
84004
- if (!clientType.isMobile) {
84503
+ if (options.blockMenuButton !== false) {
84504
+ editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
84505
+ }
84506
+ if (!clientType.isMobile && options.floatingToolbar !== false) {
84005
84507
  editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
84006
84508
  }
84007
84509
  editor.addCustom("editor-quick-menu", () => {
@@ -84018,7 +84520,9 @@ ${data2.flowchartText}
84018
84520
  if (options.enableContextMenu !== false) {
84019
84521
  editor.addCustom("editor-context-menu", (editor2) => new OnesEditorContextMenu(editor2));
84020
84522
  }
84021
- editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
84523
+ if (options.headingButton !== false) {
84524
+ editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
84525
+ }
84022
84526
  editor.addListener("clickLink", (editor2, event, link2) => {
84023
84527
  var _a2;
84024
84528
  if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
@@ -84036,7 +84540,7 @@ ${data2.flowchartText}
84036
84540
  if (!clientType.isMobile) {
84037
84541
  OnesEditorToolbar.register(editor);
84038
84542
  }
84039
- editor.version = "2.1.7-beta.2";
84543
+ editor.version = "2.1.7-beta.4";
84040
84544
  return editor;
84041
84545
  }
84042
84546
  async function showDocVersions(editor, options, serverUrl) {
@@ -129810,6 +130314,9 @@ ${data2.flowchartText}
129810
130314
  });
129811
130315
  exports2.tippy = tippy__namespace;
129812
130316
  exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
130317
+ exports2.AlignCenterItem = AlignCenterItem;
130318
+ exports2.AlignLeftItem = AlignLeftItem;
130319
+ exports2.AlignRightItem = AlignRightItem;
129813
130320
  exports2.AnchorBox = AnchorBox;
129814
130321
  exports2.AuthError = AuthError;
129815
130322
  exports2.AuthHeader = AuthHeader;
@@ -129821,6 +130328,7 @@ ${data2.flowchartText}
129821
130328
  exports2.BlockLockerPasteHandler = BlockLockerPasteHandler;
129822
130329
  exports2.BlockResizer = BlockResizer;
129823
130330
  exports2.BrBox = BrBox;
130331
+ exports2.CheckListItem = CheckListItem;
129824
130332
  exports2.CodeBlock = CodeBlock;
129825
130333
  exports2.CodeLineBlock = CodeLineBlock;
129826
130334
  exports2.CodeTextDecorator = CodeTextDecorator;
@@ -129846,17 +130354,24 @@ ${data2.flowchartText}
129846
130354
  exports2.EventCallbacks = EventCallbacks;
129847
130355
  exports2.FILL_CHAR = FILL_CHAR;
129848
130356
  exports2.FileExtError = FileExtError;
130357
+ exports2.FontBoldItem = FontBoldItem;
130358
+ exports2.FontItalicItem = FontItalicItem;
130359
+ exports2.FontStrikethroughItem = FontStrikethroughItem;
130360
+ exports2.FontUnderlineItem = FontUnderlineItem;
129849
130361
  exports2.GroupOrder = GroupOrder;
129850
130362
  exports2.HeadingBlockScrollListener = HeadingBlockScrollListener;
129851
130363
  exports2.ImageBox = ImageBox;
129852
130364
  exports2.InlineBoxCommandProvider = InlineBoxCommandProvider;
129853
130365
  exports2.InputtingInsertion = InputtingInsertion;
130366
+ exports2.InsertImageItem = InsertImageItem;
130367
+ exports2.InsertLinkItem = InsertLinkItem;
129854
130368
  exports2.LayoutBlock = LayoutBlock;
129855
130369
  exports2.LayoutBlockCaptionInputHandler = LayoutBlockCaptionInputHandler;
129856
130370
  exports2.LocalDoc = LocalDoc;
129857
130371
  exports2.LogLevel = LogLevel;
129858
130372
  exports2.Logger = Logger$2;
129859
130373
  exports2.MIN_DISTANCE_THRESHOLD = MIN_DISTANCE_THRESHOLD$1;
130374
+ exports2.MainToolbar = MainToolbar;
129860
130375
  exports2.ManualCloseDialog = ManualCloseDialog;
129861
130376
  exports2.ManualMenu = ManualMenu;
129862
130377
  exports2.ManualToolbar = ManualToolbar;
@@ -129875,8 +130390,11 @@ ${data2.flowchartText}
129875
130390
  exports2.OnesEditorToolbar = OnesEditorToolbar;
129876
130391
  exports2.OnesEditorTooltip = OnesEditorTooltip;
129877
130392
  exports2.OnesEditorVersionsDialog = OnesEditorVersionsDialog;
130393
+ exports2.OrderedListItem = OrderedListItem;
130394
+ exports2.ParagraphItem = ParagraphItem;
129878
130395
  exports2.PermissionError = PermissionError;
129879
130396
  exports2.Popup = Popup;
130397
+ exports2.QuoteItem = QuoteItem;
129880
130398
  exports2.ReAuthToolbar = ReAuthToolbar;
129881
130399
  exports2.ReadonlyToolbar = ReadonlyToolbar;
129882
130400
  exports2.RemoteCarets = RemoteCarets;
@@ -129885,6 +130403,7 @@ ${data2.flowchartText}
129885
130403
  exports2.RemoteUsers = RemoteUsers;
129886
130404
  exports2.RequestReloadError = RequestReloadError;
129887
130405
  exports2.RichText = RichText;
130406
+ exports2.SeparatorItem = SeparatorItem;
129888
130407
  exports2.ShareDBClientBase = ShareDBClientBase;
129889
130408
  exports2.ShareDBDoc = ShareDBDoc;
129890
130409
  exports2.ShareDBDocVersionsProvider = ShareDBDocVersionsProvider;
@@ -129899,9 +130418,10 @@ ${data2.flowchartText}
129899
130418
  exports2.TableShortcuts = TableShortcuts;
129900
130419
  exports2.TextBlock = TextBlock;
129901
130420
  exports2.TextBox = TextBox;
129902
- exports2.TextColorItem = TextColorItem;
130421
+ exports2.TextColorItem = TextColorItem$1;
129903
130422
  exports2.TextStyleShortcuts = TextStyleShortcuts;
129904
130423
  exports2.TocEmbed = TocEmbed;
130424
+ exports2.UnorderedListItem = UnorderedListItem;
129905
130425
  exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
129906
130426
  exports2.abbreviation = abbreviation;
129907
130427
  exports2.addAttribute = addAttribute;
@@ -130206,6 +130726,7 @@ ${data2.flowchartText}
130206
130726
  exports2.getTextOpLength = getTextOpLength;
130207
130727
  exports2.getTextWidth = getTextWidth;
130208
130728
  exports2.getToolbar = getToolbar;
130729
+ exports2.getToolbarDefaultItems = getToolbarDefaultItems;
130209
130730
  exports2.handleBlockElementUpdated = handleBlockElementUpdated$1;
130210
130731
  exports2.hasAltOnly = hasAltOnly;
130211
130732
  exports2.hasClass = hasClass;