@ones-editor/editor 2.1.1-beta.42 → 2.1.1-beta.44

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.
@@ -0,0 +1,2 @@
1
+ import { OnesEditor } from '../../../../../@ones-editor/core';
2
+ export declare const isSelectedTitleBlock: (editor: OnesEditor) => boolean;
package/dist/index.js CHANGED
@@ -2809,6 +2809,9 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-
2809
2809
  background-color: #0064ff;
2810
2810
  opacity: 0.1;
2811
2811
  }
2812
+ .editor-root.readonly div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].hover [data-type=block-content] {
2813
+ outline: 1px solid #0064ff;
2814
+ }
2812
2815
  .editor-root.readonly div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image] [data-type=block-content] .images .image-splitter {
2813
2816
  visibility: hidden;
2814
2817
  }
@@ -39869,6 +39872,9 @@ ${codeText}
39869
39872
  if (item.desc) {
39870
39873
  elem.setAttribute(`data-editor-tooltip-desc-${options.tooltipId}`, item.desc);
39871
39874
  }
39875
+ if (item.tooltipPlacement) {
39876
+ elem.setAttribute("data-editor-tooltip-placement", item.tooltipPlacement);
39877
+ }
39872
39878
  }
39873
39879
  const button2 = elem;
39874
39880
  if (!item.element) {
@@ -40828,7 +40834,7 @@ ${codeText}
40828
40834
  __publicField(this, "focus", () => {
40829
40835
  setTimeout(() => {
40830
40836
  this.input.focus();
40831
- });
40837
+ }, 200);
40832
40838
  });
40833
40839
  __publicField(this, "handleKeyDown", (e2, composing) => {
40834
40840
  var _a, _b;
@@ -45914,6 +45920,10 @@ ${codeText}
45914
45920
  applyAlignStyle,
45915
45921
  applyQuoteStyle
45916
45922
  }, Symbol.toStringTag, { value: "Module" }));
