@ones-editor/editor 2.1.7-beta.1 → 2.1.7-beta.3

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() {
@@ -74344,7 +74353,7 @@ ${content}
74344
74353
  }
74345
74354
  getVersionItemByVersionNum(version) {
74346
74355
  const versionItem = Array.from(this.versionsList.children).find(
74347
- (e2) => e2.versionData.version === version
74356
+ (e2) => e2.versionData.version.toString() === `${version}`
74348
74357
  );
74349
74358
  if (this.isVersionElement(versionItem)) {
74350
74359
  return versionItem;
@@ -75404,15 +75413,16 @@ ${content}
75404
75413
  assert(logger$r, this.versionList, "no versionList");
75405
75414
  if ((_a = this.versionOptions) == null ? void 0 : _a.initSelectedVersion) {
75406
75415
  const { initSelectedVersion: versionNumber } = this.versionOptions;
75407
- const version = this.versionList.selectVersionByVersionNum(versionNumber);
75408
- assert(logger$r, version, `version ${versionNumber} not found`);
75409
- this.viewVersion(version);
75410
- } else {
75411
- const version = this.versionList.activeVersion;
75412
- if (version) {
75413
- this.viewVersion(version);
75416
+ const version2 = this.versionList.selectVersionByVersionNum(versionNumber);
75417
+ if (version2) {
75418
+ this.viewVersion(version2);
75419
+ return;
75414
75420
  }
75415
75421
  }
75422
+ const version = this.versionList.activeVersion;
75423
+ if (version) {
75424
+ this.viewVersion(version);
75425
+ }
75416
75426
  }
75417
75427
  renderEditorLoading() {
75418
75428
  const { editorContainer } = this.components;
@@ -83749,6 +83759,493 @@ ${data2.flowchartText}
83749
83759
  }
83750
83760
  return buffer;
83751
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
+ }
83752
84249
  const logger = getLogger("create-editor");
83753
84250
  function getDefaultOnesEditorOptions(options) {
83754
84251
  var _a, _b, _c, _d, _e, _f;
@@ -83940,7 +84437,7 @@ ${data2.flowchartText}
83940
84437
  }
83941
84438
  }
83942
84439
  });
83943
- editor.version = "2.1.7-beta.1";
84440
+ editor.version = "2.1.7-beta.3";
83944
84441
  if (Logger$2.level === LogLevel.DEBUG) {
83945
84442
  window.setReauthFail = (fail) => {
83946
84443
  window.isReauthError = fail;
@@ -84035,7 +84532,7 @@ ${data2.flowchartText}
84035
84532
  if (!clientType.isMobile) {
84036
84533
  OnesEditorToolbar.register(editor);
84037
84534
  }
84038
- editor.version = "2.1.7-beta.1";
84535
+ editor.version = "2.1.7-beta.3";
84039
84536
  return editor;
84040
84537
  }
84041
84538
  async function showDocVersions(editor, options, serverUrl) {
@@ -84092,7 +84589,7 @@ ${data2.flowchartText}
84092
84589
  const versionsProvider = new ShareDBDocVersionsProvider(editorOptions);
84093
84590
  const dialog = new OnesEditorVersionsDialog(doc2, versionsProvider);
84094
84591
  const dialogOptions = options.options || {
84095
- container: document.body
84592
+ container: parent
84096
84593
  };
84097
84594
  dialog.show(dialogOptions);
84098
84595
  return dialog;
@@ -129809,6 +130306,9 @@ ${data2.flowchartText}
129809
130306
  });
129810
130307
  exports2.tippy = tippy__namespace;
129811
130308
  exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
130309
+ exports2.AlignCenterItem = AlignCenterItem;
130310
+ exports2.AlignLeftItem = AlignLeftItem;
130311
+ exports2.AlignRightItem = AlignRightItem;
129812
130312
  exports2.AnchorBox = AnchorBox;
129813
130313
  exports2.AuthError = AuthError;
129814
130314
  exports2.AuthHeader = AuthHeader;
@@ -129820,6 +130320,7 @@ ${data2.flowchartText}
129820
130320
  exports2.BlockLockerPasteHandler = BlockLockerPasteHandler;
129821
130321
  exports2.BlockResizer = BlockResizer;
129822
130322
  exports2.BrBox = BrBox;
130323
+ exports2.CheckListItem = CheckListItem;
129823
130324
  exports2.CodeBlock = CodeBlock;
129824
130325
  exports2.CodeLineBlock = CodeLineBlock;
129825
130326
  exports2.CodeTextDecorator = CodeTextDecorator;
