@ones-editor/editor 2.2.8-beta.12 → 2.2.8-beta.13

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.
@@ -16,7 +16,7 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
16
16
  constructor(items: CommandItem[], closeable?: Closeable, options?: CommandBarOptions);
17
17
  close(reason: CloseReason): void;
18
18
  click(item: CommandItem, target: HTMLElement): void;
19
- createPopperOptions(): Partial<import("@popperjs/core").Options>;
19
+ createPopperOptions(flip?: boolean): Partial<import("@popperjs/core").Options>;
20
20
  destroy(): void;
21
21
  abstract readonly isVisible: boolean;
22
22
  get isSubCommandBar(): boolean;
@@ -67,6 +67,7 @@ export interface CommandBarOptions {
67
67
  padding?: number;
68
68
  beforeClose?: (event?: MouseEvent | TouchEvent) => boolean;
69
69
  showName?: boolean;
70
+ maxWidth?: number | string;
70
71
  }
71
72
  export type CreateManualCommandBarFunction = (parentItem: CommandItem, closeable: Closeable, options?: CommandBarOptions) => AbstractManualCommandBar;
72
73
  export type PopoverOptions = {
package/dist/index.js CHANGED
@@ -879,8 +879,7 @@ div.tippy-box button {
879
879
  overflow-y: auto;
880
880
  }
881
881
  .editor-command-bar.toolbar {
882
- max-width: 90vw;
883
- overflow-x: auto;
882
+ width: max-content;
884
883
  }
885
884
  .editor-command-bar.fixed.mobile, .editor-command-bar.toolbar.mobile {
886
885
  gap: 16px;
@@ -40117,44 +40116,54 @@ ${codeText}
40117
40116
  click(item, target) {
40118
40117
  this.emit("click", this, item, target);
40119
40118
  }
40120
- createPopperOptions() {
40121
- var _a, _b, _c;
40119
+ createPopperOptions(flip = false) {
40120
+ var _a, _b, _c, _d;
40122
40121
  const popperOptions = { modifiers: [] };
40123
40122
  const overflowBoundary = this.options.overflowBoundary;
40124
40123
  const padding = this.options.padding;
40125
40124
  if (overflowBoundary) {
40126
- (_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
40127
- name: "customHide",
40128
- enabled: true,
40129
- phase: "main",
40130
- fn: ({ state }) => {
40131
- const popper = state.elements.popper;
40132
- const popperRect = popper.getBoundingClientRect();
40133
- const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
40134
- const topCheck = popperRect.top < overflowBoundaryRect.top;
40135
- const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
40136
- const leftCheck = popperRect.left < overflowBoundaryRect.left;
40137
- const rightCheck = popperRect.right > overflowBoundaryRect.right;
40138
- if (topCheck || bottomCheck || leftCheck || rightCheck) {
40139
- popper.setAttribute("data-tippy-hidden", "");
40140
- } else {
40141
- popper.removeAttribute("data-tippy-hidden");
40125
+ if (flip) {
40126
+ (_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
40127
+ name: "flip",
40128
+ options: {
40129
+ boundary: overflowBoundary,
40130
+ fallbackPlacements: ["top", "bottom"]
40142
40131
  }
40143
- }
40144
- });
40132
+ });
40133
+ } else {
40134
+ (_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
40135
+ name: "hide",
40136
+ enabled: true,
40137
+ phase: "main",
40138
+ fn: debounce__default.default(({ state }) => {
40139
+ const popper = state.elements.popper;
40140
+ const popperRect = popper.getBoundingClientRect();
40141
+ const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
40142
+ const topCheck = popperRect.top < overflowBoundaryRect.top;
40143
+ const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
40144
+ const leftCheck = popperRect.left < overflowBoundaryRect.left;
40145
+ const rightCheck = popperRect.right > overflowBoundaryRect.right;
40146
+ if (topCheck || bottomCheck || leftCheck || rightCheck) {
40147
+ popper.setAttribute("data-tippy-hidden", "");
40148
+ } else {
40149
+ popper.removeAttribute("data-tippy-hidden");
40150
+ }
40151
+ }, 10)
40152
+ });
40153
+ (_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
40154
+ name: "flip",
40155
+ enabled: false
40156
+ });
40157
+ }
40145
40158
  }
40146
40159
  if (padding) {
40147
- (_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
40160
+ (_d = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _d.push({
40148
40161
  name: "preventOverflow",
40149
40162
  options: {
40150
40163
  padding
40151
40164
  }
40152
40165
  });
40153
40166
  }
40154
- (_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
40155
- name: "flip",
40156
- enabled: false
40157
- });
40158
40167
  return popperOptions;
40159
40168
  }
40160
40169
  destroy() {
@@ -40518,7 +40527,7 @@ ${codeText}
40518
40527
  });
