@ones-editor/editor 2.1.1-beta.41 → 2.1.1-beta.43

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
@@ -39869,6 +39869,9 @@ ${codeText}
39869
39869
  if (item.desc) {
39870
39870
  elem.setAttribute(`data-editor-tooltip-desc-${options.tooltipId}`, item.desc);
39871
39871
  }
39872
+ if (item.tooltipPlacement) {
39873
+ elem.setAttribute("data-editor-tooltip-placement", item.tooltipPlacement);
39874
+ }
39872
39875
  }
39873
39876
  const button2 = elem;
39874
39877
  if (!item.element) {
@@ -40828,7 +40831,7 @@ ${codeText}
40828
40831
  __publicField(this, "focus", () => {
40829
40832
  setTimeout(() => {
40830
40833
  this.input.focus();
40831
- });
40834
+ }, 200);
40832
40835
  });
40833
40836
  __publicField(this, "handleKeyDown", (e2, composing) => {
40834
40837
  var _a, _b;
@@ -45914,6 +45917,10 @@ ${codeText}
45914
45917
  applyAlignStyle,
45915
45918
  applyQuoteStyle
45916
45919
  }, Symbol.toStringTag, { value: "Module" }));
45920
+ const isSelectedTitleBlock = (editor) => {
45921
+ const startBlock = editor.selection.startBlock;
45922
+ return isTitleBlock$2(startBlock);
45923
+ };
45917
45924
  function maxHeadingContainDocument() {
45918
45925
  let heading = 8;
45919
45926
  while (heading > 0) {
@@ -45992,7 +45999,7 @@ ${codeText}
45992
45999
  return children;
45993
46000
  }
45994
46001
  getAvailableCommands(editor, block, range, params) {
45995
- const disable = !isTextKindBlock(editor, block) || isTitleBlock$2(block);
46002
+ const disable = !isTextKindBlock(editor, block) || isSelectedTitleBlock(editor);
45996
46003
  if (disable && (params == null ? void 0 : params.isFilter)) {
45997
46004
  return [];
45998
46005
  }
@@ -48631,7 +48638,7 @@ ${codeText}
48631
48638
  return commands;
48632
48639
  }
48633
48640
  getAvailableCommands(editor, block, range, params) {
48634
- const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
48641
+ const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
48635
48642
  if (disabled && (params == null ? void 0 : params.isFilter)) {
48636
48643
  return [];
48637
48644
  }
@@ -48733,7 +48740,7 @@ ${codeText}
48733
48740
  this.editor = editor;
48734
48741
  }
48735
48742
  getAvailableCommands(editor, block, range, params) {
48736
- const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
48743
+ const disabled = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
48737
48744
  if (disabled && (params == null ? void 0 : params.isFilter)) {
48738
48745
  return [];
48739
48746
  }
@@ -48957,6 +48964,14 @@ ${codeText}
48957
48964
  const mergedOptions = { ...options, ...userOptions };
48958
48965
  linkEditor.editLink(mergedOptions);
48959
48966
  }
48967
+ const hideToolbar$1 = (editor) => {
48968
+ const toolbar2 = editor.findCustom("toolbar-handler");
48969
+ toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
48970
+ toolbar2 == null ? void 0 : toolbar2.hide();
48971
+ setTimeout(() => {
48972
+ toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
48973
+ }, 300);
48974
+ };
48960
48975
  const logger$1W = getLogger("inline-box-items");
48961
48976
  function insertEmptyBlockLink(editor, containerId, blockIndex) {
48962
48977
  let block = editor.findBlockByIndex(containerId, blockIndex);
@@ -49044,7 +49059,7 @@ ${codeText}
49044
49059
  class LinkProvider {
49045
49060
  constructor(editor) {
49046
49061
  __publicField(this, "id", "LinkProvider");
49047
- __publicField(this, "isDisabled", (editor, block, range) => isSelectBoxOnly(editor) || !editor.selection.range.isSimple() || getAllSelectedBlocks(editor).length > 1 || isTitleBlock$2(block));
49062
+ __publicField(this, "isDisabled", (editor, block, range) => isSelectBoxOnly(editor) || !editor.selection.range.isSimple() || getAllSelectedBlocks(editor).length > 1 || isSelectedTitleBlock(editor));
49048
49063
  __publicField(this, "getAvailableCommands", (editor, block, range, params) => {
49049
49064
  const disabled = this.isDisabled(editor, block, range);
49050
49065
  if (disabled && (params == null ? void 0 : params.isFilter)) {
@@ -49071,6 +49086,7 @@ ${codeText}
49071
49086
  return false;
49072
49087
  }
49073
49088
  if (item.id === "insert-link") {
49089
+ hideToolbar$1(editor);
49074
49090
  if (!isTextKindBlock(editor, block)) {
49075
49091
  let nextBlock = getNextVisibleBlock(block);
49076
49092
  if (!nextBlock) {
@@ -49146,7 +49162,7 @@ ${codeText}
49146
49162
  if (isSelectBoxOnly(this.editor)) {
49147
49163
  return true;
49148
49164
  }
49149
- if (isTitleBlock$2(block)) {
49165
+ if (isSelectedTitleBlock(this.editor)) {
49150
49166
  return true;
49151
49167
  }
49152
49168
  return false;
@@ -58130,7 +58146,7 @@ $$${mathData.mathjaxText}$$
58130
58146
  this.editor = editor;
58131
58147
  }
58132
58148
  getAvailableCommands(editor, block, range, params) {
58133
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58149
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58134
58150
  if (disable && (params == null ? void 0 : params.isFilter)) {
58135
58151
  return [];
58136
58152
  }
@@ -58223,7 +58239,7 @@ $$${mathData.mathjaxText}$$
58223
58239
  return this.editor.getCustom("block-attributes-handler");
58224
58240
  }
58225
58241
  getAvailableCommands(editor, block, range, params) {
58226
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58242
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58227
58243
  if (disable && (params == null ? void 0 : params.isFilter)) {
58228
58244
  return [];
58229
58245
  }
@@ -58275,7 +58291,7 @@ $$${mathData.mathjaxText}$$
58275
58291
  this.editor = editor;
58276
58292
  }
58277
58293
  getAvailableCommands(editor, block, range, params) {
58278
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor);
58294
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58279
58295
  if (disable && (params == null ? void 0 : params.isFilter)) {
58280
58296
  return [];
58281
58297
  }
@@ -58483,8 +58499,12 @@ $$${mathData.mathjaxText}$$
58483
58499
  const blockId = getBlockId(block);
58484
58500
  const attributes = (_a = this.blockAttributesHandler.getEmptyBlockTextAttributes(blockId)) != null ? _a : {};
58485
58501
  return commands.map((item) => {
58502
+ var _a2;
58486
58503
  const value = attributes[item.id];
58487
- const states = value ? ["checked"] : void 0;
58504
+ let states = value ? ["checked"] : void 0;
58505
+ if ((_a2 = item.states) == null ? void 0 : _a2.includes("disabled")) {
58506
+ states = ["disabled"];
58507
+ }
58488
58508
  if (item.children) {
58489
58509
  item.children = this.setCommandsStates(item.children, block);
58490
58510
  }
@@ -58517,14 +58537,13 @@ $$${mathData.mathjaxText}$$
58517
58537
  this.editor = editor;
58518
58538
  }
58519
58539
  getAvailableCommands(editor, block, range, params) {
58520
- const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isTitleBlock$2(block);
58540
+ const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
58521
58541
  if (disable && (params == null ? void 0 : params.isFilter)) {
58522
58542
  return [];
58523
58543
  }
58524
58544
  let commands = [{
58525
58545
  id: "style-code",
58526
58546
  name: i18n$1.t("commands.code"),
58527
- states: disable && !(params == null ? void 0 : params.isFilter) ? ["disabled"] : [],
58528
58547
  icon: InlineCodeIcon
58529
58548
  }];
58530
58549
  if (getBlockTextLength$6(editor, block) === 0 || !isTextKindBlock(editor, block)) {
@@ -58533,6 +58552,13 @@ $$${mathData.mathjaxText}$$
58533
58552
  const subText2 = getSubText(editor, block, range);
58534
58553
  commands = getStandardTextStyles(commands, subText2);
58535
58554
  }
58555
+ if (!(params == null ? void 0 : params.isFilter)) {
58556
+ commands.forEach((item) => {
58557
+ if (disable) {
58558
+ item.states = ["disabled"];
58559
+ }
58560
+ });
58561
+ }
58536
58562
  return commands;
58537
58563
  }
58538
58564
  getInsertCommands() {
@@ -67444,14 +67470,6 @@ ${codeText}
67444
67470
  options.bar.close("clickItem");
67445
67471
  }
67446
67472
  }
67447
- const hideToolbar$1 = (editor) => {
67448
- const toolbar2 = editor.findCustom("toolbar-handler");
67449
- toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
67450
- toolbar2 == null ? void 0 : toolbar2.hide();
67451
- setTimeout(() => {
67452
- toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
67453
- }, 300);
67454
- };
67455
67473
  function closeToolbar(editor) {
67456
67474
  const toolbar2 = getToolbar(editor);
67457
67475
  toolbar2 == null ? void 0 : toolbar2.hide();
@@ -69574,17 +69592,19 @@ ${codeText}
69574
69592
  return true;
69575
69593
  }
69576
69594
  function getTextToolbarReferenceClient$1(editor, complexBlock) {
69595
+ let offset = 0;
69577
69596
  const { selectedColumns } = getTableSelectedRowsAndColumns(editor, complexBlock);
69578
69597
  if (selectedColumns.size > 0) {
69579
69598
  const { fromCol: startCol, toCol: endCol } = getTableSelectionRange(complexBlock, editor.selection.range.start, editor.selection.range.end);
69580
69599
  const grid = TableGrid.fromBlock(complexBlock);
69581
69600
  if (startCol !== 0 || endCol !== grid.colCount - 1) {
69582
- if (!editor.readonly)
69583
- ;
69601
+ if (!editor.readonly) {
69602
+ offset = 60;
69603
+ }
69584
69604
  }
69585
69605
  }
69586
69606
  const clientRect = getClientRects(editor, complexBlock, editor.selection.range)[0];
69587
- return new DOMRect(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
69607
+ return new DOMRect(clientRect.left, clientRect.top + offset, clientRect.width, Math.max(clientRect.height - offset * 2, 0));
69588
69608
  }
69589
69609
  function handleDeleteBlock(editor, block) {
69590
69610
  untrackChildBlockEvent(editor, handleChartDebounceUpdate);
@@ -85039,7 +85059,7 @@ ${data2.flowchartText}
85039
85059
  }
85040
85060
  }
85041
85061
  });
85042
- editor.version = "2.1.1-beta.41";
85062
+ editor.version = "2.1.1-beta.43";
85043
85063
  if (Logger$2.level === LogLevel.DEBUG) {
85044
85064
  window.setReauthFail = (fail) => {
85045
85065
  window.isReauthError = fail;
@@ -85138,7 +85158,7 @@ ${data2.flowchartText}
85138
85158
  });
85139
85159
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
85140
85160
  OnesEditorToolbar.register(editor);
85141
- editor.version = "2.1.1-beta.41";
85161
+ editor.version = "2.1.1-beta.43";
85142
85162
  return editor;
85143
85163
  }
85144
85164
  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.41",
3
+ "version": "2.1.1-beta.43",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",