@@ -129845,17 +130346,24 @@ ${data2.flowchartText}
129845
130346
  exports2.EventCallbacks = EventCallbacks;
129846
130347
  exports2.FILL_CHAR = FILL_CHAR;
129847
130348
  exports2.FileExtError = FileExtError;
130349
+ exports2.FontBoldItem = FontBoldItem;
130350
+ exports2.FontItalicItem = FontItalicItem;
130351
+ exports2.FontStrikethroughItem = FontStrikethroughItem;
130352
+ exports2.FontUnderlineItem = FontUnderlineItem;
129848
130353
  exports2.GroupOrder = GroupOrder;
129849
130354
  exports2.HeadingBlockScrollListener = HeadingBlockScrollListener;
129850
130355
  exports2.ImageBox = ImageBox;
129851
130356
  exports2.InlineBoxCommandProvider = InlineBoxCommandProvider;
129852
130357
  exports2.InputtingInsertion = InputtingInsertion;
130358
+ exports2.InsertImageItem = InsertImageItem;
130359
+ exports2.InsertLinkItem = InsertLinkItem;
129853
130360
  exports2.LayoutBlock = LayoutBlock;
129854
130361
  exports2.LayoutBlockCaptionInputHandler = LayoutBlockCaptionInputHandler;
129855
130362
  exports2.LocalDoc = LocalDoc;
129856
130363
  exports2.LogLevel = LogLevel;
129857
130364
  exports2.Logger = Logger$2;
129858
130365
  exports2.MIN_DISTANCE_THRESHOLD = MIN_DISTANCE_THRESHOLD$1;
130366
+ exports2.MainToolbar = MainToolbar;
129859
130367
  exports2.ManualCloseDialog = ManualCloseDialog;
129860
130368
  exports2.ManualMenu = ManualMenu;
129861
130369
  exports2.ManualToolbar = ManualToolbar;
@@ -129874,8 +130382,11 @@ ${data2.flowchartText}
129874
130382
  exports2.OnesEditorToolbar = OnesEditorToolbar;
129875
130383
  exports2.OnesEditorTooltip = OnesEditorTooltip;
129876
130384
  exports2.OnesEditorVersionsDialog = OnesEditorVersionsDialog;
130385
+ exports2.OrderedListItem = OrderedListItem;
130386
+ exports2.ParagraphItem = ParagraphItem;
129877
130387
  exports2.PermissionError = PermissionError;
129878
130388
  exports2.Popup = Popup;
130389
+ exports2.QuoteItem = QuoteItem;
129879
130390
  exports2.ReAuthToolbar = ReAuthToolbar;
129880
130391
  exports2.ReadonlyToolbar = ReadonlyToolbar;
129881
130392
  exports2.RemoteCarets = RemoteCarets;
@@ -129884,6 +130395,7 @@ ${data2.flowchartText}
129884
130395
  exports2.RemoteUsers = RemoteUsers;
129885
130396
  exports2.RequestReloadError = RequestReloadError;
129886
130397
  exports2.RichText = RichText;
130398
+ exports2.SeparatorItem = SeparatorItem;
129887
130399
  exports2.ShareDBClientBase = ShareDBClientBase;
129888
130400
  exports2.ShareDBDoc = ShareDBDoc;
129889
130401
  exports2.ShareDBDocVersionsProvider = ShareDBDocVersionsProvider;
@@ -129898,9 +130410,10 @@ ${data2.flowchartText}
129898
130410
  exports2.TableShortcuts = TableShortcuts;
129899
130411
  exports2.TextBlock = TextBlock;
129900
130412
  exports2.TextBox = TextBox;
129901
- exports2.TextColorItem = TextColorItem;
130413
+ exports2.TextColorItem = TextColorItem$1;
129902
130414
  exports2.TextStyleShortcuts = TextStyleShortcuts;
129903
130415
  exports2.TocEmbed = TocEmbed;
130416
+ exports2.UnorderedListItem = UnorderedListItem;
129904
130417
  exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
129905
130418
  exports2.abbreviation = abbreviation;
129906
130419
  exports2.addAttribute = addAttribute;
@@ -130205,6 +130718,7 @@ ${data2.flowchartText}
130205
130718
  exports2.getTextOpLength = getTextOpLength;
130206
130719
  exports2.getTextWidth = getTextWidth;
130207
130720
  exports2.getToolbar = getToolbar;
130721
+ exports2.getToolbarDefaultItems = getToolbarDefaultItems;
130208
130722
  exports2.handleBlockElementUpdated = handleBlockElementUpdated$1;
130209
130723
  exports2.hasAltOnly = hasAltOnly;
130210
130724
  exports2.hasClass = hasClass;