@ones-editor/editor 2.1.7-beta.13 → 2.1.7-beta.14

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.
@@ -11,9 +11,10 @@ export default class ClipboardProvider implements OnesEditorCommandProvider {
11
11
  get hasClipboardReadPermission(): boolean;
12
12
  get hasClipboardWritePermission(): boolean;
13
13
  clipboardSupport(): void;
14
- canPaste(): boolean;
14
+ canPaste(): Promise<boolean>;
15
+ createPasteElement(editor: OnesEditor): HTMLDivElement;
15
16
  getAvailableCommands: (editor: OnesEditor, blockElement: BlockElement) => CommandItem[];
16
17
  getInsertCommands: () => never[];
17
18
  copyRange(editor: OnesEditor, range: SelectionRange): void;
18
- executeCommand(editor: OnesEditor, block: BlockElement, range: SelectionRange, command: CommandItem): boolean;
19
+ executeRangeCommand(editor: OnesEditor, range: SelectionRange, command: CommandItem): boolean;
19
20
  }
package/dist/index.js CHANGED
@@ -2045,6 +2045,9 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
2045
2045
  [data-command-bar-id] .command-item.disabled > .color-button svg {
2046
2046
  color: #b2bccd;
2047
2047
  }
2048
+ [data-command-bar-id] .command-item .command-item-paste.disabled {
2049
+ color: #c7c7c7;
2050
+ }
2048
2051
  [data-command-bar-id=cursor-toolbar].mobile .tippy-box,
2049
2052
  [data-command-bar-id=paste-special-button].mobile .tippy-box,
2050
2053
  [data-command-bar-id=editor-toolbar].mobile .tippy-box {
@@ -5843,7 +5846,7 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
5843
5846
  }
5844
5847
  div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .command-item .mobile-item-wrap .mobile-item-content {
5845
5848
  height: 400px;
5846
- overflow-x: auto;
5849
+ overflow-y: auto;
5847
5850
  overscroll-behavior: contain;
5848
5851
  }
