@ones-editor/editor 2.1.1-beta.75 → 2.1.1-beta.77

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.
@@ -4,6 +4,7 @@ import CommandBar from './command-bar';
4
4
  import { AbstractManualCommandBar, ManualShowCommandBarOptions } from './types';
5
5
  export default abstract class ManualCommandBar extends CommandBar implements AbstractManualCommandBar {
6
6
  tippyInstance: Instance | null;
7
+ setProps: (props: ManualShowCommandBarOptions) => void;
7
8
  manualShow(target: HTMLElement, options?: ManualShowCommandBarOptions): void;
8
9
  close(reason: CloseReason): void;
9
10
  destroy(): void;
@@ -31,6 +31,7 @@ export interface AbstractCommandBar extends TypedEmitter<CommandBarEvents> {
31
31
  handleDocumentKeydown: (event: KeyboardEvent) => boolean;
32
32
  getSubBarOptions: (item: CommandItem) => ManualShowCommandBarOptions;
33
33
  updateItems: (items: CommandItem[]) => void;
34
+ setProps?: (props: ManualShowCommandBarOptions) => void;
34
35
  }
35
36
  export interface ShowCommandBarOptions {
36
37
  placement?: Placement;
package/dist/index.js CHANGED
@@ -6436,21 +6436,27 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
6436
6436
  .command-m-bar > .editor-command-bar-root::-webkit-scrollbar {
6437
6437
  display: none;
6438
6438
  }
6439
- .command-m-bar > .editor-command-bar-root .overflowing-float, .command-m-bar > .editor-command-bar-root .command-m-bar > .editor-command-bar-root.overflowing::before, .command-m-bar > .editor-command-bar-root .command-m-bar > .editor-command-bar-root.overflowing::after {
6439
+ .command-m-bar > .editor-command-bar-root.overflowing::after {
6440
6440
  content: "";
6441
6441
  position: absolute;
6442
6442
  top: 0;
6443
- left: 0;
6443
+ right: 0;
6444
6444
  bottom: 0;
6445
- width: 10px;
6445
+ width: 18px;
6446
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgb(255, 255, 255));
6446
6447
  z-index: 1;
6447
6448
  pointer-events: none;
6448
6449
  }
6449
- .command-m-bar > .editor-command-bar-root.overflowing::after {
6450
- background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgb(255, 255, 255));
6451
- }
6452
6450
  .command-m-bar > .editor-command-bar-root.overflowing::before {
6451
+ content: "";
6452
+ position: absolute;
6453
+ top: 0;
6454
+ left: 0;
6455
+ bottom: 0;
6456
+ width: 18px;
6453
6457
  background: linear-gradient(90deg, rgb(255, 255, 255) 0, rgba(255, 255, 255, 0));
6458
+ z-index: 1;
6459
+ pointer-events: none;
6454
6460
  }
6455
6461
  .command-m-bar > .editor-command-bar-root > .editor-command-bar {
6456
6462
  width: max-content;
@@ -8928,11 +8934,12 @@ var __publicField = (obj, key, value) => {
8928
8934
  return mouseEvent;
8929
8935
  }
8930
8936
  function ensureIsMobileEvent(events2) {
8931
- return events2 instanceof TouchEvent;
8937
+ return events2.type.startsWith("touch");
8932
8938
  }
8933
- function bindDbClick(elem, handler) {
8939
+ function bindDbClick(editor, elem, handler) {
8934
8940
  let clickCount = 0;
8935
8941
  function simulateDoubleClick(event) {
8942
+ editor.focus();
8936
8943
  clickCount++;
8937
8944
  if (clickCount === 1) {
8938
8945
  setTimeout(() => {
@@ -8958,7 +8965,7 @@ var __publicField = (obj, key, value) => {
8958
8965
  topWindow = window.top;
8959
8966
  }
8960
8967
  const visualViewportHeight = (_b = (_a = topWindow.visualViewport) == null ? void 0 : _a.height) != null ? _b : topWindow.innerHeight || topWindow.document.documentElement.clientHeight;
8961
- return Math.max(topWindow.innerHeight - visualViewportHeight, 40);
8968
+ return Math.max(topWindow.innerHeight - visualViewportHeight + 40, 40);
8962
8969
  };
8963
8970
  class ScrollDomElement {
8964
8971
  constructor(element) {
@@ -11186,6 +11193,13 @@ var __publicField = (obj, key, value) => {
11186
11193
  __publicField(this, "mouseDownEvent", null);
11187
11194
  __publicField(this, "dbClickRef", null);
11188
11195
  __publicField(this, "handleContextMenu", (event) => {
11196
+ if (clientType.isMobile) {
11197
+ event.preventDefault();
11198
+ if (clientType.isAndroid) {
11199
+ this.editor.focus();
11200
+ }
11201
+ return;
11202
+ }
11189
11203
  if (clientType.isSafari) {
11190
11204
  const sel = document.getSelection();
11191
11205
  if (sel && !sel.isCollapsed) {
@@ -11329,13 +11343,13 @@ var __publicField = (obj, key, value) => {
11329
11343
  container.ontouchend = this.handleMouseDown;
11330
11344
  } else {
11331
11345
  container.onmousedown = this.handleMouseDown;
11332
- container.oncontextmenu = this.handleContextMenu;
11333
11346
  }
11334
11347
  if (clientType.isIOS) {
11335
- this.dbClickRef = bindDbClick(container, this.handleDblClick);
11348
+ this.dbClickRef = bindDbClick(this.editor, container, this.handleDblClick);
11336
11349
  } else {
11337
11350
  container.ondblclick = this.handleDblClick;
11338
11351
  }
11352
+ container.oncontextmenu = this.handleContextMenu;
11339
11353
  container.onclick = this.handleClick;
11340
11354
  }
11341
11355
  unbindEvents() {
@@ -39582,6 +39596,10 @@ ${codeText}
39582
39596
  constructor() {
39583
39597
  super(...arguments);
39584
39598
  __publicField(this, "tippyInstance", null);
39599
+ __publicField(this, "setProps", (props) => {
39600
+ var _a;
39601
+ (_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
39602
+ });
39585
39603
  }
39586
39604
  manualShow(target, options) {
39587
39605
  var _a, _b, _c;
@@ -49765,7 +49783,7 @@ ${codeText}
49765
49783
  __publicField(this, "onShow", () => {
49766
49784
  setTimeout(() => {
49767
49785
  var _a;
49768
- (_a = this.form.linkText) == null ? void 0 : _a.getField().focus();
49786
+ (_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
49769
49787
  }, 400);
49770
49788
  });
49771
49789
  __publicField(this, "showPopup", (options) => {
@@ -50318,7 +50336,6 @@ ${codeText}
50318
50336
  commands.push(...this.provider.getAvailableCommands(editor, block, this.editor.selection.range, { child }));
50319
50337
  if (clientType.isMobile) {
50320
50338
  this.clipboardProvider.getAvailableCommands(editor, block).forEach((c) => commands.push(c));
50321
- commands.push({ id: "separator", name: "", type: "separator" });
50322
50339
  }
50323
50340
  return {
50324
50341
  element: child,
@@ -78451,6 +78468,8 @@ ${content}
78451
78468
  __publicField(this, "createMobileCommandItem", (items) => {
78452
78469
  const mobileWrap = this.getMobileCommandElement();
78453
78470
  const content = mobileWrap.querySelector(".mobile-item-content");
78471
+ const input2 = mobileWrap.querySelector("input");
78472
+ input2.value = "";
78454
78473
  this.createMobileItems(content, items, "");
78455
78474
  setTimeout(() => {
78456
78475
  const clientHeight = this.editor.scrollContainer.clientHeight;
@@ -79984,8 +80003,10 @@ ${content}
79984
80003
  __publicField(this, "mobileToolbar");
79985
80004
  __publicField(this, "fixedProviders");
79986
80005
  __publicField(this, "bar");
80006
+ __publicField(this, "subBar", null);
79987
80007
  __publicField(this, "handleSubBarShown", (_2, subBar) => {
79988
80008
  scrollBarIntoView(this.editor, subBar);
80009
+ this.subBar = subBar;
79989
80010
  });
79990
80011
  __publicField(this, "handleSelectionChange", debounce__default.default(() => {
79991
80012
  const commands = this.fixedProviders.getCommands(this.editor.selection.range);
@@ -80017,6 +80038,12 @@ ${content}
80017
80038
  }
80018
80039
  }, 500);
80019
80040
  }
80041
+ layoutSubBar() {
80042
+ var _a, _b, _c;
80043
+ if (((_a = this.subBar) == null ? void 0 : _a.isVisible) && this.subBar.parentItem) {
80044
+ (_c = (_b = this.subBar).setProps) == null ? void 0 : _c.call(_b, this.mobileToolbar.getSubBarOptions(this.subBar.parentItem));
80045
+ }
80046
+ }
80020
80047
  destroy() {
80021
80048
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
80022
80049
  this.mobileToolbar.destroy();
@@ -80056,8 +80083,11 @@ ${content}
80056
80083
  editorScrollIntoView(this.editor);
80057
80084
  }
80058
80085
  }
80059
- this.preHeight = this.virtualViewportHeight;
80060
80086
  this.commandBar.bar.style.bottom = `${offsetHeight}px`;
80087
+ if (this.preHeight !== this.virtualViewportHeight) {
80088
+ this.commandBar.layoutSubBar();
80089
+ }
80090
+ this.preHeight = this.virtualViewportHeight;
80061
80091
  }, this.toggleDelay));
80062
80092
  __publicField(this, "handScroll", debounce__default.default(() => {
80063
80093
  const input2 = this.editor.input.getInput();
@@ -86689,7 +86719,7 @@ ${data2.flowchartText}
86689
86719
  }
86690
86720
  }
86691
86721
  });
86692
- editor.version = "2.1.1-beta.75";
86722
+ editor.version = "2.1.1-beta.77";
86693
86723
  if (Logger$2.level === LogLevel.DEBUG) {
86694
86724
  window.setReauthFail = (fail) => {
86695
86725
  window.isReauthError = fail;
@@ -86790,7 +86820,7 @@ ${data2.flowchartText}
86790
86820
  });
86791
86821
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
86792
86822
  OnesEditorToolbar.register(editor);
86793
- editor.version = "2.1.1-beta.75";
86823
+ editor.version = "2.1.1-beta.77";
86794
86824
  return editor;
86795
86825
  }
86796
86826
  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.75",
3
+ "version": "2.1.1-beta.77",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",