ketcher-react 2.28.0-dev.1 → 2.28.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.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +193 -147
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +194 -148
- package/dist/index.modern.js.map +1 -1
- package/dist/script/ui/state/options/index.d.ts +2 -0
- package/dist/script/ui/views/modal/components/document/Save/Save.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1248,6 +1248,9 @@ var initOptionsState = {
|
|
|
1248
1248
|
version: null
|
|
1249
1249
|
},
|
|
1250
1250
|
settings: Object.assign(getDefaultOptions(), validation(storage.getItem(ketcherCore.KETCHER_SAVED_OPTIONS_KEY))),
|
|
1251
|
+
getSettings: function getSettings() {
|
|
1252
|
+
this.settings = Object.assign(getDefaultOptions(), validation(storage.getItem(ketcherCore.KETCHER_SAVED_OPTIONS_KEY)));
|
|
1253
|
+
},
|
|
1251
1254
|
getServerSettings: function getServerSettings() {
|
|
1252
1255
|
var seriliazedServerOptions = getSerilizedServerOptions(this.settings);
|
|
1253
1256
|
var defaultServerOptions = fp.pick(SERVER_OPTIONS, this.settings);
|
|
@@ -1296,6 +1299,7 @@ function appUpdate(data) {
|
|
|
1296
1299
|
function saveSettings(newSettings) {
|
|
1297
1300
|
storage.setItem(ketcherCore.KETCHER_SAVED_OPTIONS_KEY, newSettings);
|
|
1298
1301
|
reinitializeTemplateLibrary();
|
|
1302
|
+
initOptionsState.getSettings();
|
|
1299
1303
|
return {
|
|
1300
1304
|
type: 'SAVE_SETTINGS',
|
|
1301
1305
|
data: newSettings
|
|
@@ -3798,7 +3802,7 @@ var zoom = {
|
|
|
3798
3802
|
|
|
3799
3803
|
var openHelpLink = function openHelpLink() {
|
|
3800
3804
|
var _window$open;
|
|
3801
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.28.0-
|
|
3805
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.28.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3802
3806
|
};
|
|
3803
3807
|
var help = {
|
|
3804
3808
|
help: {
|
|
@@ -17790,145 +17794,159 @@ function updateSelectedBonds(_ref) {
|
|
|
17790
17794
|
|
|
17791
17795
|
function customOnChangeHandler(action, handler) {
|
|
17792
17796
|
var data = [];
|
|
17793
|
-
action
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17861
|
-
|
|
17862
|
-
|
|
17863
|
-
|
|
17864
|
-
|
|
17865
|
-
|
|
17866
|
-
|
|
17867
|
-
|
|
17868
|
-
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
|
|
17873
|
-
|
|
17874
|
-
|
|
17875
|
-
|
|
17876
|
-
})
|
|
17877
|
-
|
|
17878
|
-
|
|
17879
|
-
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
|
|
17897
|
-
|
|
17898
|
-
|
|
17899
|
-
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
|
|
17797
|
+
if (action === undefined) {
|
|
17798
|
+
return handler();
|
|
17799
|
+
} else {
|
|
17800
|
+
if (window.isPolymerEditorTurnedOn) {
|
|
17801
|
+
return handleMacroChanges(handler);
|
|
17802
|
+
} else {
|
|
17803
|
+
return handleMicroChanges(action, handler);
|
|
17804
|
+
}
|
|
17805
|
+
}
|
|
17806
|
+
function handleMacroChanges(handler) {
|
|
17807
|
+
return handler();
|
|
17808
|
+
}
|
|
17809
|
+
function handleMicroChanges(action, handler) {
|
|
17810
|
+
action.operations.reverse().forEach(function (operation) {
|
|
17811
|
+
var op = operation._inverted;
|
|
17812
|
+
switch (op.type) {
|
|
17813
|
+
case ketcherCore.OperationType.ATOM_ADD:
|
|
17814
|
+
case ketcherCore.OperationType.ATOM_DELETE:
|
|
17815
|
+
data.push({
|
|
17816
|
+
operation: op.type,
|
|
17817
|
+
id: op.data.aid,
|
|
17818
|
+
label: op.data.atom.label ? op.data.atom.label : '',
|
|
17819
|
+
position: {
|
|
17820
|
+
x: +op.data.pos.x.toFixed(2),
|
|
17821
|
+
y: +op.data.pos.y.toFixed(2)
|
|
17822
|
+
}
|
|
17823
|
+
});
|
|
17824
|
+
break;
|
|
17825
|
+
case ketcherCore.OperationType.ATOM_ATTR:
|
|
17826
|
+
data.push({
|
|
17827
|
+
operation: operation.type,
|
|
17828
|
+
id: operation.data.aid,
|
|
17829
|
+
attribute: operation.data.attribute,
|
|
17830
|
+
from: operation.data.value,
|
|
17831
|
+
to: operation.data2.value
|
|
17832
|
+
});
|
|
17833
|
+
break;
|
|
17834
|
+
case ketcherCore.OperationType.ATOM_MOVE:
|
|
17835
|
+
data.push({
|
|
17836
|
+
operation: op.type,
|
|
17837
|
+
id: op.data.aid,
|
|
17838
|
+
position: {
|
|
17839
|
+
x: +op.data.d.x.toFixed(2),
|
|
17840
|
+
y: +op.data.d.y.toFixed(2)
|
|
17841
|
+
}
|
|
17842
|
+
});
|
|
17843
|
+
break;
|
|
17844
|
+
case ketcherCore.OperationType.BOND_ADD:
|
|
17845
|
+
case ketcherCore.OperationType.BOND_DELETE:
|
|
17846
|
+
data.push({
|
|
17847
|
+
operation: op.type,
|
|
17848
|
+
id: op.data.bid
|
|
17849
|
+
});
|
|
17850
|
+
break;
|
|
17851
|
+
case ketcherCore.OperationType.FRAGMENT_ADD:
|
|
17852
|
+
case ketcherCore.OperationType.FRAGMENT_DELETE:
|
|
17853
|
+
data.push({
|
|
17854
|
+
operation: op.type,
|
|
17855
|
+
id: op.frid
|
|
17856
|
+
});
|
|
17857
|
+
break;
|
|
17858
|
+
case ketcherCore.OperationType.FRAGMENT_ADD_STEREO_ATOM:
|
|
17859
|
+
case ketcherCore.OperationType.FRAGMENT_DELETE_STEREO_ATOM:
|
|
17860
|
+
data.push({
|
|
17861
|
+
operation: op.type,
|
|
17862
|
+
atomId: op.data.aid,
|
|
17863
|
+
fragId: op.data.frid
|
|
17864
|
+
});
|
|
17865
|
+
break;
|
|
17866
|
+
case ketcherCore.OperationType.S_GROUP_ATOM_ADD:
|
|
17867
|
+
case ketcherCore.OperationType.S_GROUP_ATOM_REMOVE:
|
|
17868
|
+
data.push({
|
|
17869
|
+
operation: op.type,
|
|
17870
|
+
atomId: op.data.aid,
|
|
17871
|
+
sGroupId: op.data.sgid
|
|
17872
|
+
});
|
|
17873
|
+
break;
|
|
17874
|
+
case ketcherCore.OperationType.S_GROUP_CREATE:
|
|
17875
|
+
case ketcherCore.OperationType.S_GROUP_DELETE:
|
|
17876
|
+
data.push({
|
|
17877
|
+
operation: op.type,
|
|
17878
|
+
type: op.data.type,
|
|
17879
|
+
sGroupId: op.data.sgid
|
|
17880
|
+
});
|
|
17881
|
+
break;
|
|
17882
|
+
case ketcherCore.OperationType.RXN_ARROW_ADD:
|
|
17883
|
+
case ketcherCore.OperationType.RXN_ARROW_DELETE:
|
|
17884
|
+
data.push({
|
|
17885
|
+
operation: op.type,
|
|
17886
|
+
id: op.data.id,
|
|
17887
|
+
mode: op.data.mode,
|
|
17888
|
+
position: op.data.pos.map(function (pos) {
|
|
17889
|
+
return {
|
|
17890
|
+
x: +pos.x.toFixed(2),
|
|
17891
|
+
y: +pos.y.toFixed(2)
|
|
17892
|
+
};
|
|
17893
|
+
})
|
|
17894
|
+
});
|
|
17895
|
+
break;
|
|
17896
|
+
case ketcherCore.OperationType.RXN_ARROW_RESIZE:
|
|
17897
|
+
data.push({
|
|
17898
|
+
operation: op.type,
|
|
17899
|
+
id: op.data.id
|
|
17900
|
+
});
|
|
17901
|
+
break;
|
|
17902
|
+
case ketcherCore.OperationType.RXN_ARROW_MOVE:
|
|
17903
|
+
data.push({
|
|
17904
|
+
operation: op.type,
|
|
17905
|
+
id: op.data.id,
|
|
17906
|
+
position: {
|
|
17907
|
+
x: +op.data.d.x.toFixed(2),
|
|
17908
|
+
y: +op.data.d.y.toFixed(2)
|
|
17909
|
+
}
|
|
17910
|
+
});
|
|
17911
|
+
break;
|
|
17912
|
+
case ketcherCore.OperationType.R_GROUP_FRAGMENT:
|
|
17913
|
+
data.push({
|
|
17914
|
+
operation: operation.type,
|
|
17915
|
+
id: op.frid
|
|
17916
|
+
});
|
|
17917
|
+
break;
|
|
17918
|
+
case ketcherCore.OperationType.SIMPLE_OBJECT_ADD:
|
|
17919
|
+
case ketcherCore.OperationType.SIMPLE_OBJECT_DELETE:
|
|
17920
|
+
data.push({
|
|
17921
|
+
operation: op.type,
|
|
17922
|
+
id: op.data.id,
|
|
17923
|
+
mode: op.data.mode
|
|
17924
|
+
});
|
|
17925
|
+
break;
|
|
17926
|
+
case ketcherCore.OperationType.SIMPLE_OBJECT_RESIZE:
|
|
17927
|
+
data.push({
|
|
17928
|
+
operation: op.type,
|
|
17929
|
+
id: op.data.id
|
|
17930
|
+
});
|
|
17931
|
+
break;
|
|
17932
|
+
case ketcherCore.OperationType.SIMPLE_OBJECT_MOVE:
|
|
17933
|
+
data.push({
|
|
17934
|
+
operation: operation.type,
|
|
17935
|
+
id: operation.data.id,
|
|
17936
|
+
position: {
|
|
17937
|
+
x: +operation.data.d.x.toFixed(2),
|
|
17938
|
+
y: +operation.data.d.y.toFixed(2)
|
|
17939
|
+
}
|
|
17940
|
+
});
|
|
17941
|
+
break;
|
|
17942
|
+
default:
|
|
17943
|
+
data.push({
|
|
17944
|
+
operation: op.type
|
|
17945
|
+
});
|
|
17946
|
+
}
|
|
17947
|
+
});
|
|
17948
|
+
return handler(data);
|
|
17949
|
+
}
|
|
17932
17950
|
}
|
|
17933
17951
|
|
|
17934
17952
|
function getSelectionMap(structure) {
|
|
@@ -24632,6 +24650,7 @@ var Editor$3 = function () {
|
|
|
24632
24650
|
if (!wasViewOnlyEnabled && isViewOnlyEnabled === true || wasViewOnlyEnabled && isViewOnlyEnabled === false) {
|
|
24633
24651
|
this.tool('select');
|
|
24634
24652
|
this.event.change.dispatch('force');
|
|
24653
|
+
ketcherCore.ketcherProvider.getKetcher().changeEvent.dispatch('force');
|
|
24635
24654
|
}
|
|
24636
24655
|
}
|
|
24637
24656
|
}, {
|
|
@@ -24760,6 +24779,7 @@ var Editor$3 = function () {
|
|
|
24760
24779
|
}
|
|
24761
24780
|
this.historyPtr = this.historyStack.length;
|
|
24762
24781
|
this.event.change.dispatch(action);
|
|
24782
|
+
ketcherCore.ketcherProvider.getKetcher().changeEvent.dispatch(action);
|
|
24763
24783
|
}
|
|
24764
24784
|
this.render.update(false, null);
|
|
24765
24785
|
}
|
|
@@ -24775,6 +24795,7 @@ var Editor$3 = function () {
|
|
|
24775
24795
|
}, {
|
|
24776
24796
|
key: "undo",
|
|
24777
24797
|
value: function undo() {
|
|
24798
|
+
var ketcherChangeEvent = ketcherCore.ketcherProvider.getKetcher().changeEvent;
|
|
24778
24799
|
if (this.historyPtr === 0) {
|
|
24779
24800
|
throw new Error('Undo stack is empty');
|
|
24780
24801
|
}
|
|
@@ -24788,14 +24809,17 @@ var Editor$3 = function () {
|
|
|
24788
24809
|
this.historyStack[this.historyPtr] = action;
|
|
24789
24810
|
if (this._tool instanceof toolsMap.paste) {
|
|
24790
24811
|
this.event.change.dispatch();
|
|
24812
|
+
ketcherChangeEvent.dispatch();
|
|
24791
24813
|
} else {
|
|
24792
24814
|
this.event.change.dispatch(action);
|
|
24815
|
+
ketcherChangeEvent.dispatch(action);
|
|
24793
24816
|
}
|
|
24794
24817
|
this.render.update();
|
|
24795
24818
|
}
|
|
24796
24819
|
}, {
|
|
24797
24820
|
key: "redo",
|
|
24798
24821
|
value: function redo() {
|
|
24822
|
+
var ketcherChangeEvent = ketcherCore.ketcherProvider.getKetcher().changeEvent;
|
|
24799
24823
|
if (this.historyPtr === this.historyStack.length) {
|
|
24800
24824
|
throw new Error('Redo stack is empty');
|
|
24801
24825
|
}
|
|
@@ -24808,8 +24832,10 @@ var Editor$3 = function () {
|
|
|
24808
24832
|
this.historyPtr++;
|
|
24809
24833
|
if (this._tool instanceof toolsMap.paste) {
|
|
24810
24834
|
this.event.change.dispatch();
|
|
24835
|
+
ketcherChangeEvent.dispatch();
|
|
24811
24836
|
} else {
|
|
24812
24837
|
this.event.change.dispatch(action);
|
|
24838
|
+
ketcherChangeEvent.dispatch(action);
|
|
24813
24839
|
}
|
|
24814
24840
|
this.render.update();
|
|
24815
24841
|
}
|
|
@@ -24826,7 +24852,7 @@ var Editor$3 = function () {
|
|
|
24826
24852
|
return customOnChangeHandler(action, handler);
|
|
24827
24853
|
};
|
|
24828
24854
|
subscriber.handler = subscribeFuncWrapper;
|
|
24829
|
-
|
|
24855
|
+
ketcherCore.ketcherProvider.getKetcher().changeEvent.add(subscribeFuncWrapper);
|
|
24830
24856
|
break;
|
|
24831
24857
|
}
|
|
24832
24858
|
default:
|
|
@@ -31591,6 +31617,22 @@ var SaveDialog = function (_Component) {
|
|
|
31591
31617
|
})]
|
|
31592
31618
|
});
|
|
31593
31619
|
});
|
|
31620
|
+
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "handleCopy", function (event) {
|
|
31621
|
+
var structStr = _this.state.structStr;
|
|
31622
|
+
try {
|
|
31623
|
+
if (ketcherCore.isClipboardAPIAvailable()) {
|
|
31624
|
+
navigator.clipboard.writeText(structStr);
|
|
31625
|
+
} else {
|
|
31626
|
+
ketcherCore.legacyCopy(event.clipboardData, {
|
|
31627
|
+
'text/plain': structStr
|
|
31628
|
+
});
|
|
31629
|
+
event.preventDefault();
|
|
31630
|
+
}
|
|
31631
|
+
} catch (e) {
|
|
31632
|
+
ketcherCore.KetcherLogger.error('copyAs.js::copyAs', e);
|
|
31633
|
+
_this.props.editor.errorHandler('This feature is not available in your browser');
|
|
31634
|
+
}
|
|
31635
|
+
});
|
|
31594
31636
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "renderSaveFile", function () {
|
|
31595
31637
|
var formState = Object.assign({}, _this.props.formState);
|
|
31596
31638
|
delete formState.moleculeErrors;
|
|
@@ -31629,15 +31671,20 @@ var SaveDialog = function (_Component) {
|
|
|
31629
31671
|
};
|
|
31630
31672
|
var PreviewContent = function PreviewContent(_ref3) {
|
|
31631
31673
|
var format = _ref3.format;
|
|
31632
|
-
return jsxRuntime.
|
|
31674
|
+
return jsxRuntime.jsxs("div", {
|
|
31633
31675
|
className: classes$l.previewBackground,
|
|
31634
|
-
children: jsxRuntime.jsx("textarea", {
|
|
31676
|
+
children: [jsxRuntime.jsx("textarea", {
|
|
31635
31677
|
value: structStr,
|
|
31636
31678
|
className: classes$l.previewArea,
|
|
31637
31679
|
readOnly: true,
|
|
31638
31680
|
ref: _this.textAreaRef,
|
|
31639
31681
|
"data-testid": "".concat(format, "-preview-area-text")
|
|
31640
|
-
})
|
|
31682
|
+
}), jsxRuntime.jsx(IconButton, {
|
|
31683
|
+
onClick: _this.handleCopy,
|
|
31684
|
+
iconName: "copy",
|
|
31685
|
+
title: "Copy to clipboard",
|
|
31686
|
+
testId: "copy-to-clipboard"
|
|
31687
|
+
})]
|
|
31641
31688
|
});
|
|
31642
31689
|
};
|
|
31643
31690
|
if (isLoading) {
|
|
@@ -34767,7 +34814,6 @@ var App = function App(props) {
|
|
|
34767
34814
|
checkServer();
|
|
34768
34815
|
dispatch(initFGTemplates());
|
|
34769
34816
|
dispatch(initSaltsAndSolventsTemplates());
|
|
34770
|
-
window.scrollTo(0, 0);
|
|
34771
34817
|
return function () {
|
|
34772
34818
|
dispatch(initLib([]));
|
|
34773
34819
|
dispatch(initSaltsAndSolvents([]));
|
|
@@ -34983,8 +35029,8 @@ var KetcherBuilder = function () {
|
|
|
34983
35029
|
cleanup = initApp(element, appRoot, staticResourcesUrl, {
|
|
34984
35030
|
buttons: buttons || {},
|
|
34985
35031
|
errorHandler: errorHandler || null,
|
|
34986
|
-
version: "2.28.0-
|
|
34987
|
-
buildDate: "2024-
|
|
35032
|
+
version: "2.28.0-rc.2" ,
|
|
35033
|
+
buildDate: "2024-12-10T18:48:53" ,
|
|
34988
35034
|
buildNumber: '',
|
|
34989
35035
|
customButtons: customButtons || []
|
|
34990
35036
|
}, structService, resolve, togglerComponent);
|