5849
5852
  div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .command-item .mobile-item-wrap .mobile-item-content .mobile-item {
@@ -6526,16 +6529,19 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
6526
6529
  html, body {
6527
6530
  height: 100%;
6528
6531
  overscroll-behavior: contain;
6529
- }.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle {
6532
+ }[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle,
6533
+ .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle {
6530
6534
  position: absolute;
6531
6535
  flex-direction: column;
6532
6536
  align-items: center;
6533
6537
  display: none;
6534
6538
  z-index: 10;
6535
6539
  }
6540
+ [data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.active,
6536
6541
  .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.active {
6537
6542
  display: flex;
6538
6543
  }
6544
+ [data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line,
6539
6545
  .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line {
6540
6546
  width: 4px;
6541
6547
  height: 16px;
@@ -6543,6 +6549,7 @@ html, body {
6543
6549
  flex-grow: 1;
6544
6550
  flex-shrink: 1;
6545
6551
  }
6552
+ [data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle,
6546
6553
  .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle {
6547
6554
  width: 16px;
6548
6555
  height: 16px;
@@ -6551,20 +6558,36 @@ html, body {
6551
6558
  flex-shrink: 0;
6552
6559
  background-color: var(--primary-color);
6553
6560
  }
6561
+ [data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.start,
6554
6562
  .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.start {
6555
6563
  flex-direction: column-reverse;
6564
+ }
6565
+ div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask {
6566
+ pointer-events: none;
6567
+ }
6568
+ div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask::after {
6569
+ content: " ";
6570
+ position: absolute;
6571
+ left: 0;
6572
+ top: 0;
6573
+ right: 0;
6574
+ bottom: 0;
6575
+ z-index: 999;
6576
+ opacity: 0;
6556
6577
  }.editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-container.layout-column-container {
6557
6578
  background-color: transparent;
6558
6579
  }
6559
6580
  .editor-root div.editor-content div[data-type=editor-container].root > .container-blocks > * + .layout-block {
6560
6581
  margin-top: 1.67em;
6561
6582
  }
6583
+ .editor-root.mobile [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-action-bar,
6562
6584
  .editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-action-bar,
6563
6585
  .editor-content.dragging [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-action-bar {
6564
6586
  display: none;
6565
6587
  user-select: none;
6566
6588
  pointer-events: none;
6567
6589
  }
6590
+ .editor-root.mobile [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-separator,
6568
6591
  .editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-separator,
6569
6592
  .editor-content.dragging [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-separator {
6570
6593
  opacity: 0;
@@ -7470,7 +7493,10 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-embe
7470
7493
  justify-content: center;
7471
7494
  max-width: 100%;
7472
7495
  }
7473
- .embed-block[data-embed-type=video] > div[data-type=block-content] .media.full-screen, .embed-block[data-embed-type=audio] > div[data-type=block-content] .media.full-screen {
7496
+ .embed-block[data-embed-type=video] > div[data-type=block-content].full-screen, .embed-block[data-embed-type=audio] > div[data-type=block-content].full-screen {
7497
+ width: 100%;
7498
+ }
7499
+ .embed-block[data-embed-type=video] > div[data-type=block-content] .media, .embed-block[data-embed-type=audio] > div[data-type=block-content] .media {
7474
7500
  width: 100%;
7475
7501
  }
7476
7502
  .embed-block[data-embed-type=video] > div[data-type=block-content] .media, .embed-block[data-embed-type=audio] > div[data-type=block-content] .media {
@@ -11220,11 +11246,29 @@ var __publicField = (obj, key, value) => {
11220
11246
  function ensureIsMobileEvent(events2) {
11221
11247
  return events2 instanceof TouchEvent;
11222
11248
  }
11249
+ function bindDbClick(elem, handler) {
11250
+ let touchTime = 0;
11251
+ const callback = (event) => {
11252
+ if (touchTime === 0) {
11253
+ touchTime = new Date().getTime();
11254
+ } else {
11255
+ if (new Date().getTime() - touchTime < 800) {
11256
+ handler(event);
11257
+ }
11258
+ touchTime = 0;
11259
+ }
11260
+ };
11261
+ elem.addEventListener("click", callback);
11262
+ return () => {
11263
+ elem.removeEventListener("click", callback);
11264
+ };
11265
+ }
11223
11266
  class RootContainer {
11224
11267
  constructor(editor, rootContainer) {
11225
11268
  __publicField(this, "resizeObserver");
11226
11269
  __publicField(this, "isMoved", false);
11227
11270
  __publicField(this, "mouseDownEvent", null);
11271
+ __publicField(this, "dbClickRef", null);
11228
11272
  __publicField(this, "handleContextMenu", (event) => {
11229
11273
  if (clientType.isSafari) {
11230
11274
  const sel = document.getSelection();
@@ -11373,7 +11417,11 @@ var __publicField = (obj, key, value) => {
11373
11417
  container.oncontextmenu = this.handleContextMenu;
11374
11418
  container.onclick = this.handleClick;
11375
11419
  }
11376
- container.ondblclick = this.handleDblClick;
11420
+ if (clientType.isIOS) {
11421
+ this.dbClickRef = bindDbClick(container, this.handleDblClick);
11422
+ } else {
11423
+ container.ondblclick = this.handleDblClick;
11424
+ }
11377
11425
  }
11378
11426
  unbindEvents() {
11379
11427
  this.resizeObserver.disconnect();
@@ -11382,6 +11430,10 @@ var __publicField = (obj, key, value) => {
11382
11430
  container.ondblclick = null;
11383
11431
  container.onclick = null;
11384
11432
  container.oncontextmenu = null;
11433
+ if (this.dbClickRef) {
11434
+ this.dbClickRef();
11435
+ this.dbClickRef = null;
11436
+ }
11385
11437
  }
11386
11438
  destroy() {
11387
11439
  this.unbindEvents();
@@ -41335,10 +41387,10 @@ ${codeText}
41335
41387
  this.element.addEventListener("click", this.handleButtonClick);
41336
41388
  const color = Number.parseInt(editor.settingsProvider.getItem(`${storageName}-color`) || "", 10);
41337
41389
  const backgroundColor = Number.parseInt(editor.settingsProvider.getItem(`${storageName}-backgroundColor`) || "", 10);
41338
- if (color && !Number.isNaN(color)) {
41390
+ if (!Number.isNaN(color)) {
41339
41391
  this.latestColors[0] = color;
41340
41392
  }
41341
- if (backgroundColor && !Number.isNaN(backgroundColor)) {
41393
+ if (!Number.isNaN(backgroundColor)) {
41342
41394
  this.latestColors[1] = backgroundColor;
41343
41395
  }
41344
41396
  this.updateButtonColor(this.latestColors);
@@ -46820,8 +46872,8 @@ ${codeText}
46820
46872
  const pasteItem = {
46821
46873
  id: "paste",
46822
46874
  name: i18n$1.t("commands.paste"),
46823
- icon: PasteSpecialIcon,
46824
- states: this.canPaste() ? [] : ["disabled"]
46875
+ element: this.createPasteElement(editor),
46876
+ states: []
46825
46877
  };
46826
46878
  const items = [cutItem, copyItem];
46827
46879
  if (this.options.withPaste) {
@@ -46886,23 +46938,45 @@ ${codeText}
46886
46938
  };
46887
46939
  }
46888
46940
  }
46889
- canPaste() {
46941
+ async canPaste() {
46890
46942
  const hasReadPermission = this.hasClipboardReadPermission;
46891
46943
  let clipboardEmpty;
46892
46944
  if (isFirefox() || isSafari()) {
46893
46945
  clipboardEmpty = true;
46894
46946
  } else {
46895
- clipboardEmpty = hasReadPermission;
46947
+ clipboardEmpty = hasReadPermission ? await isClipboardEmpty$1() : false;
46896
46948
  }
46897
46949
  return this.isSecureContext && this.clipboardPermission.read !== "denied" && !clipboardEmpty;
46898
46950
  }
46951
+ createPasteElement(editor) {
46952
+ const pasteItemElement = createElement("div", ["command-item-paste"], null);
46953
+ pasteItemElement.textContent = i18n$1.t("commands.paste");
46954
+ this.canPaste().then((canPaste) => {
46955
+ if (!canPaste) {
46956
+ pasteItemElement.classList.add("disabled");
46957
+ }
46958
+ });
46959
+ pasteItemElement.addEventListener("click", () => {
46960
+ if (pasteItemElement.classList.contains("disabled")) {
46961
+ return;
46962
+ }
46963
+ getClipboardData$1().then((clipboardData) => {
46964
+ const event = new ClipboardEvent("paste", {
46965
+ clipboardData,
46966
+ bubbles: true
46967
+ });
46968
+ editor.input.inputElement.dispatchEvent(event);
46969
+ });
46970
+ });
46971
+ return pasteItemElement;
46972
+ }
46899
46973
  copyRange(editor, range) {
46900
46974
  const selectedBlocks = range.getSelectedBlocks();
46901
46975
  const docs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
46902
46976
  const doc2 = mergeDocs(docs);
46903
46977
  editorCopyDoc(editor, doc2);
46904
46978
  }
46905
- executeCommand(editor, block, range, command) {
46979
+ executeRangeCommand(editor, range, command) {
46906
46980
  if (command.id === "copy") {
46907
46981
  this.copyRange(editor, range);
46908
46982
  return true;
@@ -46912,16 +46986,6 @@ ${codeText}
46912
46986
  editorClearSelectedContents(editor, range);
46913
46987
  return true;
46914
46988
  }
46915
- if (command.id === "paste") {
46916
- getClipboardData$1().then((clipboardData) => {
46917
- const event = new ClipboardEvent("paste", {
46918
- clipboardData,
46919
- bubbles: true
46920
- });
46921
- editor.input.inputElement.dispatchEvent(event);
46922
- });
46923
- return true;
46924
- }
46925
46989
  return false;
46926
46990
  }
46927
46991
  }
@@ -46946,11 +47010,14 @@ ${codeText}
46946
47010
  return items;
46947
47011
  }
46948
47012
  executeCommand(editor, block, box, item) {
46949
- var _a;
47013
+ var _a, _b;
46950
47014
  const { start, end } = getChildOffset(block, box);
46951
47015
  const range = createBlockSimpleRange(editor, block, start, end);
46952
47016
  for (const provider of this.providers) {
46953
- if ((_a = provider.executeCommand) == null ? void 0 : _a.call(provider, editor, block, range, item, {})) {
47017
+ if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
47018
+ return;
47019
+ }
47020
+ if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
46954
47021
  return;
46955
47022
  }
46956
47023
  }
@@ -50350,6 +50417,9 @@ ${codeText}
50350
50417
  this.editor = editor;
50351
50418
  }
50352
50419
  isChecked(blockData, id) {
50420
+ if (!blockData.align && id === "left") {
50421
+ return true;
50422
+ }
50353
50423
  if (blockData.align === id) {
50354
50424
  return true;
50355
50425
  }
@@ -50582,7 +50652,7 @@ ${codeText}
50582
50652
  this.provider.executeCommand(editor, block, editor.selection.range, item, { child });
50583
50653
  const { start, end } = getChildOffset(block, child);
50584
50654
  const range = createBlockSimpleRange(editor, block, start, end);
50585
- this.clipboardProvider.executeCommand(editor, block, range, item);
50655
+ this.clipboardProvider.executeRangeCommand(editor, range, item);
50586
50656
  });
50587
50657
  this.editor = editor;
50588
50658
  this.clipboardProvider = new ClipboardProvider(this.editor, { withPaste: true });
@@ -50690,7 +50760,7 @@ ${codeText}
50690
50760
  this._lastClickTime = Date.now();
50691
50761
  });
50692
50762
  __publicField(this, "handleClose", () => {
50693
- if (shouldFocusToEditor(this.editor)) {
50763
+ if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
50694
50764
  this.editor.focus({
50695
50765
  preventScroll: true
50696
50766
  });
@@ -63044,66 +63114,45 @@ ${codeText}
63044
63114
  }
63045
63115
  return true;
63046
63116
  }
63047
- function getBlockPlaceholder(editor, options) {
63048
- var _a, _b, _c;
63049
- const block = editor.selection.focusedBlock;
63050
- const blockType = getBlockType(block);
63051
- const defaultPlaceholder = options.contentPlaceholder || i18n$1.t("placeholder.default");
63052
- let placeholder2 = clientType.isMobile ? "" : defaultPlaceholder;
63053
- if (blockType && isTextKindBlockType(editor, blockType)) {
63054
- if (block) {
63055
- if (!editor.isBlockWritable(block)) {
63056
- return "";
63057
- }
63058
- if (isCodeLineBlock(block)) {
63059
- return "";
63060
- }
63061
- if (isChildBlock(block) && !clientType.isMobile) {
63062
- const parentContainerBlock = getParentBlock(getParentContainer(block));
63063
- if (!parentContainerBlock || !((_b = (_a = getBlockClass(editor, parentContainerBlock)).getOptions) == null ? void 0 : _b.call(_a, editor).isMenuButtonBaseContainer)) {
63064
- placeholder2 = i18n$1.t("placeholder.common.contentInTable");
63065
- }
63066
- if (parentContainerBlock && getBlockType(parentContainerBlock) === "callout") {
63067
- placeholder2 = i18n$1.t("placeholder.common.contentInCallout");
63068
- }
63069
- }
63070
- placeholder2 = (_c = getTextKindBlockPlaceholder(block)) != null ? _c : placeholder2;
63071
- }
63072
- }
63073
- return placeholder2;
63074
- }
63075
63117
  function applyContentPlaceholder(editor, options) {
63076
- var _a;
63077
- const blockPlaceholder = getBlockPlaceholder(editor, options);
63118
+ var _a, _b, _c;
63119
+ let targetBlock = editor.selection.focusedBlock;
63120
+ let placeholder2 = options.contentPlaceholder || i18n$1.t("placeholder.default");
63078
63121
  const titleBlock = editor.getFirstBlock();
63079
63122
  const firstContentBlock = options.hideTitle ? titleBlock : getNextBlock(titleBlock);
63080
63123
  if (!firstContentBlock) {
63081
63124
  return;
63082
63125
  }
63083
63126
  const secondContentBlock = getNextBlock(firstContentBlock);
63084
- if (secondContentBlock) {
63085
- if (!options.addPlaceholderToAllCurrentEmptyBlock) {
63086
- return;
63087
- }
63127
+ if (secondContentBlock && !options.addPlaceholderToAllCurrentEmptyBlock) {
63128
+ return;
63088
63129
  }
63089
63130
  if (!secondContentBlock) {
63090
- if (isEmptyTextBlockWithoutCompositionText(editor, firstContentBlock)) {
63091
- applyPlaceholderToBlock(
63092
- editor,
63093
- firstContentBlock,
63094
- (_a = getTextKindBlockPlaceholder(firstContentBlock)) != null ? _a : blockPlaceholder
63095
- );
63096
- return;
63097
- }
63131
+ targetBlock = firstContentBlock;
63098
63132
  }
63099
- const focusedBlock = editor.getFocusedBlock();
63100
- if (!isEmptyTextBlockWithoutCompositionText(editor, focusedBlock)) {
63133
+ if (!isEmptyTextBlockWithoutCompositionText(editor, targetBlock)) {
63134
+ return;
63135
+ }
63136
+ if (!editor.isBlockWritable(targetBlock)) {
63101
63137
  return;
63102
63138
  }
63103
- if (focusedBlock === titleBlock && !options.hideTitle) {
63139
+ if (isCodeLineBlock(targetBlock)) {
63104
63140
  return;
63105
63141
  }
63106
- applyPlaceholderToBlock(editor, focusedBlock, blockPlaceholder);
63142
+ if (targetBlock === titleBlock && !options.hideTitle) {
63143
+ return;
63144
+ }
63145
+ if (isChildBlock(targetBlock)) {
63146
+ const parentContainerBlock = getParentBlock(getParentContainer(targetBlock));
63147
+ if (!parentContainerBlock || !((_b = (_a = getBlockClass(editor, parentContainerBlock)).getOptions) == null ? void 0 : _b.call(_a, editor).isMenuButtonBaseContainer)) {
63148
+ placeholder2 = i18n$1.t("placeholder.common.contentInContainer");
63149
+ }
63150
+ }
63151
+ if (clientType.isMobile) {
63152
+ placeholder2 = "";
63153
+ }
63154
+ placeholder2 = (_c = getTextKindBlockPlaceholder(targetBlock)) != null ? _c : placeholder2;
63155
+ applyPlaceholderToBlock(editor, targetBlock, placeholder2);
63107
63156
  }
63108
63157
  function applyTitlePlaceholder(editor, options) {
63109
63158
  var _a, _b;
@@ -69501,7 +69550,7 @@ ${codeText}
69501
69550
  scrollContainer.init({
69502
69551
  parentElement: content,
69503
69552
  childElement: tableContent,
69504
- safeRightSpace: 50,
69553
+ safeRightSpace: clientType.isMobile ? 20 : 50,
69505
69554
  safeLeftSpace: 40,
69506
69555
  parentContainer: isRootContainer(container) || !containerScrollable ? editor.scrollContainer : container,
69507
69556
  locatingContainer: isRootContainer(container) ? (options == null ? void 0 : options.locatingContainer) || editor.parent : container,
@@ -78719,7 +78768,7 @@ ${content}
78719
78768
  __publicField(this, "createMobileCommandItem", (items) => {
78720
78769
  this.mobileWrap = createElement("div", ["mobile-item-wrap"], null);
78721
78770
  const content = createElement("div", ["mobile-item-content"], null);
78722
- const clientHeight = this.editor.rootContainer.clientHeight;
78771
+ const clientHeight = this.editor.scrollContainer.clientHeight;
78723
78772
  content.style.maxHeight = `${clientHeight - 180}px`;
78724
78773
  const icon = createElement("div", ["editor-input-icon"], null);
78725
78774
  icon.innerHTML = SearchIcon;
@@ -78735,6 +78784,10 @@ ${content}
78735
78784
  this.mobileWrap.appendChild(content);
78736
78785
  this.createMobileItems(content, items, "");
78737
78786
  this.mobileWrap.addEventListener("click", this.handleMobileWrapClick);
78787
+ content.addEventListener("scroll", () => {
78788
+ var _a;
78789
+ return (_a = document.activeElement) == null ? void 0 : _a.blur();
78790
+ });
78738
78791
  return [{
78739
78792
  id: "create-mobile-item",
78740
78793
  name: "Create Mobile Item",
@@ -79890,10 +79943,10 @@ ${content}
79890
79943
  const endToolsRect = endBlock.getBoundingClientRect();
79891
79944
  const startGripperHeight = startRect.height + HANDLE_CIRCLE_SIZE;
79892
79945
  const endGripperHeight = endRect.height + HANDLE_CIRCLE_SIZE;
79893
- const startX = startRect.left - startToolsRect.left - HANDLE_WIDTH / 2;
79894
- const startY = startRect.top - startToolsRect.top - HANDLE_CIRCLE_SIZE;
79895
- const endX = endRect.left - endToolsRect.left - HANDLE_WIDTH / 2;
79896
- const endY = endRect.top - endToolsRect.top;
79946
+ const startX = startRect.left - startToolsRect.left - startBlock.clientLeft - HANDLE_WIDTH / 2;
79947
+ const startY = startRect.top - startToolsRect.top - startBlock.clientTop - HANDLE_CIRCLE_SIZE;
79948
+ const endX = endRect.left - endToolsRect.left - endBlock.clientLeft - HANDLE_WIDTH / 2;
79949
+ const endY = endRect.top - endToolsRect.top - endBlock.clientTop;
79897
79950
  this.startGripper.style.left = `${startX}px`;
79898
79951
  this.startGripper.style.top = `${startY}px`;
79899
79952
  this.endGripper.style.left = `${endX}px`;
@@ -80009,14 +80062,14 @@ ${content}
80009
80062
  class CursorToolbarHandler {
80010
80063
  constructor(editor) {
80011
80064
  __publicField(this, "toolbar");
80065
+ __publicField(this, "clipboardProvider");
80012
80066
  __publicField(this, "handleButtonClick", (toolbar2, item) => {
80013
- const focusBlock = this.editor.selection.focusedBlock;
80014
80067
  const range = this.editor.selection.range;
80015
80068
  if (item.id === "select") {
80016
80069
  editorSelectWord(this.editor);
80017
80070
  }
80018
80071
  if (item.id === "paste") {
80019
- new ClipboardProvider(this.editor, { withPaste: true }).executeCommand(this.editor, focusBlock, range, item);
80072
+ this.clipboardProvider.executeRangeCommand(this.editor, range, item);
80020
80073
  }
80021
80074
  });
80022
80075
  __publicField(this, "handleSelectionChange", () => {
@@ -80025,7 +80078,7 @@ ${content}
80025
80078
  __publicField(this, "getCommands", () => {
80026
80079
  const commands = [{ id: "select", name: i18n$1.t("mobile.commands.select") }];
80027
80080
  const focusBlock = this.editor.selection.focusedBlock;
80028
- const clipboardCommands = new ClipboardProvider(this.editor, { withPaste: true }).getAvailableCommands(this.editor, focusBlock);
80081
+ const clipboardCommands = this.clipboardProvider.getAvailableCommands(this.editor, focusBlock);
80029
80082
  clipboardCommands.filter((cmd) => cmd.id === "paste").forEach((cmd) => commands.push(cmd));
80030
80083
  return groupEachCommand(commands);
80031
80084
  });
@@ -80054,6 +80107,7 @@ ${content}
80054
80107
  });
80055
80108
  this.toolbar.on("click", this.handleButtonClick);
80056
80109
  this.editor.addListener("selectionChanged", this.handleSelectionChange);
80110
+ this.clipboardProvider = new ClipboardProvider(this.editor, { withPaste: true });
80057
80111
  }
80058
80112
  destroy() {
80059
80113
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
@@ -80137,7 +80191,7 @@ ${content}
80137
80191
  ];
80138
80192
  });
80139
80193
  this.editor = editor;
80140
- this.providers = [new HeadingProvider(editor)];
80194
+ this.providers = [new HeadingProvider(editor, { withPlainText: true })];
80141
80195
  }
80142
80196
  }
80143
80197
  class TabProvider {
@@ -80353,6 +80407,7 @@ ${content}
80353
80407
  destroy() {
80354
80408
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
80355
80409
  this.mobileToolbar.destroy();
80410
+ this.bar.remove();
80356
80411
  }
80357
80412
  }
80358
80413
  class ActiveElementObserver {
@@ -80381,10 +80436,11 @@ ${content}
80381
80436
  __publicField(this, "observer");
80382
80437
  __publicField(this, "showKeyboard", false);
80383
80438
  __publicField(this, "initViewportHeight", this.window.visualViewport.height);
80439
+ __publicField(this, "toggleDelay", clientType.isSafari ? 800 : 100);
80384
80440
  __publicField(this, "toggle", debounce__default.default(() => {
80385
80441
  const offsetHeight = Math.max(this.clientHeight - this.virtualViewportHeight, 0);
80386
80442
  this.commandBar.bar.style.bottom = `${offsetHeight}px`;
80387
- }, 100));
80443
+ }, this.toggleDelay));
80388
80444
  __publicField(this, "handleFocusIn", () => {
80389
80445
  if (!this.showKeyboard) {
80390
80446
  this.showKeyboard = true;
@@ -80473,6 +80529,39 @@ ${content}
80473
80529
  "en-US": enUS$8,
80474
80530
  "ja-JP": jaJP$8
80475
80531
  });
80532
+ class MobileEmbedMask {
80533
+ constructor(editor) {
80534
+ __publicField(this, "addMask", (block) => {
80535
+ const content = getBlockContent(block);
80536
+ addClass(content, "embed-mask");
80537
+ });
80538
+ __publicField(this, "removeMask", (block) => {
80539
+ const content = getBlockContent(block);
80540
+ removeClass(content, "embed-mask");
80541
+ });
80542
+ __publicField(this, "handleSelectionChanged", debounce__default.default(() => {
80543
+ if (this.editor.readonly) {
80544
+ return;
80545
+ }
80546
+ const { start, end } = this.editor.selection.range;
80547
+ this.editor.rootContainer.querySelectorAll("div.embed-block[data-type=editor-block][data-block-type=embed]").forEach((blockElem) => {
80548
+ const block = blockElem;
80549
+ const blockId = getBlockId(block);
80550
+ if (start.blockId === end.blockId && start.blockId === blockId) {
80551
+ this.removeMask(block);
80552
+ return;
80553
+ }
80554
+ this.addMask(block);
80555
+ });
80556
+ }, 400));
80557
+ this.editor = editor;
80558
+ this.editor.addListener("selectionChanged", this.handleSelectionChanged);
80559
+ this.handleSelectionChanged();
80560
+ }
80561
+ destroy() {
80562
+ this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
80563
+ }
80564
+ }
80476
80565
  const LONG_PRESS_DELAY = 800;
80477
80566
  class OnesEditorMobileHelper {
80478
80567
  constructor(editor) {
@@ -80481,9 +80570,10 @@ ${content}
80481
80570
  __publicField(this, "gripper");
80482
80571
  __publicField(this, "cursorToolbar");
80483
80572
  __publicField(this, "isMoving", false);
80484
- __publicField(this, "handleSelectionChange", () => {
80573
+ __publicField(this, "mobileEmbedMask");
80574
+ __publicField(this, "handleSelectionChange", debounce__default.default(() => {
80485
80575
  this.gripper.update();
80486
- });
80576
+ }, 10));
80487
80577
  __publicField(this, "handleLongPress", (event) => {
80488
80578
  const touch = event.touches[0];
80489
80579
  const range = getBlockRangeFromPoint(this.editor, touch.clientX, touch.clientY);
@@ -80554,6 +80644,7 @@ ${content}
80554
80644
  document.addEventListener("touchmove", this.handleTouchMove);
80555
80645
  this.gripper = new SelectionGripper(this.editor);
80556
80646
  this.cursorToolbar = createCursorToolbar(this.editor);
80647
+ this.mobileEmbedMask = new MobileEmbedMask(this.editor);
80557
80648
  }
80558
80649
  destroy() {
80559
80650
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
@@ -80561,6 +80652,9 @@ ${content}
80561
80652
  document.removeEventListener("touchstart", this.handleTouchStart);
80562
80653
  document.removeEventListener("touchend", this.handleTouchEnd);
80563
80654
  document.removeEventListener("touchmove", this.handleTouchMove);
80655
+ this.mobileEmbedMask.destroy();
80656
+ this.cursorToolbar.destroy();
80657
+ this.gripper.destroy();
80564
80658
  }
80565
80659
  }
80566
80660
  function getChildContainers(editor, block, from, to) {
@@ -83572,6 +83666,9 @@ ${content}
83572
83666
  content.style.height = `${embedData.height}px`;
83573
83667
  }
83574
83668
  setTimeout(() => {
83669
+ if (clientType.isMobile) {
83670
+ return;
83671
+ }
83575
83672
  const blockElement = this.editor.getBlockById(id);
83576
83673
  EmbedBlockResizer.register(this.editor, blockElement);
83577
83674
  });
@@ -84609,12 +84706,14 @@ ${data2.flowchartText}
84609
84706
  });
84610
84707
  }
84611
84708
  setFullScreen() {
84612
- assert(logger$8, this.mediaContainer, "The media element not exist");
84613
- addClass(this.mediaContainer, "full-screen");
84709
+ var _a;
84710
+ assert(logger$8, (_a = this.mediaContainer) == null ? void 0 : _a.parentElement, "The media element not exist");
84711
+ addClass(this.mediaContainer.parentElement, "full-screen");
84614
84712
  }
84615
84713
  removeFullScreen() {
84616
- assert(logger$8, this.mediaContainer, "The media element not exist");
84617
- removeClass(this.mediaContainer, "full-screen");
84714
+ var _a;
84715
+ assert(logger$8, (_a = this.mediaContainer) == null ? void 0 : _a.parentElement, "The media element not exist");
84716
+ removeClass(this.mediaContainer.parentElement, "full-screen");
84618
84717
  }
84619
84718
  updateBlockAlign(blockData, content) {
84620
84719
  const block = getParentBlock(content);
@@ -85351,7 +85450,7 @@ ${data2.flowchartText}
85351
85450
  title: "\u8BF7\u8F93\u5165\u6807\u9898",
85352
85451
  readonlyTitle: "\u8BF7\u8F93\u5165\u6807\u9898",
85353
85452
  content: "\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",
85354
- contentInTable: "\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",
85453
+ contentInContainer: "\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",
85355
85454
  contentInCallout: "\u8BF7\u8F93\u5165"
85356
85455
  },
85357
85456
  local: {
@@ -85371,7 +85470,7 @@ ${data2.flowchartText}
85371
85470
  title: "Enter a title",
85372
85471
  readonlyTitle: "Enter a title",
85373
85472
  content: 'Click "+", or enter "/" to insert components quickly',
85374
- contentInTable: 'Enter "/" to insert components quickly',
85473
+ contentInContainer: 'Enter "/" to insert components quickly',
85375
85474
  contentInCallout: "Enter text here"
85376
85475
  },
85377
85476
  local: {
@@ -85391,7 +85490,7 @@ ${data2.flowchartText}
85391
85490
  title: "\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
85392
85491
  readonlyTitle: "\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
85393
85492
  content: "\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",
85394
- contentInTable: "\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",
85493
+ contentInContainer: "\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",
85395
85494
  contentInCallout: "\u5185\u5BB9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"
85396
85495
  },
85397
85496
  local: {
@@ -87617,7 +87716,7 @@ ${data2.flowchartText}
87617
87716
  }
87618
87717
  }
87619
87718
  });
87620
- editor.version = "2.1.7-beta.13";
87719
+ editor.version = "2.1.7-beta.14";
87621
87720
  if (Logger$2.level === LogLevel.DEBUG) {
87622
87721
  window.setReauthFail = (fail) => {
87623
87722
  window.isReauthError = fail;
@@ -87736,7 +87835,7 @@ ${data2.flowchartText}
87736
87835
  }
87737
87836
  }
87738
87837
  OnesEditorToolbar.register(editor);
87739
- editor.version = "2.1.7-beta.13";
87838
+ editor.version = "2.1.7-beta.14";
87740
87839
  return editor;
87741
87840
  }
87742
87841
  async function showDocVersions(editor, options, serverUrl) {
@@ -4,7 +4,7 @@ declare const _default: {
4
4
  title: string;
5
5
  readonlyTitle: string;
6
6
  content: string;
7
- contentInTable: string;
7
+ contentInContainer: string;
8
8
  contentInCallout: string;
9
9
  };
10
10
  local: {
@@ -4,7 +4,7 @@ declare const _default: {
4
4
  title: string;
5
5
  readonlyTitle: string;
6
6
  content: string;
7
- contentInTable: string;
7
+ contentInContainer: string;
8
8
  contentInCallout: string;
9
9
  };
10
10
  local: {
@@ -4,7 +4,7 @@ declare const _default: {
4
4
  title: string;
5
5
  readonlyTitle: string;
6
6
  content: string;
7
- contentInTable: string;
7
+ contentInContainer: string;
8
8
  contentInCallout: string;
9
9
  };
10
10
  local: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.7-beta.13",
3
+ "version": "2.1.7-beta.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",