40519
40528
  }
40520
40529
  manualShow(target, options) {
40521
- var _a, _b, _c;
40530
+ var _a, _b, _c, _d;
40522
40531
  if (this.isVisible) {
40523
40532
  return;
40524
40533
  }
@@ -40533,15 +40542,15 @@ ${codeText}
40533
40542
  triggerTarget: null,
40534
40543
  hideOnClick: false,
40535
40544
  placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
40536
- maxWidth: 650,
40537
- arrow: (_b = options == null ? void 0 : options.arrow) != null ? _b : this.options.tippyArrow,
40545
+ maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
40546
+ arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
40538
40547
  appendTo: document.body,
40539
40548
  onShow: this.handleShow,
40540
40549
  onHidden: this.handleHidden,
40541
40550
  onShown: this.handleShown,
40542
40551
  theme: options == null ? void 0 : options.theme,
40543
40552
  getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
40544
- offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
40553
+ offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
40545
40554
  popperOptions: this.createPopperOptions()
40546
40555
  });
40547
40556
  if (options == null ? void 0 : options.point) {
@@ -41028,6 +41037,7 @@ ${codeText}
41028
41037
  super(items, closeable, {
41029
41038
  itemElementTag: "button",
41030
41039
  tippyArrow: false,
41040
+ maxWidth: clientType.isMobile ? "90vw" : "max-content",
41031
41041
  ...options
41032
41042
  });
41033
41043
  }
@@ -41292,7 +41302,7 @@ ${codeText}
41292
41302
  theme: options == null ? void 0 : options.theme,
41293
41303
  getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
41294
41304
  offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
41295
- popperOptions: this.createPopperOptions()
41305
+ popperOptions: this.createPopperOptions(true)
41296
41306
  });
41297
41307
  this.clearSelectedItem();
41298
41308
  document.addEventListener("keydown", this.handleDocumentKeydown);
@@ -68688,7 +68698,7 @@ ${codeText}
68688
68698
  }
68689
68699
  commands(editor, blockElement, child) {
68690
68700
  var _a;
68691
- if (editor.readonly) {
68701
+ if (editor.readonly || clientType.isMobile) {
68692
68702
  return void 0;
68693
68703
  }
68694
68704
  const data2 = getBlockId(blockElement);
@@ -88378,7 +88388,7 @@ ${data2.flowchartText}
88378
88388
  }
88379
88389
  }
88380
88390
  });
88381
- editor.version = "2.2.8-beta.12";
88391
+ editor.version = "2.2.8-beta.13";
88382
88392
  return editor;
88383
88393
  }
88384
88394
  function isDoc(doc2) {
@@ -88473,7 +88483,7 @@ ${data2.flowchartText}
88473
88483
  });
88474
88484
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88475
88485
  OnesEditorToolbar.register(editor);
88476
- editor.version = "2.2.8-beta.12";
88486
+ editor.version = "2.2.8-beta.13";
88477
88487
  return editor;
88478
88488
  }
88479
88489
  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.2.8-beta.12",
3
+ "version": "2.2.8-beta.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",