ketcher-react 2.5.2 → 2.6.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/constants.d.ts +16 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useSubscribtionOnEvents.d.ts +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +154 -74
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +156 -77
- package/dist/index.modern.js.map +1 -1
- package/dist/script/editor/Editor.d.ts +3 -0
- package/dist/script/editor/tool/bond.d.ts +3 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
|
@@ -24,7 +24,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
24
24
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
25
25
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
26
26
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
27
|
-
import { KetSerializer, MolSerializer, Ketcher, FormatterFactory, StereLabelStyleType, StereoColoringType, Bond as Bond$2, Elements, AtomList, StereoLabel, findStereoAtoms, RxnArrowMode, SimpleObjectMode, SGroup, Pile, getStereoAtomsMap, identifyStructFormat, ChemicalMimeType, SdfSerializer, FunctionalGroupsProvider, ElementColor, formatProperties, Vec2, FunctionalGroup, Fragment as Fragment$1, OperationType, fromAtomsAttrs, fracAngle, Action, fromSgroupDeletion, fromFragmentDeletion, fromAtomAddition, fromBondAddition, Atom as Atom$2, bondChangingAction, fromBondsAttrs, fromChain, getItemsToFuse, getHoverToFuse, fromItemsFuse, fromStereoFlagUpdate, Scale, checkOverlapping, fromSeveralSgroupAddition, SgContexts, fromSgroupAction, fromSimpleObjectResizing, fromArrowResizing, fromMultipleMove, fromTextDeletion, fromTextUpdating, fromOneAtomDeletion, fromOneBondDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromPaste, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromPlusAddition, fromRotate, fromFlip, fromBondAlign, fromSimpleObjectAddition, fromTemplateOnBondAction, fromTemplateOnCanvas, fromTemplateOnAtom, fromTextCreation, fromHighlightCreate, fromHighlightClear,
|
|
27
|
+
import { KetSerializer, MolSerializer, Ketcher, FormatterFactory, StereLabelStyleType, StereoColoringType, Bond as Bond$2, Elements, AtomList, StereoLabel, findStereoAtoms, RxnArrowMode, SimpleObjectMode, SGroup, Pile, getStereoAtomsMap, identifyStructFormat, ChemicalMimeType, SdfSerializer, FunctionalGroupsProvider, KetcherAsyncEvents, ElementColor, formatProperties, Vec2, FunctionalGroup, Fragment as Fragment$1, OperationType, fromAtomsAttrs, fracAngle, Action, fromSgroupDeletion, fromFragmentDeletion, fromAtomAddition, fromBondAddition, Atom as Atom$2, bondChangingAction, fromBondsAttrs, fromChain, getItemsToFuse, getHoverToFuse, fromItemsFuse, fromStereoFlagUpdate, Scale, checkOverlapping, fromSeveralSgroupAddition, SgContexts, fromSgroupAction, fromSimpleObjectResizing, fromArrowResizing, fromMultipleMove, fromTextDeletion, fromTextUpdating, fromOneAtomDeletion, fromOneBondDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromPaste, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromPlusAddition, fromRotate, fromFlip, fromBondAlign, fromSimpleObjectAddition, fromTemplateOnBondAction, fromTemplateOnCanvas, fromTemplateOnAtom, fromTextCreation, fromHighlightCreate, fromHighlightClear, fromNewCanvas, Struct, Render, fromDescriptorsAlign, setExpandSGroup, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, Generics, TextCommand } from 'ketcher-core';
|
|
28
28
|
import * as React from 'react';
|
|
29
29
|
import React__default, { createRef, Component, useState, useEffect, useRef, useMemo, createElement, forwardRef, useCallback, useLayoutEffect, Fragment as Fragment$2 } from 'react';
|
|
30
30
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -37,7 +37,7 @@ import Ajv from 'ajv';
|
|
|
37
37
|
import { pick, range, capitalize, omit, without, findLastIndex, findIndex, pickBy, isEmpty, isEqual, throttle, debounce, xor, upperFirst, escapeRegExp, flow, filter, reduce } from 'lodash/fp';
|
|
38
38
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
39
39
|
import ReactDOM from 'react-dom';
|
|
40
|
-
import { connect,
|
|
40
|
+
import { connect, useDispatch, useSelector, Provider } from 'react-redux';
|
|
41
41
|
import { combineReducers, createStore as createStore$1, applyMiddleware } from 'redux';
|
|
42
42
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
43
43
|
import 'redux-logger';
|
|
@@ -386,8 +386,8 @@ function exec(action) {
|
|
|
386
386
|
return enabled;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
function ownKeys$
|
|
390
|
-
function _objectSpread$
|
|
389
|
+
function ownKeys$12(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; }
|
|
390
|
+
function _objectSpread$12(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$12(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$12(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
391
391
|
var editor = {
|
|
392
392
|
resetToSelect: {
|
|
393
393
|
title: 'Reset to Select Tool',
|
|
@@ -546,6 +546,12 @@ var render = {
|
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
548
|
var server = {
|
|
549
|
+
'dearomatize-on-load': {
|
|
550
|
+
title: 'dearomatize-on-load',
|
|
551
|
+
type: 'boolean',
|
|
552
|
+
description: 'slider',
|
|
553
|
+
"default": false
|
|
554
|
+
},
|
|
549
555
|
'smart-layout': {
|
|
550
556
|
title: 'Smart-layout',
|
|
551
557
|
type: 'boolean',
|
|
@@ -629,7 +635,7 @@ var optionsSchema = {
|
|
|
629
635
|
title: 'Settings',
|
|
630
636
|
type: 'object',
|
|
631
637
|
required: [],
|
|
632
|
-
properties: _objectSpread$
|
|
638
|
+
properties: _objectSpread$12(_objectSpread$12(_objectSpread$12(_objectSpread$12(_objectSpread$12({}, editor), render), server), debug), miew)
|
|
633
639
|
};
|
|
634
640
|
function getDefaultOptions() {
|
|
635
641
|
if (!optionsSchema.properties) return {};
|
|
@@ -690,8 +696,8 @@ var storage = {
|
|
|
690
696
|
}
|
|
691
697
|
};
|
|
692
698
|
|
|
693
|
-
function ownKeys$
|
|
694
|
-
function _objectSpread$
|
|
699
|
+
function ownKeys$11(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; }
|
|
700
|
+
function _objectSpread$11(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$11(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$11(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
695
701
|
var initOptionsState = {
|
|
696
702
|
app: {
|
|
697
703
|
server: false,
|
|
@@ -787,27 +793,27 @@ function optionsReducer() {
|
|
|
787
793
|
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
788
794
|
var type = action.type,
|
|
789
795
|
data = action.data;
|
|
790
|
-
if (type === 'APP_OPTIONS') return _objectSpread$
|
|
791
|
-
app: _objectSpread$
|
|
796
|
+
if (type === 'APP_OPTIONS') return _objectSpread$11(_objectSpread$11({}, state), {}, {
|
|
797
|
+
app: _objectSpread$11(_objectSpread$11({}, state.app), data)
|
|
792
798
|
});
|
|
793
|
-
if (type === 'SAVE_SETTINGS') return _objectSpread$
|
|
799
|
+
if (type === 'SAVE_SETTINGS') return _objectSpread$11(_objectSpread$11({}, state), {}, {
|
|
794
800
|
settings: data
|
|
795
801
|
});
|
|
796
|
-
if (type === 'SAVE_CHECK_OPTS') return _objectSpread$
|
|
802
|
+
if (type === 'SAVE_CHECK_OPTS') return _objectSpread$11(_objectSpread$11({}, state), {}, {
|
|
797
803
|
check: data
|
|
798
804
|
});
|
|
799
|
-
if (type === 'CHANGE_ANALYSE') return _objectSpread$
|
|
800
|
-
analyse: _objectSpread$
|
|
805
|
+
if (type === 'CHANGE_ANALYSE') return _objectSpread$11(_objectSpread$11({}, state), {}, {
|
|
806
|
+
analyse: _objectSpread$11(_objectSpread$11(_objectSpread$11({}, state.analyse), data), {}, {
|
|
801
807
|
loading: false
|
|
802
808
|
})
|
|
803
809
|
});
|
|
804
|
-
if (type === 'ANALYSE_LOADING') return _objectSpread$
|
|
805
|
-
analyse: _objectSpread$
|
|
810
|
+
if (type === 'ANALYSE_LOADING') return _objectSpread$11(_objectSpread$11({}, state), {}, {
|
|
811
|
+
analyse: _objectSpread$11(_objectSpread$11({}, state.analyse), {}, {
|
|
806
812
|
loading: true
|
|
807
813
|
})
|
|
808
814
|
});
|
|
809
|
-
if (recognizeActions.includes(type)) return _objectSpread$
|
|
810
|
-
recognize: _objectSpread$
|
|
815
|
+
if (recognizeActions.includes(type)) return _objectSpread$11(_objectSpread$11({}, state), {}, {
|
|
816
|
+
recognize: _objectSpread$11(_objectSpread$11({}, state.recognize), data)
|
|
811
817
|
});
|
|
812
818
|
return state;
|
|
813
819
|
}
|
|
@@ -1103,8 +1109,8 @@ function getSdataDefault(context, fieldName) {
|
|
|
1103
1109
|
return sdataSchema[context][fieldName] ? sdataSchema[context][fieldName].properties.fieldValue["default"] : '';
|
|
1104
1110
|
}
|
|
1105
1111
|
|
|
1106
|
-
function ownKeys
|
|
1107
|
-
function _objectSpread
|
|
1112
|
+
function ownKeys$10(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; }
|
|
1113
|
+
function _objectSpread$10(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$10(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$10(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1108
1114
|
var initSdata = function initSdata() {
|
|
1109
1115
|
var context = getSdataDefault();
|
|
1110
1116
|
var fieldName = getSdataDefault(context);
|
|
@@ -1124,7 +1130,7 @@ var initSdata = function initSdata() {
|
|
|
1124
1130
|
};
|
|
1125
1131
|
function sdataReducer(state, action) {
|
|
1126
1132
|
if (action.data.result.init) {
|
|
1127
|
-
return correctErrors(_objectSpread
|
|
1133
|
+
return correctErrors(_objectSpread$10(_objectSpread$10({}, state), {}, {
|
|
1128
1134
|
result: Object.assign({}, state.result, action.data.result)
|
|
1129
1135
|
}), action.data);
|
|
1130
1136
|
}
|
|
@@ -1132,7 +1138,7 @@ function sdataReducer(state, action) {
|
|
|
1132
1138
|
var actionFieldName = action.data.result.fieldName;
|
|
1133
1139
|
var newstate = null;
|
|
1134
1140
|
if (actionContext !== state.result.context) newstate = onContextChange(state, action.data.result);else if (actionFieldName !== state.result.fieldName) newstate = onFieldNameChange(state, action.data.result);
|
|
1135
|
-
newstate = newstate || _objectSpread
|
|
1141
|
+
newstate = newstate || _objectSpread$10(_objectSpread$10({}, state), {}, {
|
|
1136
1142
|
result: Object.assign({}, state.result, action.data.result)
|
|
1137
1143
|
});
|
|
1138
1144
|
return correctErrors(newstate, action.data);
|
|
@@ -1156,7 +1162,7 @@ var onContextChange = function onContextChange(state, payload) {
|
|
|
1156
1162
|
var fValue = fieldValue;
|
|
1157
1163
|
if (fValue === state.result.fieldValue) fValue = getSdataDefault(context, fieldName);
|
|
1158
1164
|
return {
|
|
1159
|
-
result: _objectSpread
|
|
1165
|
+
result: _objectSpread$10(_objectSpread$10({}, payload), {}, {
|
|
1160
1166
|
context: context,
|
|
1161
1167
|
fieldName: fieldName,
|
|
1162
1168
|
fieldValue: fValue
|
|
@@ -1170,7 +1176,7 @@ var onFieldNameChange = function onFieldNameChange(state, payload) {
|
|
|
1170
1176
|
if (sdataSchema[context][fieldName]) fieldValue = getSdataDefault(context, fieldName);
|
|
1171
1177
|
if (fieldValue === state.result.fieldValue && sdataSchema[context][state.result.fieldName]) fieldValue = '';
|
|
1172
1178
|
return {
|
|
1173
|
-
result: _objectSpread
|
|
1179
|
+
result: _objectSpread$10(_objectSpread$10({}, payload), {}, {
|
|
1174
1180
|
fieldName: fieldName,
|
|
1175
1181
|
fieldValue: fieldValue
|
|
1176
1182
|
})
|
|
@@ -1308,8 +1314,8 @@ function formReducer(state, action, formName) {
|
|
|
1308
1314
|
var INDIGO_VERIFICATION = 'INDIGO_VERIFICATION';
|
|
1309
1315
|
var ANALYZING_FILE = 'ANALYZING_FILE';
|
|
1310
1316
|
|
|
1311
|
-
function ownKeys
|
|
1312
|
-
function _objectSpread
|
|
1317
|
+
function ownKeys$$(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; }
|
|
1318
|
+
function _objectSpread$$(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$$(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$$(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1313
1319
|
function indigoVerification(data) {
|
|
1314
1320
|
return {
|
|
1315
1321
|
type: INDIGO_VERIFICATION,
|
|
@@ -1334,13 +1340,13 @@ function requestReducer () {
|
|
|
1334
1340
|
switch (type) {
|
|
1335
1341
|
case INDIGO_VERIFICATION:
|
|
1336
1342
|
{
|
|
1337
|
-
return _objectSpread
|
|
1343
|
+
return _objectSpread$$(_objectSpread$$({}, state), {}, {
|
|
1338
1344
|
indigoVerification: data
|
|
1339
1345
|
});
|
|
1340
1346
|
}
|
|
1341
1347
|
case ANALYZING_FILE:
|
|
1342
1348
|
{
|
|
1343
|
-
return _objectSpread
|
|
1349
|
+
return _objectSpread$$(_objectSpread$$({}, state), {}, {
|
|
1344
1350
|
isAnalyzingFile: data
|
|
1345
1351
|
});
|
|
1346
1352
|
}
|
|
@@ -1613,12 +1619,12 @@ var attachSchema = {
|
|
|
1613
1619
|
};
|
|
1614
1620
|
|
|
1615
1621
|
var _excluded$E = ["type", "radiobuttons"];
|
|
1616
|
-
function ownKeys$
|
|
1617
|
-
function _objectSpread$
|
|
1622
|
+
function ownKeys$_(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; }
|
|
1623
|
+
function _objectSpread$_(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$_(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$_(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1618
1624
|
var DefaultStereoGroupNumber = 1;
|
|
1619
1625
|
function fromElement(selem) {
|
|
1620
1626
|
if (selem.label === 'R#') {
|
|
1621
|
-
return _objectSpread$
|
|
1627
|
+
return _objectSpread$_({
|
|
1622
1628
|
type: 'rlabel',
|
|
1623
1629
|
values: fromRlabel(selem.rglabel)
|
|
1624
1630
|
}, selem);
|
|
@@ -1668,14 +1674,15 @@ function fromAtom(satom) {
|
|
|
1668
1674
|
};
|
|
1669
1675
|
}
|
|
1670
1676
|
function toAtom(atom$1) {
|
|
1677
|
+
var _atom$exactChangeFlag, _atom$unsaturatedAtom;
|
|
1671
1678
|
var chargeRegexp = new RegExp(atom.properties.charge.pattern);
|
|
1672
1679
|
var pch = chargeRegexp.exec(atom$1.charge);
|
|
1673
1680
|
var charge = pch ? parseInt(pch[1] + pch[3] + pch[2]) : atom$1.charge;
|
|
1674
1681
|
var conv = Object.assign({}, atom$1, {
|
|
1675
1682
|
label: capitalize(atom$1.label),
|
|
1676
1683
|
alias: atom$1.alias || null,
|
|
1677
|
-
exactChangeFlag: +atom$1.exactChangeFlag,
|
|
1678
|
-
unsaturatedAtom: +atom$1.unsaturatedAtom
|
|
1684
|
+
exactChangeFlag: +((_atom$exactChangeFlag = atom$1.exactChangeFlag) !== null && _atom$exactChangeFlag !== void 0 ? _atom$exactChangeFlag : false),
|
|
1685
|
+
unsaturatedAtom: +((_atom$unsaturatedAtom = atom$1.unsaturatedAtom) !== null && _atom$unsaturatedAtom !== void 0 ? _atom$unsaturatedAtom : false)
|
|
1679
1686
|
});
|
|
1680
1687
|
if (charge !== undefined) conv.charge = charge;
|
|
1681
1688
|
return conv;
|
|
@@ -1777,7 +1784,7 @@ function fromBond(sbond) {
|
|
|
1777
1784
|
};
|
|
1778
1785
|
}
|
|
1779
1786
|
function toBond(bond) {
|
|
1780
|
-
return _objectSpread$
|
|
1787
|
+
return _objectSpread$_({
|
|
1781
1788
|
topology: bond.topology,
|
|
1782
1789
|
reactingCenterStatus: bond.center
|
|
1783
1790
|
}, toBondType(bond.type));
|
|
@@ -1867,7 +1874,7 @@ function toSgroup(sgroup) {
|
|
|
1867
1874
|
var type = sgroup.type,
|
|
1868
1875
|
radiobuttons = sgroup.radiobuttons,
|
|
1869
1876
|
props = _objectWithoutProperties(sgroup, _excluded$E);
|
|
1870
|
-
var attrs = _objectSpread$
|
|
1877
|
+
var attrs = _objectSpread$_({}, props);
|
|
1871
1878
|
var absolute = 'absolute';
|
|
1872
1879
|
var attached = 'attached';
|
|
1873
1880
|
switch (radiobuttons) {
|
|
@@ -2368,6 +2375,8 @@ var tools$1 = typeSchema$1["enum"].reduce(function (res, type, i) {
|
|
|
2368
2375
|
}, toolActions);
|
|
2369
2376
|
|
|
2370
2377
|
var _excluded$D = ["rescale", "fragment"];
|
|
2378
|
+
function ownKeys$Z(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; }
|
|
2379
|
+
function _objectSpread$Z(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$Z(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$Z(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2371
2380
|
function onAction(action) {
|
|
2372
2381
|
if (action && action.dialog) {
|
|
2373
2382
|
return {
|
|
@@ -2414,27 +2423,30 @@ function load(struct, options) {
|
|
|
2414
2423
|
server = state.server;
|
|
2415
2424
|
errorHandler = editor.errorHandler;
|
|
2416
2425
|
options = options || {};
|
|
2426
|
+
options = _objectSpread$Z(_objectSpread$Z({}, options), {}, {
|
|
2427
|
+
'dearomatize-on-load': editor.options()['dearomatize-on-load']
|
|
2428
|
+
});
|
|
2417
2429
|
dispatch(setAnalyzingFile(true));
|
|
2418
|
-
_context.prev =
|
|
2419
|
-
_context.next =
|
|
2430
|
+
_context.prev = 7;
|
|
2431
|
+
_context.next = 10;
|
|
2420
2432
|
return parseStruct(struct, server, options);
|
|
2421
|
-
case
|
|
2433
|
+
case 10:
|
|
2422
2434
|
parsedStruct = _context.sent;
|
|
2423
2435
|
_options2 = options, fragment = _options2.fragment;
|
|
2424
2436
|
hasUnsupportedGroups = parsedStruct.sgroups.some(function (sGroup) {
|
|
2425
2437
|
return !supportedSGroupTypes[sGroup.type];
|
|
2426
2438
|
});
|
|
2427
2439
|
if (!hasUnsupportedGroups) {
|
|
2428
|
-
_context.next =
|
|
2440
|
+
_context.next = 17;
|
|
2429
2441
|
break;
|
|
2430
2442
|
}
|
|
2431
|
-
_context.next =
|
|
2443
|
+
_context.next = 16;
|
|
2432
2444
|
return editor.event.confirm.dispatch();
|
|
2433
|
-
case
|
|
2445
|
+
case 16:
|
|
2434
2446
|
parsedStruct.sgroups = parsedStruct.sgroups.filter(function (key, sGroup) {
|
|
2435
2447
|
return supportedSGroupTypes[sGroup.type];
|
|
2436
2448
|
});
|
|
2437
|
-
case
|
|
2449
|
+
case 17:
|
|
2438
2450
|
parsedStruct.rescale();
|
|
2439
2451
|
if (editor.struct().atoms.size) {
|
|
2440
2452
|
oldStruct = editor.struct().clone();
|
|
@@ -2481,19 +2493,19 @@ function load(struct, options) {
|
|
|
2481
2493
|
dispatch({
|
|
2482
2494
|
type: 'MODAL_CLOSE'
|
|
2483
2495
|
});
|
|
2484
|
-
_context.next =
|
|
2496
|
+
_context.next = 33;
|
|
2485
2497
|
break;
|
|
2486
|
-
case
|
|
2487
|
-
_context.prev =
|
|
2488
|
-
_context.t0 = _context["catch"](
|
|
2498
|
+
case 29:
|
|
2499
|
+
_context.prev = 29;
|
|
2500
|
+
_context.t0 = _context["catch"](7);
|
|
2489
2501
|
dispatch(setAnalyzingFile(false));
|
|
2490
2502
|
_context.t0 && errorHandler(_context.t0.message);
|
|
2491
|
-
case
|
|
2503
|
+
case 33:
|
|
2492
2504
|
case "end":
|
|
2493
2505
|
return _context.stop();
|
|
2494
2506
|
}
|
|
2495
2507
|
}
|
|
2496
|
-
}, _callee, null, [[
|
|
2508
|
+
}, _callee, null, [[7, 29]]);
|
|
2497
2509
|
}));
|
|
2498
2510
|
return function (_x, _x2) {
|
|
2499
2511
|
return _ref.apply(this, arguments);
|
|
@@ -2838,7 +2850,7 @@ var zoom = {
|
|
|
2838
2850
|
|
|
2839
2851
|
var openHelpLink = function openHelpLink() {
|
|
2840
2852
|
var _window$open;
|
|
2841
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.
|
|
2853
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.6.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
2842
2854
|
};
|
|
2843
2855
|
var help = {
|
|
2844
2856
|
help: {
|
|
@@ -8024,6 +8036,45 @@ var useInterval = function useInterval(callback, delay) {
|
|
|
8024
8036
|
}, [delay]);
|
|
8025
8037
|
};
|
|
8026
8038
|
|
|
8039
|
+
var KETCHER_INIT_EVENT_NAME = 'ketcher-init';
|
|
8040
|
+
|
|
8041
|
+
var useSubscriptionOnEvents = function useSubscriptionOnEvents() {
|
|
8042
|
+
var dispatch = useDispatch();
|
|
8043
|
+
var _useAppContext = useAppContext(),
|
|
8044
|
+
getKetcherInstance = _useAppContext.getKetcherInstance;
|
|
8045
|
+
var loadingHandler = function loadingHandler() {
|
|
8046
|
+
dispatch(indigoVerification(true));
|
|
8047
|
+
};
|
|
8048
|
+
var actionResultHandler = function actionResultHandler() {
|
|
8049
|
+
dispatch(indigoVerification(false));
|
|
8050
|
+
};
|
|
8051
|
+
var subscribe = function subscribe(ketcher) {
|
|
8052
|
+
ketcher.eventBus.addListener(KetcherAsyncEvents.LOADING, loadingHandler);
|
|
8053
|
+
ketcher.eventBus.addListener(KetcherAsyncEvents.SUCCESS, actionResultHandler);
|
|
8054
|
+
ketcher.eventBus.addListener(KetcherAsyncEvents.FAILURE, actionResultHandler);
|
|
8055
|
+
};
|
|
8056
|
+
var unsubscribe = function unsubscribe(ketcher) {
|
|
8057
|
+
ketcher.eventBus.removeListener(KetcherAsyncEvents.LOADING, loadingHandler);
|
|
8058
|
+
ketcher.eventBus.removeListener(KetcherAsyncEvents.SUCCESS, actionResultHandler);
|
|
8059
|
+
ketcher.eventBus.removeListener(KetcherAsyncEvents.FAILURE, actionResultHandler);
|
|
8060
|
+
};
|
|
8061
|
+
useEffect(function () {
|
|
8062
|
+
var subscribeOnInit = function subscribeOnInit() {
|
|
8063
|
+
subscribe(getKetcherInstance());
|
|
8064
|
+
};
|
|
8065
|
+
var unsubscribeOnUnMount = function unsubscribeOnUnMount() {
|
|
8066
|
+
unsubscribe(getKetcherInstance());
|
|
8067
|
+
};
|
|
8068
|
+
window.addEventListener(KETCHER_INIT_EVENT_NAME, function () {
|
|
8069
|
+
subscribeOnInit();
|
|
8070
|
+
});
|
|
8071
|
+
return function () {
|
|
8072
|
+
unsubscribeOnUnMount();
|
|
8073
|
+
window.removeEventListener(KETCHER_INIT_EVENT_NAME, subscribeOnInit);
|
|
8074
|
+
};
|
|
8075
|
+
}, []);
|
|
8076
|
+
};
|
|
8077
|
+
|
|
8027
8078
|
var ArrowScroll = function ArrowScroll(_ref) {
|
|
8028
8079
|
var startInView = _ref.startInView,
|
|
8029
8080
|
endInView = _ref.endInView,
|
|
@@ -10499,10 +10550,10 @@ var APointTool = function () {
|
|
|
10499
10550
|
key: "mousemove",
|
|
10500
10551
|
value: function mousemove(event) {
|
|
10501
10552
|
var struct = this.editor.render.ctab.molecule;
|
|
10502
|
-
var
|
|
10503
|
-
if (
|
|
10504
|
-
var atom = struct.atoms.get(
|
|
10505
|
-
if ((atom === null || atom === void 0 ? void 0 : atom.label) !== 'R#' && (atom === null || atom === void 0 ? void 0 : atom.rglabel) === null) this.editor.hover(
|
|
10553
|
+
var closestItem = this.editor.findItem(event, ['atoms']);
|
|
10554
|
+
if (closestItem) {
|
|
10555
|
+
var atom = struct.atoms.get(closestItem.id);
|
|
10556
|
+
if ((atom === null || atom === void 0 ? void 0 : atom.label) !== 'R#' && (atom === null || atom === void 0 ? void 0 : atom.rglabel) === null) this.editor.hover(closestItem);
|
|
10506
10557
|
} else {
|
|
10507
10558
|
this.editor.hover(null);
|
|
10508
10559
|
}
|
|
@@ -14439,12 +14490,12 @@ var TextTool = function () {
|
|
|
14439
14490
|
key: "mousedown",
|
|
14440
14491
|
value: function mousedown(event) {
|
|
14441
14492
|
var render = this.editor.render;
|
|
14442
|
-
var
|
|
14493
|
+
var closestItem = this.editor.findItem(event, ['texts']);
|
|
14443
14494
|
this.editor.selection(null);
|
|
14444
|
-
if (
|
|
14495
|
+
if (closestItem && closestItem.map === 'texts') {
|
|
14445
14496
|
this.editor.hover(null);
|
|
14446
14497
|
this.editor.selection({
|
|
14447
|
-
texts: [
|
|
14498
|
+
texts: [closestItem.id]
|
|
14448
14499
|
});
|
|
14449
14500
|
this.dragCtx = {
|
|
14450
14501
|
xy0: render.page2obj(event),
|
|
@@ -14479,27 +14530,27 @@ var TextTool = function () {
|
|
|
14479
14530
|
key: "click",
|
|
14480
14531
|
value: function click(event) {
|
|
14481
14532
|
var render = this.editor.render;
|
|
14482
|
-
var
|
|
14533
|
+
var closestItem = this.editor.findItem(event, ['texts']);
|
|
14483
14534
|
this.editor.hover(null);
|
|
14484
|
-
if (!
|
|
14485
|
-
propsDialog(this.editor, null, render.page2obj(event));
|
|
14535
|
+
if (!closestItem) {
|
|
14536
|
+
propsDialog(this.editor, null, render.page2obj(event), []);
|
|
14486
14537
|
}
|
|
14487
14538
|
return true;
|
|
14488
14539
|
}
|
|
14489
14540
|
}, {
|
|
14490
14541
|
key: "dblclick",
|
|
14491
14542
|
value: function dblclick(event) {
|
|
14492
|
-
var
|
|
14543
|
+
var closestItem = this.editor.findItem(event, ['texts']);
|
|
14493
14544
|
this.editor.hover(null);
|
|
14494
|
-
if (
|
|
14495
|
-
propsDialog(this.editor,
|
|
14545
|
+
if (closestItem.map === 'texts') {
|
|
14546
|
+
propsDialog(this.editor, closestItem.id, closestItem.position, closestItem.pos);
|
|
14496
14547
|
}
|
|
14497
14548
|
return true;
|
|
14498
14549
|
}
|
|
14499
14550
|
}]);
|
|
14500
14551
|
return TextTool;
|
|
14501
14552
|
}();
|
|
14502
|
-
function propsDialog(editor, id, position) {
|
|
14553
|
+
function propsDialog(editor, id, position, pos) {
|
|
14503
14554
|
var struct = editor.render.ctab.molecule;
|
|
14504
14555
|
var text = id || id === 0 ? struct.texts.get(id) : null;
|
|
14505
14556
|
var origilContent = text ? text.content : '';
|
|
@@ -14507,12 +14558,13 @@ function propsDialog(editor, id, position) {
|
|
|
14507
14558
|
content: origilContent,
|
|
14508
14559
|
id: id,
|
|
14509
14560
|
position: position,
|
|
14561
|
+
pos: pos,
|
|
14510
14562
|
type: 'text'
|
|
14511
14563
|
});
|
|
14512
14564
|
res.then(function (_ref) {
|
|
14513
14565
|
var content = _ref.content;
|
|
14514
14566
|
if (!id && id !== 0 && content) {
|
|
14515
|
-
editor.update(fromTextCreation(editor.render.ctab, content, position));
|
|
14567
|
+
editor.update(fromTextCreation(editor.render.ctab, content, position, pos));
|
|
14516
14568
|
} else if (!content) {
|
|
14517
14569
|
editor.update(fromTextDeletion(editor.render.ctab, id));
|
|
14518
14570
|
} else if (content !== origilContent) {
|
|
@@ -14674,6 +14726,8 @@ var Editor$3 = function () {
|
|
|
14674
14726
|
this.historyPtr = 0;
|
|
14675
14727
|
this.errorHandler = null;
|
|
14676
14728
|
this.highlights = new Highlighter(this);
|
|
14729
|
+
this.renderAndRecoordinateStruct = this.renderAndRecoordinateStruct.bind(this);
|
|
14730
|
+
this.setOptions = this.setOptions.bind(this);
|
|
14677
14731
|
this.event = {
|
|
14678
14732
|
message: new Subscription(),
|
|
14679
14733
|
elementEdit: new PipelineSubscription(),
|
|
@@ -14731,6 +14785,15 @@ var Editor$3 = function () {
|
|
|
14731
14785
|
value: function clear() {
|
|
14732
14786
|
this.struct(undefined);
|
|
14733
14787
|
}
|
|
14788
|
+
}, {
|
|
14789
|
+
key: "renderAndRecoordinateStruct",
|
|
14790
|
+
value: function renderAndRecoordinateStruct(struct) {
|
|
14791
|
+
var action = fromNewCanvas(this.render.ctab, struct);
|
|
14792
|
+
this.update(action);
|
|
14793
|
+
getStructCenter(this.render.ctab);
|
|
14794
|
+
recoordinate(this);
|
|
14795
|
+
return this.render.ctab.molecule;
|
|
14796
|
+
}
|
|
14734
14797
|
}, {
|
|
14735
14798
|
key: "struct",
|
|
14736
14799
|
value: function struct(value) {
|
|
@@ -14739,11 +14802,18 @@ var Editor$3 = function () {
|
|
|
14739
14802
|
}
|
|
14740
14803
|
this.selection(null);
|
|
14741
14804
|
var struct = value || new Struct();
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14805
|
+
return this.renderAndRecoordinateStruct(struct);
|
|
14806
|
+
}
|
|
14807
|
+
}, {
|
|
14808
|
+
key: "structToAddFragment",
|
|
14809
|
+
value: function structToAddFragment(value) {
|
|
14810
|
+
var superStruct = value.mergeInto(this.render.ctab.molecule);
|
|
14811
|
+
return this.renderAndRecoordinateStruct(superStruct);
|
|
14812
|
+
}
|
|
14813
|
+
}, {
|
|
14814
|
+
key: "setOptions",
|
|
14815
|
+
value: function setOptions(opts) {
|
|
14816
|
+
return this.render.updateOptions(opts);
|
|
14747
14817
|
}
|
|
14748
14818
|
}, {
|
|
14749
14819
|
key: "options",
|
|
@@ -15258,8 +15328,12 @@ function setupEditor(editor, props) {
|
|
|
15258
15328
|
Object.keys(editor.event).forEach(function (name) {
|
|
15259
15329
|
var eventName = "on".concat(upperFirst(name));
|
|
15260
15330
|
if (props[eventName] !== oldProps[eventName]) {
|
|
15261
|
-
if (oldProps[eventName])
|
|
15262
|
-
|
|
15331
|
+
if (oldProps[eventName]) {
|
|
15332
|
+
editor.event[name].remove(oldProps[eventName]);
|
|
15333
|
+
}
|
|
15334
|
+
if (props[eventName]) {
|
|
15335
|
+
editor.event[name].add(props[eventName]);
|
|
15336
|
+
}
|
|
15263
15337
|
}
|
|
15264
15338
|
});
|
|
15265
15339
|
}
|
|
@@ -18987,7 +19061,8 @@ var SaveDialog = function (_Component) {
|
|
|
18987
19061
|
}) : _this.isImageFormat(format) ? jsx("div", {
|
|
18988
19062
|
className: classes$j.imageContainer,
|
|
18989
19063
|
children: !isCleanStruct && jsx("img", {
|
|
18990
|
-
src: "data:image/".concat(format, "+xml;base64,").concat(imageSrc)
|
|
19064
|
+
src: "data:image/".concat(format, "+xml;base64,").concat(imageSrc),
|
|
19065
|
+
alt: "".concat(format, " preview")
|
|
18991
19066
|
})
|
|
18992
19067
|
}) : jsx("div", {
|
|
18993
19068
|
className: classes$j.previewBackground,
|
|
@@ -19082,7 +19157,7 @@ var SaveDialog = function (_Component) {
|
|
|
19082
19157
|
_this.isRxn = _this.props.struct.hasRxnArrow();
|
|
19083
19158
|
_this.textAreaRef = createRef();
|
|
19084
19159
|
var formats = [_this.isRxn ? 'rxn' : 'mol', 'smiles', 'ket'];
|
|
19085
|
-
if (_this.props.server) formats.push(_this.isRxn ? 'rxnV3000' : 'molV3000', 'smilesExt', 'smarts', 'inChI', 'inChIAuxInfo', 'cml', 'svg', 'png');
|
|
19160
|
+
if (_this.props.server) formats.push(_this.isRxn ? 'rxnV3000' : 'molV3000', 'smilesExt', 'smarts', 'inChI', 'inChIAuxInfo', 'cml', 'svg', 'png', 'cdxml');
|
|
19086
19161
|
_this.saveSchema = saveSchema;
|
|
19087
19162
|
_this.saveSchema.properties.format = Object.assign(_this.saveSchema.properties.format, {
|
|
19088
19163
|
"enum": formats,
|
|
@@ -21141,7 +21216,7 @@ var Text = function Text(props) {
|
|
|
21141
21216
|
};
|
|
21142
21217
|
};
|
|
21143
21218
|
var keyBindingFn = function keyBindingFn(e) {
|
|
21144
|
-
if (e.
|
|
21219
|
+
if (e.key === 'Enter') {
|
|
21145
21220
|
e.stopPropagation();
|
|
21146
21221
|
}
|
|
21147
21222
|
return getDefaultKeyBinding(e);
|
|
@@ -21559,6 +21634,7 @@ var App = function App(props) {
|
|
|
21559
21634
|
var checkServer = props.checkServer;
|
|
21560
21635
|
var _useSettingsContext = useSettingsContext(),
|
|
21561
21636
|
staticResourcesUrl = _useSettingsContext.staticResourcesUrl;
|
|
21637
|
+
useSubscriptionOnEvents();
|
|
21562
21638
|
useEffect(function () {
|
|
21563
21639
|
checkServer();
|
|
21564
21640
|
dispatch(initFGTemplates(staticResourcesUrl));
|
|
@@ -21635,7 +21711,8 @@ var KetcherBuilder = function () {
|
|
|
21635
21711
|
'ignore-stereochemistry-errors': true,
|
|
21636
21712
|
'mass-skip-error-on-pseudoatoms': false,
|
|
21637
21713
|
'gross-formula-add-rsites': true,
|
|
21638
|
-
'aromatize-skip-superatoms': true
|
|
21714
|
+
'aromatize-skip-superatoms': true,
|
|
21715
|
+
'dearomatize-on-load': false
|
|
21639
21716
|
});
|
|
21640
21717
|
case 1:
|
|
21641
21718
|
case "end":
|
|
@@ -21669,8 +21746,8 @@ var KetcherBuilder = function () {
|
|
|
21669
21746
|
initApp(element, staticResourcesUrl, {
|
|
21670
21747
|
buttons: buttons || {},
|
|
21671
21748
|
errorHandler: errorHandler || null,
|
|
21672
|
-
version: "2.
|
|
21673
|
-
buildDate: "2022-
|
|
21749
|
+
version: "2.6.0-rc.2" ,
|
|
21750
|
+
buildDate: "2022-10-21T11:30:05" ,
|
|
21674
21751
|
buildNumber: ''
|
|
21675
21752
|
}, structService, resolve);
|
|
21676
21753
|
});
|
|
@@ -21763,12 +21840,14 @@ function Editor(props) {
|
|
|
21763
21840
|
}),
|
|
21764
21841
|
height = _useResizeObserver.height,
|
|
21765
21842
|
width = _useResizeObserver.width;
|
|
21843
|
+
var ketcherInitEvent = new Event(KETCHER_INIT_EVENT_NAME);
|
|
21766
21844
|
useEffect(function () {
|
|
21767
21845
|
buildKetcherAsync(_objectSpread(_objectSpread({}, props), {}, {
|
|
21768
21846
|
element: rootElRef.current
|
|
21769
21847
|
})).then(function (ketcher) {
|
|
21770
21848
|
if (typeof onInit === 'function') {
|
|
21771
21849
|
onInit(ketcher);
|
|
21850
|
+
window.dispatchEvent(ketcherInitEvent);
|
|
21772
21851
|
}
|
|
21773
21852
|
});
|
|
21774
21853
|
}, []);
|
|
@@ -21778,5 +21857,5 @@ function Editor(props) {
|
|
|
21778
21857
|
});
|
|
21779
21858
|
}
|
|
21780
21859
|
|
|
21781
|
-
export { Editor };
|
|
21860
|
+
export { Editor, KETCHER_INIT_EVENT_NAME };
|
|
21782
21861
|
//# sourceMappingURL=index.modern.js.map
|