45923
+ const isSelectedTitleBlock = (editor) => {
45924
+ const startBlock = editor.selection.startBlock;
45925
+ return isTitleBlock$2(startBlock);
45926
+ };
45917
45927
  function maxHeadingContainDocument() {
45918
45928
  let heading = 8;
45919
45929
  while (heading > 0) {
@@ -45992,7 +46002,7 @@ ${codeText}
45992
46002
  return children;
45993
46003
  }
45994
46004
  getAvailableCommands(editor, block, range, params) {
45995
- const disable = !isTextKindBlock(editor, block) || isTitleBlock$2(block);
46005
+ const disable = !isTextKindBlock(editor, block) || isSelectedTitleBlock(editor);
45996
46006
  if (disable && (params == null ? void 0 : params.isFilter)) {
45997
46007
  return [];
45998
46008
  }
@@ -48631,7 +48641,7 @@ ${codeText}
48631
48641
  return commands;
48632
48642
  }
48633
48643
  getAvailableCommands(editor, block, range, params) {
48634
- const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
48644
+ const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
48635
48645
  if (disabled && (params == null ? void 0 : params.isFilter)) {
48636
48646
  return [];
48637
48647
  }
@@ -48733,7 +48743,7 @@ ${codeText}
48733
48743
  this.editor = editor;
48734
48744
  }
48735
48745
  getAvailableCommands(editor, block, range, params) {
48736
- const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
48746
+ const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
48737
48747
  if (disabled && (params == null ? void 0 : params.isFilter)) {
48738
48748
  return [];
48739
48749
  }
@@ -48957,6 +48967,14 @@ ${codeText}
48957
48967
  const mergedOptions = { ...options, ...userOptions };
48958
48968
  linkEditor.editLink(mergedOptions);
48959
48969
  }
48970
+ const hideToolbar$1 = (editor) => {
48971
+ const toolbar2 = editor.findCustom("toolbar-handler");
48972
+ toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
48973
+ toolbar2 == null ? void 0 : toolbar2.hide();
48974
+ setTimeout(() => {
48975
+ toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
48976
+ }, 300);
48977
+ };
48960
48978
  const logger$1W = getLogger("inline-box-items");
48961
48979
  function insertEmptyBlockLink(editor, containerId, blockIndex) {
48962
48980
  let block = editor.findBlockByIndex(containerId, blockIndex);
@@ -49044,7 +49062,7 @@ ${codeText}
49044
49062
  class LinkProvider {
49045
49063
  constructor(editor) {
49046
49064
  __publicField(this, "id", "LinkProvider");
49047
- __publicField(this, "isDisabled", (editor, block, range) => isSelectBoxOnly(editor) || !editor.selection.range.isSimple() || getAllSelectedBlocks(editor).length > 1 || isTitleBlock$2(block));
49065
+ __publicField(this, "isDisabled", (editor, block, range) => isSelectBoxOnly(editor) || !editor.selection.range.isSimple() || getAllSelectedBlocks(editor).length > 1 || isSelectedTitleBlock(editor));
49048
49066
  __publicField(this, "getAvailableCommands", (editor, block, range, params) => {
49049
49067
  const disabled = this.isDisabled(editor, block, range);
49050
49068
  if (disabled && (params == null ? void 0 : params.isFilter)) {
@@ -49071,6 +49089,7 @@ ${codeText}
49071
49089
  return false;
49072
49090
  }
49073
49091
  if (item.id === "insert-link") {
49092
+ hideToolbar$1(editor);
49074
49093
  if (!isTextKindBlock(editor, block)) {
49075
49094
  let nextBlock = getNextVisibleBlock(block);
49076
49095
  if (!nextBlock) {
@@ -49146,7 +49165,7 @@ ${codeText}
49146
49165
  if (isSelectBoxOnly(this.editor)) {
49147
49166
  return true;
49148
49167
  }
49149
- if (isTitleBlock$2(block)) {
49168
+ if (isSelectedTitleBlock(this.editor)) {
49150
49169
  return true;
49151
49170
  }
49152
49171
  return false;
@@ -58130,7 +58149,7 @@ $$${mathData.mathjaxText}$$
58130
58149
  this.editor = editor;
58131
58150
  }
58132
58151
  getAvailableCommands(editor, block, range, params) {
58133
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58152
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58134
58153
  if (disable && (params == null ? void 0 : params.isFilter)) {
58135
58154
  return [];
58136
58155
  }
@@ -58223,7 +58242,7 @@ $$${mathData.mathjaxText}$$
58223
58242
  return this.editor.getCustom("block-attributes-handler");
58224
58243
  }
58225
58244
  getAvailableCommands(editor, block, range, params) {
58226
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58245
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58227
58246
  if (disable && (params == null ? void 0 : params.isFilter)) {
58228
58247
  return [];
58229
58248
  }
@@ -58275,7 +58294,7 @@ $$${mathData.mathjaxText}$$
58275
58294
  this.editor = editor;
58276
58295
  }
58277
58296
  getAvailableCommands(editor, block, range, params) {
58278
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58297
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58279
58298
  if (disable && (params == null ? void 0 : params.isFilter)) {
58280
58299
  return [];
58281
58300
  }
@@ -58483,8 +58502,12 @@ $$${mathData.mathjaxText}$$
58483
58502
  const blockId = getBlockId(block);
58484
58503
  const attributes = (_a = this.blockAttributesHandler.getEmptyBlockTextAttributes(blockId)) != null ? _a : {};
58485
58504
  return commands.map((item) => {
58505
+ var _a2;
58486
58506
  const value = attributes[item.id];
58487
- const states = value ? ["checked"] : void 0;
58507
+ let states = value ? ["checked"] : void 0;
58508
+ if ((_a2 = item.states) == null ? void 0 : _a2.includes("disabled")) {
58509
+ states = ["disabled"];
58510
+ }
58488
58511
  if (item.children) {
58489
58512
  item.children = this.setCommandsStates(item.children, block);
58490
58513
  }
@@ -58517,7 +58540,7 @@ $$${mathData.mathjaxText}$$
58517
58540
  this.editor = editor;
58518
58541
  }
58519
58542
  getAvailableCommands(editor, block, range, params) {
58520
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58543
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58521
58544
  if (disable && (params == null ? void 0 : params.isFilter)) {
58522
58545
  return [];
58523
58546
  }
@@ -67450,14 +67473,6 @@ ${codeText}
67450
67473
  options.bar.close("clickItem");
67451
67474
  }
67452
67475
  }
67453
- const hideToolbar$1 = (editor) => {
67454
- const toolbar2 = editor.findCustom("toolbar-handler");
67455
- toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
67456
- toolbar2 == null ? void 0 : toolbar2.hide();
67457
- setTimeout(() => {
67458
- toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
67459
- }, 300);
67460
- };
67461
67476
  function closeToolbar(editor) {
67462
67477
  const toolbar2 = getToolbar(editor);
67463
67478
  toolbar2 == null ? void 0 : toolbar2.hide();
@@ -69580,17 +69595,19 @@ ${codeText}
69580
69595
  return true;
69581
69596
  }
69582
69597
  function getTextToolbarReferenceClient$1(editor, complexBlock) {
69598
+ let offset = 0;
69583
69599
  const { selectedColumns } = getTableSelectedRowsAndColumns(editor, complexBlock);
69584
69600
  if (selectedColumns.size > 0) {
69585
69601
  const { fromCol: startCol, toCol: endCol } = getTableSelectionRange(complexBlock, editor.selection.range.start, editor.selection.range.end);
69586
69602
  const grid = TableGrid.fromBlock(complexBlock);
69587
69603
  if (startCol !== 0 || endCol !== grid.colCount - 1) {
69588
- if (!editor.readonly)
69589
- ;
69604
+ if (!editor.readonly) {
69605
+ offset = 60;
69606
+ }
69590
69607
  }
69591
69608
  }
69592
69609
  const clientRect = getClientRects(editor, complexBlock, editor.selection.range)[0];
69593
- return new DOMRect(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
69610
+ return new DOMRect(clientRect.left, clientRect.top + offset, clientRect.width, Math.max(clientRect.height - offset * 2, 0));
69594
69611
  }
69595
69612
  function handleDeleteBlock(editor, block) {
69596
69613
  untrackChildBlockEvent(editor, handleChartDebounceUpdate);
@@ -85045,7 +85062,7 @@ ${data2.flowchartText}
85045
85062
  }
85046
85063
  }
85047
85064
  });
85048
- editor.version = "2.1.1-beta.42";
85065
+ editor.version = "2.1.1-beta.44";
85049
85066
  if (Logger$2.level === LogLevel.DEBUG) {
85050
85067
  window.setReauthFail = (fail) => {
85051
85068
  window.isReauthError = fail;
@@ -85144,7 +85161,7 @@ ${data2.flowchartText}
85144
85161
  });
85145
85162
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
85146
85163
  OnesEditorToolbar.register(editor);
85147
- editor.version = "2.1.1-beta.42";
85164
+ editor.version = "2.1.1-beta.44";
85148
85165
  return editor;
85149
85166
  }
85150
85167
  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.42",
3
+ "version": "2.1.1-beta.44",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",