ketcher-react 2.22.0-rc.5 → 2.23.0-rc.1-dev.1

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
@@ -3660,7 +3660,7 @@ var zoom = {
3660
3660
 
3661
3661
  var openHelpLink = function openHelpLink() {
3662
3662
  var _window$open;
3663
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.22.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3663
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.23.0-rc.1-dev.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3664
3664
  };
3665
3665
  var help = {
3666
3666
  help: {
@@ -23664,6 +23664,12 @@ var Editor$3 = function () {
23664
23664
  value: function clearMacromoleculeConvertionError() {
23665
23665
  this.macromoleculeConvertionError = null;
23666
23666
  }
23667
+ }, {
23668
+ key: "focusCliparea",
23669
+ value: function focusCliparea() {
23670
+ var cliparea = document.querySelector('.cliparea');
23671
+ cliparea === null || cliparea === void 0 || cliparea.focus();
23672
+ }
23667
23673
  }]);
23668
23674
  return Editor;
23669
23675
  }();
@@ -23959,7 +23965,8 @@ var useDelete$1 = function useDelete() {
23959
23965
  action = ketcherCore.fromFragmentDeletion(molecule, itemsToDelete);
23960
23966
  editor.update(action);
23961
23967
  editor.selection(null);
23962
- case 7:
23968
+ editor.focusCliparea();
23969
+ case 8:
23963
23970
  case "end":
23964
23971
  return _context.stop();
23965
23972
  }
