@ones-editor/editor 1.0.2-beta.16 → 1.0.2-beta.17

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.
package/dist/index.js CHANGED
@@ -57275,15 +57275,15 @@ ${codeText}
57275
57275
  canSelectBlock = true;
57276
57276
  }
57277
57277
  if (selection.range.start.isSimple() && selection.range.end.isSimple()) {
57278
- canSelectBlock = selection.range.start.offset > 0;
57278
+ canSelectBlock = selection.range.start.offset > 0 && selection.range.getSelectedBlocks().length === 1;
57279
57279
  }
57280
- const commandItems = [];
57281
- if (canSelectBlock) {
57282
- commandItems.push({
57280
+ const commandItems = [
57281
+ {
57283
57282
  id: "select-block",
57284
- name: this.t("contextMenu.selectBlock")
57285
- });
57286
- }
57283
+ name: this.t("contextMenu.selectBlock"),
57284
+ states: canSelectBlock ? [] : ["disabled"]
57285
+ }
57286
+ ];
57287
57287
  commandItems.push({
57288
57288
  id: "select-all",
57289
57289
  name: this.t("contextMenu.selectAll")
@@ -57309,8 +57309,8 @@ ${codeText}
57309
57309
  const { x, y } = event;
57310
57310
  const nextRange = getBlockNearestRangeFromPoint(this.editor, x, y);
57311
57311
  const oldRange = this.editor.selection.range;
57312
- const selectBlocks = oldRange.getSelectedBlocks();
57313
- if (oldRange.focus.blockId !== (nextRange == null ? void 0 : nextRange.focus.blockId) && !(selectBlocks == null ? void 0 : selectBlocks.some((block) => block.block.id !== oldRange.focus.blockId))) {
57312
+ const rangeInSelected = oldRange.getSelectedBlocks().some((selectBlock) => selectBlock.block.id === (nextRange == null ? void 0 : nextRange.focus.blockId));
57313
+ if (oldRange.focus.blockId !== (nextRange == null ? void 0 : nextRange.focus.blockId) && oldRange.focus.isSimple() && !rangeInSelected) {
57314
57314
  this.editor.selectionHandler.handleMouseDown(event, { autoScroll: false });
57315
57315
  }
57316
57316
  });
@@ -65323,7 +65323,11 @@ ${codeText}
65323
65323
  }
65324
65324
  }
65325
65325
  };
65326
- return { ...properties, ...contextMenuProperties, abstract: i18n$1.t("drawio.abstract") };
65326
+ properties.blockCommands = {
65327
+ ...properties.blockCommands,
65328
+ ...contextMenuProperties.blockCommands
65329
+ };
65330
+ return { ...properties, abstract: i18n$1.t("drawio.abstract") };
65327
65331
  }
65328
65332
  const enUS$4 = {
65329
65333
  drawio: {
@@ -71064,15 +71068,18 @@ ${codeText}
71064
71068
  };
71065
71069
  }
71066
71070
  function getGraphEmbedBlockProperties(editor, block, type, properties) {
71067
- const graphBlockCommands = getGraphBlockContextMenuCommands(editor, block, type);
71071
+ const graphBlockContextMenuCommands = getGraphBlockContextMenuCommands(editor, block, type);
71068
71072
  const graphEmbedBlockProperties = {
71069
71073
  blockCommands: {
71070
71074
  "hovering-toolbar": new GraphBlockCommands(editor, block, type, properties)
71071
71075
  },
71072
71076
  abstract: lodash.exports.capitalize(type)
71073
71077
  };
71074
- if (graphBlockCommands) {
71075
- return { ...graphEmbedBlockProperties, ...graphBlockCommands };
71078
+ if (graphBlockContextMenuCommands) {
71079
+ graphEmbedBlockProperties.blockCommands = {
71080
+ ...graphEmbedBlockProperties.blockCommands,
71081
+ ...graphBlockContextMenuCommands.blockCommands
71082
+ };
71076
71083
  }
71077
71084
  return graphEmbedBlockProperties;
71078
71085
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.0.2-beta.16",
3
+ "version": "1.0.2-beta.17",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",