ketcher-react 2.9.0-rc.3 → 2.9.0-rc.4

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.
@@ -2956,7 +2956,7 @@ var templates = templates$1.reduce(function (res, struct, i) {
2956
2956
  var zoomList = [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.7, 2, 2.5, 3, 3.5, 4];
2957
2957
  var zoom = {
2958
2958
  zoom: {
2959
- shortcut: ['Ctrl+Shift+0'],
2959
+ shortcut: ['Mod+Shift+0'],
2960
2960
  selected: function selected(editor) {
2961
2961
  return editor.zoom();
2962
2962
  },
@@ -3010,7 +3010,7 @@ var zoom = {
3010
3010
 
3011
3011
  var openHelpLink = function openHelpLink() {
3012
3012
  var _window$open;
3013
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.9.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3013
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.9.0-rc.4\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3014
3014
  };
3015
3015
  var help = {
3016
3016
  help: {
@@ -10449,8 +10449,8 @@ var AtomTool = function () {
10449
10449
  }
10450
10450
  }
10451
10451
  }, {
10452
- key: "mouseleave",
10453
- value: function mouseleave() {
10452
+ key: "mouseLeaveClientArea",
10453
+ value: function mouseLeaveClientArea() {
10454
10454
  this.editor.hoverIcon.hide();
10455
10455
  }
10456
10456
  }, {
@@ -12223,16 +12223,15 @@ function updateOnlyChangedProperties(atomId, userChangedAtom, molecule) {
12223
12223
  }, {});
12224
12224
  }
12225
12225
  function updateSelectedAtoms(_ref) {
12226
- var selection = _ref.selection,
12226
+ var atoms = _ref.atoms,
12227
12227
  changeAtomPromise = _ref.changeAtomPromise,
12228
12228
  editor = _ref.editor;
12229
12229
  var action = new Action();
12230
12230
  var struct = editor.render.ctab;
12231
12231
  var molecule = struct.molecule;
12232
- if (selection !== null && selection !== void 0 && selection.atoms) {
12233
- var selectionAtoms = selection.atoms;
12232
+ if (atoms) {
12234
12233
  Promise.resolve(changeAtomPromise).then(function (userChangedAtom) {
12235
- selectionAtoms.forEach(function (atomId) {
12234
+ atoms.forEach(function (atomId) {
12236
12235
  var atomWithChangedProperties = updateOnlyChangedProperties(atomId, userChangedAtom, molecule);
12237
12236
  action.mergeWith(fromAtomsAttrs(struct, atomId, atomWithChangedProperties, false));
12238
12237
  });
@@ -12564,7 +12563,7 @@ var SelectTool = function () {
12564
12563
  var atoms = getSelectedAtoms(selection, molecule);
12565
12564
  var changeAtomPromise = editor.event.elementEdit.dispatch(atoms);
12566
12565
  updateSelectedAtoms({
12567
- selection: selection,
12566
+ atoms: (selection === null || selection === void 0 ? void 0 : selection.atoms) || [],
12568
12567
  editor: editor,
12569
12568
  changeAtomPromise: changeAtomPromise
12570
12569
  });
@@ -13142,11 +13141,12 @@ function ownKeys$O(object, enumerableOnly) { var keys = Object.keys(object); if
13142
13141
  function _objectSpread$O(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$O(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$O(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13143
13142
  var PasteTool = function () {
13144
13143
  function PasteTool(editor, struct) {
13144
+ var _struct$functionalGro;
13145
13145
  _classCallCheck(this, PasteTool);
13146
13146
  this.editor = editor;
13147
13147
  this.editor.selection(null);
13148
13148
  this.struct = struct;
13149
- this.isSingleContractedGroup = struct.isSingleGroup() && !struct.functionalGroups.get(0).isExpanded;
13149
+ this.isSingleContractedGroup = struct.isSingleGroup() && !((_struct$functionalGro = struct.functionalGroups.get(0)) !== null && _struct$functionalGro !== void 0 && _struct$functionalGro.isExpanded);
13150
13150
  var rnd = this.editor.render;
13151
13151
  var _rnd$clientArea = rnd.clientArea,
13152
13152
  clientHeight = _rnd$clientArea.clientHeight,
@@ -13177,7 +13177,7 @@ var PasteTool = function () {
13177
13177
  (_this$action = this.action) === null || _this$action === void 0 ? void 0 : _this$action.perform(this.editor.render.ctab);
13178
13178
  }
13179
13179
  var closestGroupItem = this.editor.findItem(event, ['functionalGroups']);
13180
- var closestGroup = this.editor.struct().sgroups.get(closestGroupItem.id);
13180
+ var closestGroup = this.editor.struct().sgroups.get(closestGroupItem === null || closestGroupItem === void 0 ? void 0 : closestGroupItem.id);
13181
13181
  if (!closestGroupItem || SGroup$1.isSaltOrSolvent(closestGroup === null || closestGroup === void 0 ? void 0 : closestGroup.data.name)) {
13182
13182
  var _fromPaste3 = fromPaste(this.editor.render.ctab, this.struct, this.editor.render.page2obj(event)),
13183
13183
  _fromPaste4 = _slicedToArray(_fromPaste3, 1),
@@ -13229,7 +13229,9 @@ var PasteTool = function () {
13229
13229
  _action = _fromPaste6[0],
13230
13230
  pasteItems = _fromPaste6[1];
13231
13231
  this.action = _action;
13232
- this.editor.update(this.action, true);
13232
+ this.editor.update(this.action, true, {
13233
+ extendCanvas: false
13234
+ });
13233
13235
  this.mergeItems = getMergeItems(this.editor, pasteItems);
13234
13236
  this.editor.hover(getHoverToFuse(this.mergeItems));
13235
13237
  }
@@ -14203,7 +14205,9 @@ var TemplateTool = function () {
14203
14205
  followAction = _fromPaste2[0],
14204
14206
  _pasteItems = _fromPaste2[1];
14205
14207
  this.followAction = followAction;
14206
- this.editor.update(followAction, true);
14208
+ this.editor.update(followAction, true, {
14209
+ extendCanvas: false
14210
+ });
14207
14211
  if (this.mode === 'fg') {
14208
14212
  var skip = getIgnoredGroupItem(this.editor.struct(), _pasteItems);
14209
14213
  var _ci = this.editor.findItem(event, this.findItems, skip);
@@ -14381,7 +14385,7 @@ var TemplateTool = function () {
14381
14385
  } else {
14382
14386
  angle = 0;
14383
14387
  }
14384
- var _fromTemplateOnAtom3 = fromTemplateOnAtom(restruct, this.template, ci.id, angle, this.mode === 'fg');
14388
+ var _fromTemplateOnAtom3 = fromTemplateOnAtom(restruct, this.template, ci.id, angle, false);
14385
14389
  var _fromTemplateOnAtom4 = _slicedToArray(_fromTemplateOnAtom3, 2);
14386
14390
  action = _fromTemplateOnAtom4[0];
14387
14391
  pasteItems = _fromTemplateOnAtom4[1];
@@ -14676,7 +14680,7 @@ function handleAtomPropsDialog(_ref3) {
14676
14680
  var atoms = getSelectedAtoms(selection, restruct.molecule);
14677
14681
  var changeAtomPromise = editor.event.elementEdit.dispatch(atoms);
14678
14682
  updateSelectedAtoms({
14679
- selection: selection,
14683
+ atoms: selection.atoms || [],
14680
14684
  editor: editor,
14681
14685
  changeAtomPromise: changeAtomPromise
14682
14686
  });
@@ -16183,8 +16187,11 @@ var Editor$3 = function () {
16183
16187
  }, {
16184
16188
  key: "update",
16185
16189
  value: function update(action, ignoreHistory) {
16190
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
16191
+ extendCanvas: true
16192
+ };
16186
16193
  if (action === true) {
16187
- this.render.update(true);
16194
+ this.render.update(true, null, options);
16188
16195
  } else {
16189
16196
  if (!ignoreHistory && !action.isDummy()) {
16190
16197
  this.historyStack.splice(this.historyPtr, HISTORY_SIZE + 1, action);
@@ -16194,7 +16201,7 @@ var Editor$3 = function () {
16194
16201
  this.historyPtr = this.historyStack.length;
16195
16202
  this.event.change.dispatch(action);
16196
16203
  }
16197
- this.render.update();
16204
+ this.render.update(false, null, options);
16198
16205
  }
16199
16206
  }
16200
16207
  }, {
@@ -16572,9 +16579,7 @@ var useAtomEdit = function useAtomEdit() {
16572
16579
  atoms = mapAtomIdsToAtoms(atomIds, molecule);
16573
16580
  newAtom = editor.event.elementEdit.dispatch(atoms);
16574
16581
  updateSelectedAtoms({
16575
- selection: {
16576
- atoms: atoms
16577
- },
16582
+ atoms: atomIds,
16578
16583
  changeAtomPromise: newAtom,
16579
16584
  editor: editor
16580
16585
  });
@@ -17138,6 +17143,9 @@ var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
17138
17143
  var selection = editor.selection();
17139
17144
  var functionalGroupsInSelection = getSelectedFunctionalGroups();
17140
17145
  var showProps = null;
17146
+ if (selection && !selection.bonds && !selection.atoms) {
17147
+ return;
17148
+ }
17141
17149
  if (selection) {
17142
17150
  if (functionalGroupsInSelection.size > 0) {
17143
17151
  var functionalGroups = Array.from(functionalGroupsInSelection.values());
@@ -17332,6 +17340,9 @@ function getPanelPositionRelativeToRect(clientX, clientY, sGroup, render, width,
17332
17340
  var viewportLeftLimit = BAR_PANEL_SIZE * LEFT_PADDING_MULTIPLIER + width;
17333
17341
  var viewportBottomLimit = (render === null || render === void 0 ? void 0 : (_render$clientArea = render.clientArea) === null || _render$clientArea === void 0 ? void 0 : _render$clientArea.clientHeight) - BAR_PANEL_SIZE - height;
17334
17342
  var viewportRightLimit = (render === null || render === void 0 ? void 0 : (_render$clientArea2 = render.clientArea) === null || _render$clientArea2 === void 0 ? void 0 : _render$clientArea2.clientWidth) - BAR_PANEL_SIZE - width;
17343
+ if (!sGroup.hovering) {
17344
+ return null;
17345
+ }
17335
17346
  var rectCoords = (_sGroup$hovering$attr = sGroup.hovering.attrs) === null || _sGroup$hovering$attr === void 0 ? void 0 : (_sGroup$hovering$attr2 = _sGroup$hovering$attr.path) === null || _sGroup$hovering$attr2 === void 0 ? void 0 : _sGroup$hovering$attr2.map(function (line) {
17336
17347
  return line.slice(1);
17337
17348
  });
@@ -24004,8 +24015,8 @@ var KetcherBuilder = function () {
24004
24015
  initApp(element, staticResourcesUrl, {
24005
24016
  buttons: buttons || {},
24006
24017
  errorHandler: errorHandler || null,
24007
- version: "2.9.0-rc.3" ,
24008
- buildDate: "2023-03-11T13:55:42" ,
24018
+ version: "2.9.0-rc.4" ,
24019
+ buildDate: "2023-03-20T17:32:42" ,
24009
24020
  buildNumber: ''
24010
24021
  }, structService, resolve);
24011
24022
  });