@@ -24011,7 +24018,7 @@ var useAddAttachmentPoint = function useAddAttachmentPoint() {
24011
24018
  var handler = React.useCallback( function () {
24012
24019
  var _ref2 = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee(_ref) {
24013
24020
  var _props$atomIds;
24014
- var props, editor, restruct, struct, atomId, sgroup, bondAdditionResult, action, addedLeavingGroupAtomId, moleculeAtoms, sgroupAttachmentPoints, lastAttachmentPoint;
24021
+ var props, editor, restruct, struct, atomId, sgroup, bondAdditionResult, action, addedLeavingGroupAtomId, moleculeAtoms, sgroupAttachmentPoints, allPointsNumbers, lastMinimalPointNumber, hasFirstNumber, i, prevNumber, currentNumber;
24015
24022
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
24016
24023
  while (1) switch (_context.prev = _context.next) {
24017
24024
  case 0:
@@ -24034,19 +24041,56 @@ var useAddAttachmentPoint = function useAddAttachmentPoint() {
24034
24041
  });
24035
24042
  action = bondAdditionResult[0];
24036
24043
  addedLeavingGroupAtomId = bondAdditionResult[2];
24037
- if (!sgroup) {
24038
- moleculeAtoms = struct.findConnectedComponent(atomId);
24039
- action.mergeWith(ketcherCore.fromSgroupAddition(restruct, ketcherCore.SGroup.TYPES.SUP, moleculeAtoms, {
24040
- expanded: true
24041
- }, restruct.molecule.sgroups.newId(), [new ketcherCore.SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, 1)]));
24042
- } else {
24043
- sgroupAttachmentPoints = (sgroup === null || sgroup === void 0 ? void 0 : sgroup.getAttachmentPoints()) || [];
24044
- lastAttachmentPoint = sgroupAttachmentPoints[sgroupAttachmentPoints.length - 1];
24045
- action.mergeWith(ketcherCore.fromSgroupAttachmentPointAddition(restruct, sgroup.id, new ketcherCore.SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, (lastAttachmentPoint.attachmentPointNumber || 0) + 1)));
24044
+ if (sgroup) {
24045
+ _context.next = 16;
24046
+ break;
24047
+ }
24048
+ moleculeAtoms = struct.findConnectedComponent(atomId);
24049
+ action.mergeWith(ketcherCore.fromSgroupAddition(restruct, ketcherCore.SGroup.TYPES.SUP, moleculeAtoms, {
24050
+ expanded: true
24051
+ }, restruct.molecule.sgroups.newId(), [new ketcherCore.SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, 1)]));
24052
+ _context.next = 35;
24053
+ break;
24054
+ case 16:
24055
+ sgroupAttachmentPoints = (sgroup === null || sgroup === void 0 ? void 0 : sgroup.getAttachmentPoints()) || [];
24056
+ allPointsNumbers = sgroupAttachmentPoints.map(function (point) {
24057
+ return point.attachmentPointNumber || 0;
24058
+ }).sort();
24059
+ lastMinimalPointNumber = allPointsNumbers[allPointsNumbers.length - 1];
24060
+ hasFirstNumber = allPointsNumbers.includes(1);
24061
+ if (hasFirstNumber) {
24062
+ _context.next = 24;
24063
+ break;
24046
24064
  }
24065
+ lastMinimalPointNumber = 0;
24066
+ _context.next = 34;
24067
+ break;
24068
+ case 24:
24069
+ i = 1;
24070
+ case 25:
24071
+ if (!(i < allPointsNumbers.length)) {
24072
+ _context.next = 34;
24073
+ break;
24074
+ }
24075
+ prevNumber = allPointsNumbers[i - 1];
24076
+ currentNumber = allPointsNumbers[i];
24077
+ if (!(currentNumber > prevNumber + 1)) {
24078
+ _context.next = 31;
24079
+ break;
24080
+ }
24081
+ lastMinimalPointNumber = prevNumber;
24082
+ return _context.abrupt("break", 34);
24083
+ case 31:
24084
+ i++;
24085
+ _context.next = 25;
24086
+ break;
24087
+ case 34:
24088
+ action.mergeWith(ketcherCore.fromSgroupAttachmentPointAddition(restruct, sgroup.id, new ketcherCore.SGroupAttachmentPoint(atomId, addedLeavingGroupAtomId, undefined, lastMinimalPointNumber + 1)));
24089
+ case 35:
24047
24090
  editor.update(action);
24048
24091
  editor.selection(null);
24049
- case 14:
24092
+ editor.focusCliparea();
24093
+ case 38:
24050
24094
  case "end":
24051
24095
  return _context.stop();
24052
24096
  }
@@ -24092,7 +24136,8 @@ var useRemoveAttachmentPoint = function useRemoveAttachmentPoint() {
24092
24136
  action = ketcherCore.fromOneAtomDeletion(restruct, attachmentPointToDelete.leaveAtomId);
24093
24137
  editor.update(action);
24094
24138
  editor.selection(null);
24095
- case 15:
24139
+ editor.focusCliparea();
24140
+ case 16:
24096
24141
  case "end":
24097
24142
  return _context.stop();
24098
24143
  }
@@ -24233,6 +24278,12 @@ var AtomMenuItems = function AtomMenuItems(props) {
24233
24278
  return bond.endSuperatomAttachmentPointNumber === attachmentPoint.attachmentPointNumber || bond.beginSuperatomAttachmentPointNumber === attachmentPoint.attachmentPointNumber;
24234
24279
  }));
24235
24280
  });
24281
+ if (isAtomSuperatomLeavingGroup && onlyOneAtomSelected) {
24282
+ return jsxRuntime.jsx(reactContexify.Item, _objectSpread$M(_objectSpread$M({}, props), {}, {
24283
+ onClick: handleDelete,
24284
+ children: "Delete"
24285
+ }));
24286
+ }
24236
24287
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
24237
24288
  children: [jsxRuntime.jsx(reactContexify.Item, _objectSpread$M(_objectSpread$M({}, props), {}, {
24238
24289
  onClick: handleEdit,
@@ -33002,8 +33053,8 @@ var KetcherBuilder = function () {
33002
33053
  initApp(element, appRoot, staticResourcesUrl, {
33003
33054
  buttons: buttons || {},
33004
33055
  errorHandler: errorHandler || null,
33005
- version: "2.22.0-rc.5" ,
33006
- buildDate: "2024-06-13T16:31:07" ,
33056
+ version: "2.23.0-rc.1-dev.1" ,
33057
+ buildDate: "2024-06-16T11:41:22" ,
33007
33058
  buildNumber: ''
33008
33059
  }, structService, resolve, togglerComponent);
33009
33060
  });