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.
@@ -3201,7 +3201,7 @@ var zoom = {
3201
3201
 
3202
3202
  var openHelpLink = function openHelpLink() {
3203
3203
  var _window$open;
3204
- 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();
3204
+ 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();
3205
3205
  };
3206
3206
  var help = {
3207
3207
  help: {
@@ -22527,35 +22527,45 @@ var useDelete$1 = function useDelete() {
22527
22527
  return handler;
22528
22528
  };
22529
22529
 
22530
+ var getAtomIdByProps = function getAtomIdByProps(props, ketcher) {
22531
+ var _props$atomIds, _props$rgroupAttachme;
22532
+ var editor = ketcher.editor;
22533
+ var restruct = editor.render.ctab;
22534
+ var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds = props.atomIds) === null || _props$atomIds === void 0 ? void 0 : _props$atomIds[0];
22535
+ if (atomId != null) {
22536
+ return atomId;
22537
+ }
22538
+ var attachmentPointId = props === null || props === void 0 ? void 0 : (_props$rgroupAttachme = props.rgroupAttachmentPoints) === null || _props$rgroupAttachme === void 0 ? void 0 : _props$rgroupAttachme[0];
22539
+ assert_1(attachmentPointId != null);
22540
+ var attachmentPoint = restruct.molecule.rgroupAttachmentPoints.get(attachmentPointId);
22541
+ assert_1(attachmentPoint != null);
22542
+ return attachmentPoint.atomId;
22543
+ };
22530
22544
  var useRGroupAttachmentPointEdit = function useRGroupAttachmentPointEdit() {
22531
22545
  var _useAppContext = useAppContext(),
22532
22546
  getKetcherInstance = _useAppContext.getKetcherInstance;
22533
22547
  var handler = useCallback(function (_ref) {
22534
- var _props$atomIds;
22535
22548
  var props = _ref.props;
22536
- var editor = getKetcherInstance().editor;
22537
- var restruct = editor.render.ctab;
22538
- var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds = props.atomIds) === null || _props$atomIds === void 0 ? void 0 : _props$atomIds[0];
22539
- assert_1(atomId != null);
22549
+ var ketcher = getKetcherInstance();
22550
+ var restruct = ketcher.editor.render.ctab;
22551
+ var atomId = getAtomIdByProps(props, ketcher);
22540
22552
  var atom = restruct.molecule.atoms.get(atomId);
22541
22553
  assert_1(atom != null);
22542
- editRGroupAttachmentPoint(editor, atom, atomId);
22554
+ editRGroupAttachmentPoint(ketcher.editor, atom, atomId);
22543
22555
  }, [getKetcherInstance]);
22544
22556
  var disabled = useCallback(function (_ref2) {
22545
- var _props$atomIds2;
22546
22557
  var props = _ref2.props;
22547
- var editor = getKetcherInstance().editor;
22548
- var restruct = editor.render.ctab;
22549
- var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds2 = props.atomIds) === null || _props$atomIds2 === void 0 ? void 0 : _props$atomIds2[0];
22550
- assert_1(atomId != null);
22558
+ var ketcher = getKetcherInstance();
22559
+ var restruct = ketcher.editor.render.ctab;
22560
+ var atomId = getAtomIdByProps(props, ketcher);
22551
22561
  var atom = restruct.molecule.atoms.get(atomId);
22552
22562
  assert_1(atom != null);
22553
22563
  return atom.isRGroupAttachmentPointEditDisabled;
22554
22564
  }, [getKetcherInstance]);
22555
22565
  var hidden = useCallback(function (_ref3) {
22556
- var _props$atomIds3;
22566
+ var _props$atomIds2;
22557
22567
  var props = _ref3.props;
22558
- var atomLength = (props === null || props === void 0 ? void 0 : (_props$atomIds3 = props.atomIds) === null || _props$atomIds3 === void 0 ? void 0 : _props$atomIds3.length) || 0;
22568
+ var atomLength = (props === null || props === void 0 ? void 0 : (_props$atomIds2 = props.atomIds) === null || _props$atomIds2 === void 0 ? void 0 : _props$atomIds2.length) || 0;
22559
22569
  return atomLength > 1;
22560
22570
  }, []);
22561
22571
  return [handler, disabled, hidden];
@@ -30624,8 +30634,8 @@ var KetcherBuilder = function () {
30624
30634
  initApp(element, appRoot, staticResourcesUrl, {
30625
30635
  buttons: buttons || {},
30626
30636
  errorHandler: errorHandler || null,
30627
- version: "2.15.0-rc.1" ,
30628
- buildDate: "2023-09-04T11:49:56" ,
30637
+ version: "2.15.0-rc.2" ,
30638
+ buildDate: "2023-09-13T13:57:29" ,
30629
30639
  buildNumber: ''
30630
30640
  }, structService, resolve);
30631
30641
  });