ketcher-react 2.15.0-rc.1 → 2.15.0-rc.2

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
@@ -3264,7 +3264,7 @@ var zoom = {
3264
3264
 
3265
3265
  var openHelpLink = function openHelpLink() {
3266
3266
  var _window$open;
3267
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.15.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3267
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.15.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3268
3268
  };
3269
3269
  var help = {
3270
3270
  help: {
@@ -22590,35 +22590,45 @@ var useDelete$1 = function useDelete() {
22590
22590
  return handler;
22591
22591
  };
22592
22592
 
22593
+ var getAtomIdByProps = function getAtomIdByProps(props, ketcher) {
22594
+ var _props$atomIds, _props$rgroupAttachme;
22595
+ var editor = ketcher.editor;
22596
+ var restruct = editor.render.ctab;
22597
+ var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds = props.atomIds) === null || _props$atomIds === void 0 ? void 0 : _props$atomIds[0];
22598
+ if (atomId != null) {
22599
+ return atomId;
22600
+ }
22601
+ var attachmentPointId = props === null || props === void 0 ? void 0 : (_props$rgroupAttachme = props.rgroupAttachmentPoints) === null || _props$rgroupAttachme === void 0 ? void 0 : _props$rgroupAttachme[0];
22602
+ assert_1(attachmentPointId != null);
22603
+ var attachmentPoint = restruct.molecule.rgroupAttachmentPoints.get(attachmentPointId);
22604
+ assert_1(attachmentPoint != null);
22605
+ return attachmentPoint.atomId;
22606
+ };
22593
22607
  var useRGroupAttachmentPointEdit = function useRGroupAttachmentPointEdit() {
22594
22608
  var _useAppContext = useAppContext(),
22595
22609
  getKetcherInstance = _useAppContext.getKetcherInstance;
22596
22610
  var handler = React.useCallback(function (_ref) {
22597
- var _props$atomIds;
22598
22611
  var props = _ref.props;
22599
- var editor = getKetcherInstance().editor;
22600
- var restruct = editor.render.ctab;
22601
- var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds = props.atomIds) === null || _props$atomIds === void 0 ? void 0 : _props$atomIds[0];
22602
- assert_1(atomId != null);
22612
+ var ketcher = getKetcherInstance();
22613
+ var restruct = ketcher.editor.render.ctab;
22614
+ var atomId = getAtomIdByProps(props, ketcher);
22603
22615
  var atom = restruct.molecule.atoms.get(atomId);
22604
22616
  assert_1(atom != null);
22605
- editRGroupAttachmentPoint(editor, atom, atomId);
22617
+ editRGroupAttachmentPoint(ketcher.editor, atom, atomId);
22606
22618
  }, [getKetcherInstance]);
22607
22619
  var disabled = React.useCallback(function (_ref2) {
22608
- var _props$atomIds2;
22609
22620
  var props = _ref2.props;
22610
- var editor = getKetcherInstance().editor;
22611
- var restruct = editor.render.ctab;
22612
- var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds2 = props.atomIds) === null || _props$atomIds2 === void 0 ? void 0 : _props$atomIds2[0];
22613
- assert_1(atomId != null);
22621
+ var ketcher = getKetcherInstance();
22622
+ var restruct = ketcher.editor.render.ctab;
22623
+ var atomId = getAtomIdByProps(props, ketcher);
22614
22624
  var atom = restruct.molecule.atoms.get(atomId);
22615
22625
  assert_1(atom != null);
22616
22626
  return atom.isRGroupAttachmentPointEditDisabled;
22617
22627
  }, [getKetcherInstance]);
22618
22628
  var hidden = React.useCallback(function (_ref3) {
22619
- var _props$atomIds3;
22629
+ var _props$atomIds2;
22620
22630
  var props = _ref3.props;
22621
- var atomLength = (props === null || props === void 0 ? void 0 : (_props$atomIds3 = props.atomIds) === null || _props$atomIds3 === void 0 ? void 0 : _props$atomIds3.length) || 0;
22631
+ var atomLength = (props === null || props === void 0 ? void 0 : (_props$atomIds2 = props.atomIds) === null || _props$atomIds2 === void 0 ? void 0 : _props$atomIds2.length) || 0;
22622
22632
  return atomLength > 1;
22623
22633
  }, []);
22624
22634
  return [handler, disabled, hidden];
@@ -30687,8 +30697,8 @@ var KetcherBuilder = function () {
30687
30697
  initApp(element, appRoot, staticResourcesUrl, {
30688
30698
  buttons: buttons || {},
30689
30699
  errorHandler: errorHandler || null,
30690
- version: "2.15.0-rc.1" ,
30691
- buildDate: "2023-09-04T11:49:56" ,
30700
+ version: "2.15.0-rc.2" ,
30701
+ buildDate: "2023-09-13T13:57:29" ,
30692
30702
  buildNumber: ''
30693
30703
  }, structService, resolve);
30694
30704
  });