ketcher-react 2.13.0-rc.1 → 2.13.0-rc.3
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 +84 -44
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +85 -45
- package/dist/index.modern.js.map +1 -1
- package/dist/script/editor/Editor.d.ts +3 -1
- package/dist/script/ui/state/editor/index.d.ts +2 -0
- package/dist/script/ui/views/Editor.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2576,7 +2576,8 @@ var SettingsManager = function () {
|
|
|
2576
2576
|
return SettingsManager;
|
|
2577
2577
|
}();
|
|
2578
2578
|
|
|
2579
|
-
var _excluded$y = ["rescale", "fragment"]
|
|
2579
|
+
var _excluded$y = ["rescale", "fragment"],
|
|
2580
|
+
_excluded2$6 = ["isPaste"];
|
|
2580
2581
|
function ownKeys$1b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2581
2582
|
function _objectSpread$1c(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1b(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2582
2583
|
function onAction(action) {
|
|
@@ -2622,7 +2623,7 @@ function removeStructAction() {
|
|
|
2622
2623
|
function load(struct, options) {
|
|
2623
2624
|
return function () {
|
|
2624
2625
|
var _ref = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee(dispatch, getState) {
|
|
2625
|
-
var state, editor, server, errorHandler, parsedStruct,
|
|
2626
|
+
var state, editor, server, errorHandler, _options2, isPaste, otherOptions, parsedStruct, _otherOptions, fragment, hasUnsupportedGroups, oldStruct, stereAtomsMap;
|
|
2626
2627
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
2627
2628
|
while (1) {
|
|
2628
2629
|
switch (_context.prev = _context.next) {
|
|
@@ -2632,31 +2633,32 @@ function load(struct, options) {
|
|
|
2632
2633
|
server = state.server;
|
|
2633
2634
|
errorHandler = editor.errorHandler;
|
|
2634
2635
|
options = options || {};
|
|
2635
|
-
|
|
2636
|
+
_options2 = options, isPaste = _options2.isPaste, otherOptions = _objectWithoutProperties__default["default"](_options2, _excluded2$6);
|
|
2637
|
+
otherOptions = _objectSpread$1c(_objectSpread$1c({}, otherOptions), {}, {
|
|
2636
2638
|
'dearomatize-on-load': editor.options()['dearomatize-on-load'],
|
|
2637
2639
|
ignoreChiralFlag: editor.options().ignoreChiralFlag
|
|
2638
2640
|
});
|
|
2639
2641
|
dispatch(setAnalyzingFile(true));
|
|
2640
|
-
_context.prev =
|
|
2641
|
-
_context.next =
|
|
2642
|
-
return parseStruct(struct, server,
|
|
2643
|
-
case
|
|
2642
|
+
_context.prev = 8;
|
|
2643
|
+
_context.next = 11;
|
|
2644
|
+
return parseStruct(struct, server, otherOptions);
|
|
2645
|
+
case 11:
|
|
2644
2646
|
parsedStruct = _context.sent;
|
|
2645
|
-
|
|
2647
|
+
_otherOptions = otherOptions, fragment = _otherOptions.fragment;
|
|
2646
2648
|
hasUnsupportedGroups = parsedStruct.sgroups.some(function (sGroup) {
|
|
2647
2649
|
return !supportedSGroupTypes[sGroup.type];
|
|
2648
2650
|
});
|
|
2649
2651
|
if (!hasUnsupportedGroups) {
|
|
2650
|
-
_context.next =
|
|
2652
|
+
_context.next = 18;
|
|
2651
2653
|
break;
|
|
2652
2654
|
}
|
|
2653
|
-
_context.next =
|
|
2655
|
+
_context.next = 17;
|
|
2654
2656
|
return editor.event.confirm.dispatch();
|
|
2655
|
-
case
|
|
2657
|
+
case 17:
|
|
2656
2658
|
parsedStruct.sgroups = parsedStruct.sgroups.filter(function (_key, sGroup) {
|
|
2657
2659
|
return supportedSGroupTypes[sGroup.type];
|
|
2658
2660
|
});
|
|
2659
|
-
case
|
|
2661
|
+
case 18:
|
|
2660
2662
|
parsedStruct.rescale();
|
|
2661
2663
|
if (editor.struct().atoms.size) {
|
|
2662
2664
|
oldStruct = editor.struct().clone();
|
|
@@ -2701,29 +2703,31 @@ function load(struct, options) {
|
|
|
2701
2703
|
} else {
|
|
2702
2704
|
editor.struct(parsedStruct);
|
|
2703
2705
|
}
|
|
2704
|
-
editor.zoomAccordingContent();
|
|
2705
|
-
|
|
2706
|
+
editor.zoomAccordingContent(parsedStruct);
|
|
2707
|
+
if (!isPaste) {
|
|
2708
|
+
editor.centerStruct();
|
|
2709
|
+
}
|
|
2706
2710
|
dispatch(setAnalyzingFile(false));
|
|
2707
2711
|
dispatch({
|
|
2708
2712
|
type: 'MODAL_CLOSE'
|
|
2709
2713
|
});
|
|
2710
|
-
_context.next =
|
|
2714
|
+
_context.next = 36;
|
|
2711
2715
|
break;
|
|
2712
|
-
case
|
|
2713
|
-
_context.prev =
|
|
2714
|
-
_context.t0 = _context["catch"](
|
|
2716
|
+
case 32:
|
|
2717
|
+
_context.prev = 32;
|
|
2718
|
+
_context.t0 = _context["catch"](8);
|
|
2715
2719
|
dispatch(setAnalyzingFile(false));
|
|
2716
2720
|
_context.t0 && errorHandler && errorHandler(_context.t0.message);
|
|
2717
|
-
case
|
|
2718
|
-
_context.prev =
|
|
2721
|
+
case 36:
|
|
2722
|
+
_context.prev = 36;
|
|
2719
2723
|
ketcherCore.emitEventRequestIsFinished();
|
|
2720
|
-
return _context.finish(
|
|
2721
|
-
case
|
|
2724
|
+
return _context.finish(36);
|
|
2725
|
+
case 39:
|
|
2722
2726
|
case "end":
|
|
2723
2727
|
return _context.stop();
|
|
2724
2728
|
}
|
|
2725
2729
|
}
|
|
2726
|
-
}, _callee, null, [[
|
|
2730
|
+
}, _callee, null, [[8, 32, 36, 39]]);
|
|
2727
2731
|
}));
|
|
2728
2732
|
return function (_x, _x2) {
|
|
2729
2733
|
return _ref.apply(this, arguments);
|
|
@@ -2853,6 +2857,11 @@ function serverTransform(method, data, struct) {
|
|
|
2853
2857
|
});
|
|
2854
2858
|
};
|
|
2855
2859
|
}
|
|
2860
|
+
function resetStereoFlagsPosition(struct) {
|
|
2861
|
+
struct.frags.forEach(function (fragment) {
|
|
2862
|
+
return fragment.stereoFlagPosition = undefined;
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2856
2865
|
function serverCall(editor, server, method, options, struct) {
|
|
2857
2866
|
var selection = editor.selection();
|
|
2858
2867
|
var selectedAtoms = [];
|
|
@@ -2863,6 +2872,9 @@ function serverCall(editor, server, method, options, struct) {
|
|
|
2863
2872
|
return aidMap.get(aid);
|
|
2864
2873
|
});
|
|
2865
2874
|
}
|
|
2875
|
+
if (method === 'layout') {
|
|
2876
|
+
resetStereoFlagsPosition(currentStruct);
|
|
2877
|
+
}
|
|
2866
2878
|
var ketSerializer = new ketcherCore.KetSerializer();
|
|
2867
2879
|
return server.then(function () {
|
|
2868
2880
|
return server[method](Object.assign({
|
|
@@ -3090,7 +3102,7 @@ var zoom = {
|
|
|
3090
3102
|
|
|
3091
3103
|
var openHelpLink = function openHelpLink() {
|
|
3092
3104
|
var _window$open;
|
|
3093
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.13.0-rc.
|
|
3105
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.13.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3094
3106
|
};
|
|
3095
3107
|
var help = {
|
|
3096
3108
|
help: {
|
|
@@ -7069,6 +7081,16 @@ var Button = function Button(_ref) {
|
|
|
7069
7081
|
var _templateObject$9;
|
|
7070
7082
|
var Container$1 = styled__default["default"].div(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteral__default["default"](["\n > svg {\n height: 100%;\n width: 100%;\n }\n"])));
|
|
7071
7083
|
|
|
7084
|
+
var normalizeStruct = function normalizeStruct(molV2000StringOrStruct) {
|
|
7085
|
+
if (molV2000StringOrStruct instanceof ketcherCore.Struct) {
|
|
7086
|
+
return molV2000StringOrStruct;
|
|
7087
|
+
}
|
|
7088
|
+
try {
|
|
7089
|
+
return new ketcherCore.MolSerializer().deserialize(molV2000StringOrStruct);
|
|
7090
|
+
} catch (e) {
|
|
7091
|
+
throw Error('Could not parse Struct');
|
|
7092
|
+
}
|
|
7093
|
+
};
|
|
7072
7094
|
var StructRender = function StructRender(_ref) {
|
|
7073
7095
|
var struct = _ref.struct,
|
|
7074
7096
|
options = _ref.options,
|
|
@@ -7078,7 +7100,8 @@ var StructRender = function StructRender(_ref) {
|
|
|
7078
7100
|
var container = renderRef.current;
|
|
7079
7101
|
if (container) {
|
|
7080
7102
|
container.innerHTML = '';
|
|
7081
|
-
|
|
7103
|
+
var normalizedStruct = normalizeStruct(struct);
|
|
7104
|
+
ketcherCore.RenderStruct.render(container, normalizedStruct, options);
|
|
7082
7105
|
}
|
|
7083
7106
|
}, [struct, options]);
|
|
7084
7107
|
return jsxRuntime.jsx(Container$1, {
|
|
@@ -12584,7 +12607,8 @@ function initClipboard(dispatch) {
|
|
|
12584
12607
|
onPaste: function onPaste(data) {
|
|
12585
12608
|
var structStr = data[ketcherCore.ChemicalMimeType.KET] || data[ketcherCore.ChemicalMimeType.Mol] || data[ketcherCore.ChemicalMimeType.Rxn] || data['text/plain'];
|
|
12586
12609
|
if (structStr || !rxnTextPlain.test(data['text/plain'])) loadStruct(structStr, {
|
|
12587
|
-
fragment: true
|
|
12610
|
+
fragment: true,
|
|
12611
|
+
isPaste: true
|
|
12588
12612
|
});
|
|
12589
12613
|
}
|
|
12590
12614
|
};
|
|
@@ -21432,6 +21456,8 @@ var Editor$3 = function () {
|
|
|
21432
21456
|
message: new subscription.Subscription(),
|
|
21433
21457
|
elementEdit: new subscription.PipelineSubscription(),
|
|
21434
21458
|
bondEdit: new subscription.PipelineSubscription(),
|
|
21459
|
+
zoomIn: new subscription.PipelineSubscription(),
|
|
21460
|
+
zoomOut: new subscription.PipelineSubscription(),
|
|
21435
21461
|
rgroupEdit: new subscription.PipelineSubscription(),
|
|
21436
21462
|
sgroupEdit: new subscription.PipelineSubscription(),
|
|
21437
21463
|
sdataEdit: new subscription.PipelineSubscription(),
|
|
@@ -21584,18 +21610,27 @@ var Editor$3 = function () {
|
|
|
21584
21610
|
}
|
|
21585
21611
|
}, {
|
|
21586
21612
|
key: "zoomAccordingContent",
|
|
21587
|
-
value: function zoomAccordingContent() {
|
|
21588
|
-
this.zoom(1);
|
|
21589
|
-
var clientAreaBoundingBox = this.render.clientArea.getBoundingClientRect();
|
|
21590
|
-
var paper = this.render.paper;
|
|
21613
|
+
value: function zoomAccordingContent(struct) {
|
|
21591
21614
|
var MIN_ZOOM_VALUE = 0.1;
|
|
21592
21615
|
var MAX_ZOOM_VALUE = 1;
|
|
21593
|
-
var
|
|
21594
|
-
var
|
|
21595
|
-
|
|
21596
|
-
|
|
21597
|
-
|
|
21616
|
+
var MARGIN_IN_PIXELS = 40;
|
|
21617
|
+
var parsedStructCoordBoundingBox = struct.getCoordBoundingBox();
|
|
21618
|
+
var parsedStructSize = new ketcherCore.Vec2(parsedStructCoordBoundingBox.max.x - parsedStructCoordBoundingBox.min.x, parsedStructCoordBoundingBox.max.y - parsedStructCoordBoundingBox.min.y);
|
|
21619
|
+
var parsedStructSizeInPixels = {
|
|
21620
|
+
width: parsedStructSize.x * this.render.options.scale * this.render.options.zoom,
|
|
21621
|
+
height: parsedStructSize.y * this.render.options.scale * this.render.options.zoom
|
|
21622
|
+
};
|
|
21623
|
+
var clientAreaBoundingBox = this.render.clientArea.getBoundingClientRect();
|
|
21624
|
+
if (parsedStructSizeInPixels.width + MARGIN_IN_PIXELS < clientAreaBoundingBox.width && parsedStructSizeInPixels.height + MARGIN_IN_PIXELS < clientAreaBoundingBox.height) {
|
|
21625
|
+
return;
|
|
21598
21626
|
}
|
|
21627
|
+
var newZoomValue = this.render.options.zoom / (parsedStructSizeInPixels.height - clientAreaBoundingBox.height > parsedStructSizeInPixels.width - clientAreaBoundingBox.width ? parsedStructSizeInPixels.height / clientAreaBoundingBox.height : parsedStructSizeInPixels.width / clientAreaBoundingBox.width);
|
|
21628
|
+
if (newZoomValue >= MAX_ZOOM_VALUE) {
|
|
21629
|
+
this.zoom(MAX_ZOOM_VALUE);
|
|
21630
|
+
return;
|
|
21631
|
+
}
|
|
21632
|
+
newZoomValue -= MARGIN_IN_PIXELS / clientAreaBoundingBox.width;
|
|
21633
|
+
this.zoom(newZoomValue < MIN_ZOOM_VALUE ? MIN_ZOOM_VALUE : Number(newZoomValue.toFixed(2)));
|
|
21599
21634
|
}
|
|
21600
21635
|
}, {
|
|
21601
21636
|
key: "selection",
|
|
@@ -23052,7 +23087,7 @@ var InfoPanel$1 = reactRedux.connect(function (store) {
|
|
|
23052
23087
|
};
|
|
23053
23088
|
})(InfoPanel);
|
|
23054
23089
|
|
|
23055
|
-
var _excluded$o = ["Tag", "className", "indigoVerification", "struct", "tool", "toolOpts", "options", "onInit", "onSelectionChange", "onElementEdit", "onEnhancedStereoEdit", "onQuickEdit", "onBondEdit", "onRgroupEdit", "onSgroupEdit", "onRemoveFG", "onMessage", "onAromatizeStruct", "onDearomatizeStruct", "onAttachEdit", "onCipChange", "onConfirm", "onShowInfo", "onApiSettings", "showAttachmentPoints", "onUpdateFloatingTools"];
|
|
23090
|
+
var _excluded$o = ["Tag", "className", "indigoVerification", "struct", "tool", "toolOpts", "options", "onInit", "onSelectionChange", "onElementEdit", "onEnhancedStereoEdit", "onQuickEdit", "onBondEdit", "onZoomIn", "onZoomOut", "onRgroupEdit", "onSgroupEdit", "onRemoveFG", "onMessage", "onAromatizeStruct", "onDearomatizeStruct", "onAttachEdit", "onCipChange", "onConfirm", "onShowInfo", "onApiSettings", "showAttachmentPoints", "onUpdateFloatingTools"];
|
|
23056
23091
|
function ownKeys$D(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23057
23092
|
function _objectSpread$D(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$D(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$D(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23058
23093
|
function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
|
|
@@ -23241,6 +23276,8 @@ var StructEditor = function (_Component) {
|
|
|
23241
23276
|
_this$props.onEnhancedStereoEdit;
|
|
23242
23277
|
_this$props.onQuickEdit;
|
|
23243
23278
|
_this$props.onBondEdit;
|
|
23279
|
+
_this$props.onZoomIn;
|
|
23280
|
+
_this$props.onZoomOut;
|
|
23244
23281
|
_this$props.onRgroupEdit;
|
|
23245
23282
|
_this$props.onSgroupEdit;
|
|
23246
23283
|
_this$props.onRemoveFG;
|
|
@@ -29576,7 +29613,9 @@ function initEditor(dispatch, getState) {
|
|
|
29576
29613
|
onUpdateFloatingTools: memoizedDebounce(
|
|
29577
29614
|
function (payload) {
|
|
29578
29615
|
dispatch(updateFloatingTools(payload));
|
|
29579
|
-
})
|
|
29616
|
+
}),
|
|
29617
|
+
onZoomIn: updateAction,
|
|
29618
|
+
onZoomOut: updateAction
|
|
29580
29619
|
};
|
|
29581
29620
|
}
|
|
29582
29621
|
|
|
@@ -29592,10 +29631,10 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
29592
29631
|
var onZoomOut = function onZoomOut() {
|
|
29593
29632
|
return dispatchAction(dispatch, 'zoom-out');
|
|
29594
29633
|
};
|
|
29595
|
-
return _objectSpread$2({
|
|
29596
|
-
|
|
29597
|
-
|
|
29598
|
-
}
|
|
29634
|
+
return _objectSpread$2(_objectSpread$2({}, dispatch(initEditor)), {}, {
|
|
29635
|
+
onZoomOut: onZoomOut,
|
|
29636
|
+
onZoomIn: onZoomIn
|
|
29637
|
+
});
|
|
29599
29638
|
};
|
|
29600
29639
|
var Editor$1 = reactRedux.connect(function (state) {
|
|
29601
29640
|
return {
|
|
@@ -29908,11 +29947,12 @@ var App = function App(props) {
|
|
|
29908
29947
|
dispatch(initSaltsAndSolventsTemplates());
|
|
29909
29948
|
window.scrollTo(0, 0);
|
|
29910
29949
|
}, []);
|
|
29950
|
+
var Editor = Editor$1;
|
|
29911
29951
|
return jsxRuntime.jsx(material.ThemeProvider, {
|
|
29912
29952
|
theme: muiTheme,
|
|
29913
29953
|
children: jsxRuntime.jsxs("div", {
|
|
29914
29954
|
className: classes$2.app,
|
|
29915
|
-
children: [jsxRuntime.jsx(AppHiddenContainer, {}), jsxRuntime.jsx(Editor
|
|
29955
|
+
children: [jsxRuntime.jsx(AppHiddenContainer, {}), jsxRuntime.jsx(Editor, {
|
|
29916
29956
|
className: classes$2.canvas
|
|
29917
29957
|
}), jsxRuntime.jsx(TopToolbarContainer, {
|
|
29918
29958
|
className: classes$2.top
|
|
@@ -30036,8 +30076,8 @@ var KetcherBuilder = function () {
|
|
|
30036
30076
|
initApp(element, staticResourcesUrl, {
|
|
30037
30077
|
buttons: buttons || {},
|
|
30038
30078
|
errorHandler: errorHandler || null,
|
|
30039
|
-
version: "2.13.0-rc.
|
|
30040
|
-
buildDate: "2023-
|
|
30079
|
+
version: "2.13.0-rc.3" ,
|
|
30080
|
+
buildDate: "2023-08-04T11:43:37" ,
|
|
30041
30081
|
buildNumber: ''
|
|
30042
30082
|
}, structService, resolve);
|
|
30043
30083
|
});
|