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.
@@ -0,0 +1,16 @@
1
+ /****************************************************************************
2
+ * Copyright 2021 EPAM Systems
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ ***************************************************************************/
16
+ export declare const KETCHER_INIT_EVENT_NAME = "ketcher-init";
@@ -18,3 +18,4 @@ export * from './useResizeObserver';
18
18
  export * from './useFormContext';
19
19
  export * from './useAppContext';
20
20
  export * from './useInterval';
21
+ export * from './useSubscribtionOnEvents';
@@ -0,0 +1,16 @@
1
+ /****************************************************************************
2
+ * Copyright 2021 EPAM Systems
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ ***************************************************************************/
16
+ export declare const useSubscriptionOnEvents: () => void;
package/dist/index.d.ts CHANGED
@@ -15,3 +15,4 @@
15
15
  ***************************************************************************/
16
16
  export * from './Editor';
17
17
  export * from './script';
18
+ export * from './constants';
package/dist/index.js CHANGED
@@ -447,8 +447,8 @@ function exec(action) {
447
447
  return enabled;
448
448
  }
449
449
 
450
- 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; }
451
- 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__default["default"](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; }
450
+ 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; }
451
+ 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__default["default"](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; }
452
452
  var editor = {
453
453
  resetToSelect: {
454
454
  title: 'Reset to Select Tool',
@@ -607,6 +607,12 @@ var render = {
607
607
  }
608
608
  };
609
609
  var server = {
610
+ 'dearomatize-on-load': {
611
+ title: 'dearomatize-on-load',
612
+ type: 'boolean',
613
+ description: 'slider',
614
+ "default": false
615
+ },
610
616
  'smart-layout': {
611
617
  title: 'Smart-layout',
612
618
  type: 'boolean',
@@ -690,7 +696,7 @@ var optionsSchema = {
690
696
  title: 'Settings',
691
697
  type: 'object',
692
698
  required: [],
693
- properties: _objectSpread$11(_objectSpread$11(_objectSpread$11(_objectSpread$11(_objectSpread$11({}, editor), render), server), debug), miew)
699
+ properties: _objectSpread$12(_objectSpread$12(_objectSpread$12(_objectSpread$12(_objectSpread$12({}, editor), render), server), debug), miew)
694
700
  };
695
701
  function getDefaultOptions() {
696
702
  if (!optionsSchema.properties) return {};
@@ -751,8 +757,8 @@ var storage = {
751
757
  }
752
758
  };
753
759
 
754
- 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; }
755
- 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__default["default"](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; }
760
+ 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; }
761
+ 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__default["default"](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; }
756
762
  var initOptionsState = {
757
763
  app: {
758
764
  server: false,
@@ -848,27 +854,27 @@ function optionsReducer() {
848
854
  var action = arguments.length > 1 ? arguments[1] : undefined;
849
855
  var type = action.type,
850
856
  data = action.data;
851
- if (type === 'APP_OPTIONS') return _objectSpread$10(_objectSpread$10({}, state), {}, {
852
- app: _objectSpread$10(_objectSpread$10({}, state.app), data)
857
+ if (type === 'APP_OPTIONS') return _objectSpread$11(_objectSpread$11({}, state), {}, {
858
+ app: _objectSpread$11(_objectSpread$11({}, state.app), data)
853
859
  });
854
- if (type === 'SAVE_SETTINGS') return _objectSpread$10(_objectSpread$10({}, state), {}, {
860
+ if (type === 'SAVE_SETTINGS') return _objectSpread$11(_objectSpread$11({}, state), {}, {
855
861
  settings: data
856
862
  });
857
- if (type === 'SAVE_CHECK_OPTS') return _objectSpread$10(_objectSpread$10({}, state), {}, {
863
+ if (type === 'SAVE_CHECK_OPTS') return _objectSpread$11(_objectSpread$11({}, state), {}, {
858
864
  check: data
859
865
  });
860
- if (type === 'CHANGE_ANALYSE') return _objectSpread$10(_objectSpread$10({}, state), {}, {
861
- analyse: _objectSpread$10(_objectSpread$10(_objectSpread$10({}, state.analyse), data), {}, {
866
+ if (type === 'CHANGE_ANALYSE') return _objectSpread$11(_objectSpread$11({}, state), {}, {
867
+ analyse: _objectSpread$11(_objectSpread$11(_objectSpread$11({}, state.analyse), data), {}, {
862
868
  loading: false
863
869
  })
864
870
  });
865
- if (type === 'ANALYSE_LOADING') return _objectSpread$10(_objectSpread$10({}, state), {}, {
866
- analyse: _objectSpread$10(_objectSpread$10({}, state.analyse), {}, {
871
+ if (type === 'ANALYSE_LOADING') return _objectSpread$11(_objectSpread$11({}, state), {}, {
872
+ analyse: _objectSpread$11(_objectSpread$11({}, state.analyse), {}, {
867
873
  loading: true
868
874
  })
869
875
  });
870
- if (recognizeActions.includes(type)) return _objectSpread$10(_objectSpread$10({}, state), {}, {
871
- recognize: _objectSpread$10(_objectSpread$10({}, state.recognize), data)
876
+ if (recognizeActions.includes(type)) return _objectSpread$11(_objectSpread$11({}, state), {}, {
877
+ recognize: _objectSpread$11(_objectSpread$11({}, state.recognize), data)
872
878
  });
873
879
  return state;
874
880
  }
@@ -1164,8 +1170,8 @@ function getSdataDefault(context, fieldName) {
1164
1170
  return sdataSchema[context][fieldName] ? sdataSchema[context][fieldName].properties.fieldValue["default"] : '';
1165
1171
  }
1166
1172
 
1167
- 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; }
1168
- 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__default["default"](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; }
1173
+ 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; }
1174
+ 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__default["default"](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; }
1169
1175
  var initSdata = function initSdata() {
1170
1176
  var context = getSdataDefault();
1171
1177
  var fieldName = getSdataDefault(context);
@@ -1185,7 +1191,7 @@ var initSdata = function initSdata() {
1185
1191
  };
1186
1192
  function sdataReducer(state, action) {
1187
1193
  if (action.data.result.init) {
1188
- return correctErrors(_objectSpread$$(_objectSpread$$({}, state), {}, {
1194
+ return correctErrors(_objectSpread$10(_objectSpread$10({}, state), {}, {
1189
1195
  result: Object.assign({}, state.result, action.data.result)
1190
1196
  }), action.data);
1191
1197
  }
@@ -1193,7 +1199,7 @@ function sdataReducer(state, action) {
1193
1199
  var actionFieldName = action.data.result.fieldName;
1194
1200
  var newstate = null;
1195
1201
  if (actionContext !== state.result.context) newstate = onContextChange(state, action.data.result);else if (actionFieldName !== state.result.fieldName) newstate = onFieldNameChange(state, action.data.result);
1196
- newstate = newstate || _objectSpread$$(_objectSpread$$({}, state), {}, {
1202
+ newstate = newstate || _objectSpread$10(_objectSpread$10({}, state), {}, {
1197
1203
  result: Object.assign({}, state.result, action.data.result)
1198
1204
  });
1199
1205
  return correctErrors(newstate, action.data);
@@ -1217,7 +1223,7 @@ var onContextChange = function onContextChange(state, payload) {
1217
1223
  var fValue = fieldValue;
1218
1224
  if (fValue === state.result.fieldValue) fValue = getSdataDefault(context, fieldName);
1219
1225
  return {
1220
- result: _objectSpread$$(_objectSpread$$({}, payload), {}, {
1226
+ result: _objectSpread$10(_objectSpread$10({}, payload), {}, {
1221
1227
  context: context,
1222
1228
  fieldName: fieldName,
1223
1229
  fieldValue: fValue
@@ -1231,7 +1237,7 @@ var onFieldNameChange = function onFieldNameChange(state, payload) {
1231
1237
  if (sdataSchema[context][fieldName]) fieldValue = getSdataDefault(context, fieldName);
1232
1238
  if (fieldValue === state.result.fieldValue && sdataSchema[context][state.result.fieldName]) fieldValue = '';
1233
1239
  return {
1234
- result: _objectSpread$$(_objectSpread$$({}, payload), {}, {
1240
+ result: _objectSpread$10(_objectSpread$10({}, payload), {}, {
1235
1241
  fieldName: fieldName,
1236
1242
  fieldValue: fieldValue
1237
1243
  })
@@ -1369,8 +1375,8 @@ function formReducer(state, action, formName) {
1369
1375
  var INDIGO_VERIFICATION = 'INDIGO_VERIFICATION';
1370
1376
  var ANALYZING_FILE = 'ANALYZING_FILE';
1371
1377
 
1372
- 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; }
1373
- 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__default["default"](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; }
1378
+ 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; }
1379
+ 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__default["default"](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; }
1374
1380
  function indigoVerification(data) {
1375
1381
  return {
1376
1382
  type: INDIGO_VERIFICATION,
@@ -1395,13 +1401,13 @@ function requestReducer () {
1395
1401
  switch (type) {
1396
1402
  case INDIGO_VERIFICATION:
1397
1403
  {
1398
- return _objectSpread$_(_objectSpread$_({}, state), {}, {
1404
+ return _objectSpread$$(_objectSpread$$({}, state), {}, {
1399
1405
  indigoVerification: data
1400
1406
  });
1401
1407
  }
1402
1408
  case ANALYZING_FILE:
1403
1409
  {
1404
- return _objectSpread$_(_objectSpread$_({}, state), {}, {
1410
+ return _objectSpread$$(_objectSpread$$({}, state), {}, {
1405
1411
  isAnalyzingFile: data
1406
1412
  });
1407
1413
  }
@@ -1674,12 +1680,12 @@ var attachSchema = {
1674
1680
  };
1675
1681
 
1676
1682
  var _excluded$E = ["type", "radiobuttons"];
1677
- 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; }
1678
- 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__default["default"](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; }
1683
+ 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; }
1684
+ 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__default["default"](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; }
1679
1685
  var DefaultStereoGroupNumber = 1;
1680
1686
  function fromElement(selem) {
1681
1687
  if (selem.label === 'R#') {
1682
- return _objectSpread$Z({
1688
+ return _objectSpread$_({
1683
1689
  type: 'rlabel',
1684
1690
  values: fromRlabel(selem.rglabel)
1685
1691
  }, selem);
@@ -1729,14 +1735,15 @@ function fromAtom(satom) {
1729
1735
  };
1730
1736
  }
1731
1737
  function toAtom(atom$1) {
1738
+ var _atom$exactChangeFlag, _atom$unsaturatedAtom;
1732
1739
  var chargeRegexp = new RegExp(atom.properties.charge.pattern);
1733
1740
  var pch = chargeRegexp.exec(atom$1.charge);
1734
1741
  var charge = pch ? parseInt(pch[1] + pch[3] + pch[2]) : atom$1.charge;
1735
1742
  var conv = Object.assign({}, atom$1, {
1736
1743
  label: fp.capitalize(atom$1.label),
1737
1744
  alias: atom$1.alias || null,
1738
- exactChangeFlag: +atom$1.exactChangeFlag,
1739
- unsaturatedAtom: +atom$1.unsaturatedAtom
1745
+ exactChangeFlag: +((_atom$exactChangeFlag = atom$1.exactChangeFlag) !== null && _atom$exactChangeFlag !== void 0 ? _atom$exactChangeFlag : false),
1746
+ unsaturatedAtom: +((_atom$unsaturatedAtom = atom$1.unsaturatedAtom) !== null && _atom$unsaturatedAtom !== void 0 ? _atom$unsaturatedAtom : false)
1740
1747
  });
1741
1748
  if (charge !== undefined) conv.charge = charge;
1742
1749
  return conv;
@@ -1838,7 +1845,7 @@ function fromBond(sbond) {
1838
1845
  };
1839
1846
  }
1840
1847
  function toBond(bond) {
1841
- return _objectSpread$Z({
1848
+ return _objectSpread$_({
1842
1849
  topology: bond.topology,
1843
1850
  reactingCenterStatus: bond.center
1844
1851
  }, toBondType(bond.type));
@@ -1928,7 +1935,7 @@ function toSgroup(sgroup) {
1928
1935
  var type = sgroup.type,
1929
1936
  radiobuttons = sgroup.radiobuttons,
1930
1937
  props = _objectWithoutProperties__default["default"](sgroup, _excluded$E);
1931
- var attrs = _objectSpread$Z({}, props);
1938
+ var attrs = _objectSpread$_({}, props);
1932
1939
  var absolute = 'absolute';
1933
1940
  var attached = 'attached';
1934
1941
  switch (radiobuttons) {
@@ -2429,6 +2436,8 @@ var tools$1 = typeSchema$1["enum"].reduce(function (res, type, i) {
2429
2436
  }, toolActions);
2430
2437
 
2431
2438
  var _excluded$D = ["rescale", "fragment"];
2439
+ 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; }
2440
+ 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__default["default"](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; }
2432
2441
  function onAction(action) {
2433
2442
  if (action && action.dialog) {
2434
2443
  return {
@@ -2475,27 +2484,30 @@ function load(struct, options) {
2475
2484
  server = state.server;
2476
2485
  errorHandler = editor.errorHandler;
2477
2486
  options = options || {};
2487
+ options = _objectSpread$Z(_objectSpread$Z({}, options), {}, {
2488
+ 'dearomatize-on-load': editor.options()['dearomatize-on-load']
2489
+ });
2478
2490
  dispatch(setAnalyzingFile(true));
2479
- _context.prev = 6;
2480
- _context.next = 9;
2491
+ _context.prev = 7;
2492
+ _context.next = 10;
2481
2493
  return parseStruct(struct, server, options);
2482
- case 9:
2494
+ case 10:
2483
2495
  parsedStruct = _context.sent;
2484
2496
  _options2 = options, fragment = _options2.fragment;
2485
2497
  hasUnsupportedGroups = parsedStruct.sgroups.some(function (sGroup) {
2486
2498
  return !supportedSGroupTypes[sGroup.type];
2487
2499
  });
2488
2500
  if (!hasUnsupportedGroups) {
2489
- _context.next = 16;
2501
+ _context.next = 17;
2490
2502
  break;
2491
2503
  }
2492
- _context.next = 15;
2504
+ _context.next = 16;
2493
2505
  return editor.event.confirm.dispatch();
2494
- case 15:
2506
+ case 16:
2495
2507
  parsedStruct.sgroups = parsedStruct.sgroups.filter(function (key, sGroup) {
2496
2508
  return supportedSGroupTypes[sGroup.type];
2497
2509
  });
2498
- case 16:
2510
+ case 17:
2499
2511
  parsedStruct.rescale();
2500
2512
  if (editor.struct().atoms.size) {
2501
2513
  oldStruct = editor.struct().clone();
@@ -2542,19 +2554,19 @@ function load(struct, options) {
2542
2554
  dispatch({
2543
2555
  type: 'MODAL_CLOSE'
2544
2556
  });
2545
- _context.next = 32;
2557
+ _context.next = 33;
2546
2558
  break;
2547
- case 28:
2548
- _context.prev = 28;
2549
- _context.t0 = _context["catch"](6);
2559
+ case 29:
2560
+ _context.prev = 29;
2561
+ _context.t0 = _context["catch"](7);
2550
2562
  dispatch(setAnalyzingFile(false));
2551
2563
  _context.t0 && errorHandler(_context.t0.message);
2552
- case 32:
2564
+ case 33:
2553
2565
  case "end":
2554
2566
  return _context.stop();
2555
2567
  }
2556
2568
  }
2557
- }, _callee, null, [[6, 28]]);
2569
+ }, _callee, null, [[7, 29]]);
2558
2570
  }));
2559
2571
  return function (_x, _x2) {
2560
2572
  return _ref.apply(this, arguments);
@@ -2899,7 +2911,7 @@ var zoom = {
2899
2911
 
2900
2912
  var openHelpLink = function openHelpLink() {
2901
2913
  var _window$open;
2902
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.5.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
2914
+ 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();
2903
2915
  };
2904
2916
  var help = {
2905
2917
  help: {
@@ -8085,6 +8097,45 @@ var useInterval = function useInterval(callback, delay) {
8085
8097
  }, [delay]);
8086
8098
  };
8087
8099
 
8100
+ var KETCHER_INIT_EVENT_NAME = 'ketcher-init';
8101
+
8102
+ var useSubscriptionOnEvents = function useSubscriptionOnEvents() {
8103
+ var dispatch = reactRedux.useDispatch();
8104
+ var _useAppContext = useAppContext(),
8105
+ getKetcherInstance = _useAppContext.getKetcherInstance;
8106
+ var loadingHandler = function loadingHandler() {
8107
+ dispatch(indigoVerification(true));
8108
+ };
8109
+ var actionResultHandler = function actionResultHandler() {
8110
+ dispatch(indigoVerification(false));
8111
+ };
8112
+ var subscribe = function subscribe(ketcher) {
8113
+ ketcher.eventBus.addListener(ketcherCore.KetcherAsyncEvents.LOADING, loadingHandler);
8114
+ ketcher.eventBus.addListener(ketcherCore.KetcherAsyncEvents.SUCCESS, actionResultHandler);
8115
+ ketcher.eventBus.addListener(ketcherCore.KetcherAsyncEvents.FAILURE, actionResultHandler);
8116
+ };
8117
+ var unsubscribe = function unsubscribe(ketcher) {
8118
+ ketcher.eventBus.removeListener(ketcherCore.KetcherAsyncEvents.LOADING, loadingHandler);
8119
+ ketcher.eventBus.removeListener(ketcherCore.KetcherAsyncEvents.SUCCESS, actionResultHandler);
8120
+ ketcher.eventBus.removeListener(ketcherCore.KetcherAsyncEvents.FAILURE, actionResultHandler);
8121
+ };
8122
+ React.useEffect(function () {
8123
+ var subscribeOnInit = function subscribeOnInit() {
8124
+ subscribe(getKetcherInstance());
8125
+ };
8126
+ var unsubscribeOnUnMount = function unsubscribeOnUnMount() {
8127
+ unsubscribe(getKetcherInstance());
8128
+ };
8129
+ window.addEventListener(KETCHER_INIT_EVENT_NAME, function () {
8130
+ subscribeOnInit();
8131
+ });
8132
+ return function () {
8133
+ unsubscribeOnUnMount();
8134
+ window.removeEventListener(KETCHER_INIT_EVENT_NAME, subscribeOnInit);
8135
+ };
8136
+ }, []);
8137
+ };
8138
+
8088
8139
  var ArrowScroll = function ArrowScroll(_ref) {
8089
8140
  var startInView = _ref.startInView,
8090
8141
  endInView = _ref.endInView,
@@ -10560,10 +10611,10 @@ var APointTool = function () {
10560
10611
  key: "mousemove",
10561
10612
  value: function mousemove(event) {
10562
10613
  var struct = this.editor.render.ctab.molecule;
10563
- var ci = this.editor.findItem(event, ['atoms']);
10564
- if (ci) {
10565
- var atom = struct.atoms.get(ci.id);
10566
- if ((atom === null || atom === void 0 ? void 0 : atom.label) !== 'R#' && (atom === null || atom === void 0 ? void 0 : atom.rglabel) === null) this.editor.hover(ci);
10614
+ var closestItem = this.editor.findItem(event, ['atoms']);
10615
+ if (closestItem) {
10616
+ var atom = struct.atoms.get(closestItem.id);
10617
+ 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);
10567
10618
  } else {
10568
10619
  this.editor.hover(null);
10569
10620
  }
@@ -14500,12 +14551,12 @@ var TextTool = function () {
14500
14551
  key: "mousedown",
14501
14552
  value: function mousedown(event) {
14502
14553
  var render = this.editor.render;
14503
- var ci = this.editor.findItem(event, ['texts']);
14554
+ var closestItem = this.editor.findItem(event, ['texts']);
14504
14555
  this.editor.selection(null);
14505
- if (ci && ci.map === 'texts') {
14556
+ if (closestItem && closestItem.map === 'texts') {
14506
14557
  this.editor.hover(null);
14507
14558
  this.editor.selection({
14508
- texts: [ci.id]
14559
+ texts: [closestItem.id]
14509
14560
  });
14510
14561
  this.dragCtx = {
14511
14562
  xy0: render.page2obj(event),
@@ -14540,27 +14591,27 @@ var TextTool = function () {
14540
14591
  key: "click",
14541
14592
  value: function click(event) {
14542
14593
  var render = this.editor.render;
14543
- var ci = this.editor.findItem(event, ['texts']);
14594
+ var closestItem = this.editor.findItem(event, ['texts']);
14544
14595
  this.editor.hover(null);
14545
- if (!ci) {
14546
- propsDialog(this.editor, null, render.page2obj(event));
14596
+ if (!closestItem) {
14597
+ propsDialog(this.editor, null, render.page2obj(event), []);
14547
14598
  }
14548
14599
  return true;
14549
14600
  }
14550
14601
  }, {
14551
14602
  key: "dblclick",
14552
14603
  value: function dblclick(event) {
14553
- var ci = this.editor.findItem(event, ['texts']);
14604
+ var closestItem = this.editor.findItem(event, ['texts']);
14554
14605
  this.editor.hover(null);
14555
- if (ci.map === 'texts') {
14556
- propsDialog(this.editor, ci.id, ci.position);
14606
+ if (closestItem.map === 'texts') {
14607
+ propsDialog(this.editor, closestItem.id, closestItem.position, closestItem.pos);
14557
14608
  }
14558
14609
  return true;
14559
14610
  }
14560
14611
  }]);
14561
14612
  return TextTool;
14562
14613
  }();
14563
- function propsDialog(editor, id, position) {
14614
+ function propsDialog(editor, id, position, pos) {
14564
14615
  var struct = editor.render.ctab.molecule;
14565
14616
  var text = id || id === 0 ? struct.texts.get(id) : null;
14566
14617
  var origilContent = text ? text.content : '';
@@ -14568,12 +14619,13 @@ function propsDialog(editor, id, position) {
14568
14619
  content: origilContent,
14569
14620
  id: id,
14570
14621
  position: position,
14622
+ pos: pos,
14571
14623
  type: 'text'
14572
14624
  });
14573
14625
  res.then(function (_ref) {
14574
14626
  var content = _ref.content;
14575
14627
  if (!id && id !== 0 && content) {
14576
- editor.update(ketcherCore.fromTextCreation(editor.render.ctab, content, position));
14628
+ editor.update(ketcherCore.fromTextCreation(editor.render.ctab, content, position, pos));
14577
14629
  } else if (!content) {
14578
14630
  editor.update(ketcherCore.fromTextDeletion(editor.render.ctab, id));
14579
14631
  } else if (content !== origilContent) {
@@ -14735,6 +14787,8 @@ var Editor$3 = function () {
14735
14787
  this.historyPtr = 0;
14736
14788
  this.errorHandler = null;
14737
14789
  this.highlights = new Highlighter(this);
14790
+ this.renderAndRecoordinateStruct = this.renderAndRecoordinateStruct.bind(this);
14791
+ this.setOptions = this.setOptions.bind(this);
14738
14792
  this.event = {
14739
14793
  message: new subscription.Subscription(),
14740
14794
  elementEdit: new subscription.PipelineSubscription(),
@@ -14792,6 +14846,15 @@ var Editor$3 = function () {
14792
14846
  value: function clear() {
14793
14847
  this.struct(undefined);
14794
14848
  }
14849
+ }, {
14850
+ key: "renderAndRecoordinateStruct",
14851
+ value: function renderAndRecoordinateStruct(struct) {
14852
+ var action = ketcherCore.fromNewCanvas(this.render.ctab, struct);
14853
+ this.update(action);
14854
+ getStructCenter(this.render.ctab);
14855
+ recoordinate(this);
14856
+ return this.render.ctab.molecule;
14857
+ }
14795
14858
  }, {
14796
14859
  key: "struct",
14797
14860
  value: function struct(value) {
@@ -14800,11 +14863,18 @@ var Editor$3 = function () {
14800
14863
  }
14801
14864
  this.selection(null);
14802
14865
  var struct = value || new ketcherCore.Struct();
14803
- var action = ketcherCore.fromNewCanvas(this.render.ctab, struct);
14804
- this.update(action);
14805
- getStructCenter(this.render.ctab);
14806
- recoordinate(this);
14807
- return this.render.ctab.molecule;
14866
+ return this.renderAndRecoordinateStruct(struct);
14867
+ }
14868
+ }, {
14869
+ key: "structToAddFragment",
14870
+ value: function structToAddFragment(value) {
14871
+ var superStruct = value.mergeInto(this.render.ctab.molecule);
14872
+ return this.renderAndRecoordinateStruct(superStruct);
14873
+ }
14874
+ }, {
14875
+ key: "setOptions",
14876
+ value: function setOptions(opts) {
14877
+ return this.render.updateOptions(opts);
14808
14878
  }
14809
14879
  }, {
14810
14880
  key: "options",
@@ -15319,8 +15389,12 @@ function setupEditor(editor, props) {
15319
15389
  Object.keys(editor.event).forEach(function (name) {
15320
15390
  var eventName = "on".concat(fp.upperFirst(name));
15321
15391
  if (props[eventName] !== oldProps[eventName]) {
15322
- if (oldProps[eventName]) editor.event[name].remove(oldProps[eventName]);
15323
- if (props[eventName]) editor.event[name].add(props[eventName]);
15392
+ if (oldProps[eventName]) {
15393
+ editor.event[name].remove(oldProps[eventName]);
15394
+ }
15395
+ if (props[eventName]) {
15396
+ editor.event[name].add(props[eventName]);
15397
+ }
15324
15398
  }
15325
15399
  });
15326
15400
  }
@@ -19048,7 +19122,8 @@ var SaveDialog = function (_Component) {
19048
19122
  }) : _this.isImageFormat(format) ? jsxRuntime.jsx("div", {
19049
19123
  className: classes$j.imageContainer,
19050
19124
  children: !isCleanStruct && jsxRuntime.jsx("img", {
19051
- src: "data:image/".concat(format, "+xml;base64,").concat(imageSrc)
19125
+ src: "data:image/".concat(format, "+xml;base64,").concat(imageSrc),
19126
+ alt: "".concat(format, " preview")
19052
19127
  })
19053
19128
  }) : jsxRuntime.jsx("div", {
19054
19129
  className: classes$j.previewBackground,
@@ -19143,7 +19218,7 @@ var SaveDialog = function (_Component) {
19143
19218
  _this.isRxn = _this.props.struct.hasRxnArrow();
19144
19219
  _this.textAreaRef = React.createRef();
19145
19220
  var formats = [_this.isRxn ? 'rxn' : 'mol', 'smiles', 'ket'];
19146
- if (_this.props.server) formats.push(_this.isRxn ? 'rxnV3000' : 'molV3000', 'smilesExt', 'smarts', 'inChI', 'inChIAuxInfo', 'cml', 'svg', 'png');
19221
+ if (_this.props.server) formats.push(_this.isRxn ? 'rxnV3000' : 'molV3000', 'smilesExt', 'smarts', 'inChI', 'inChIAuxInfo', 'cml', 'svg', 'png', 'cdxml');
19147
19222
  _this.saveSchema = saveSchema;
19148
19223
  _this.saveSchema.properties.format = Object.assign(_this.saveSchema.properties.format, {
19149
19224
  "enum": formats,
@@ -21202,7 +21277,7 @@ var Text = function Text(props) {
21202
21277
  };
21203
21278
  };
21204
21279
  var keyBindingFn = function keyBindingFn(e) {
21205
- if (e.keyCode === 13) {
21280
+ if (e.key === 'Enter') {
21206
21281
  e.stopPropagation();
21207
21282
  }
21208
21283
  return draftJs.getDefaultKeyBinding(e);
@@ -21620,6 +21695,7 @@ var App = function App(props) {
21620
21695
  var checkServer = props.checkServer;
21621
21696
  var _useSettingsContext = useSettingsContext(),
21622
21697
  staticResourcesUrl = _useSettingsContext.staticResourcesUrl;
21698
+ useSubscriptionOnEvents();
21623
21699
  React.useEffect(function () {
21624
21700
  checkServer();
21625
21701
  dispatch(initFGTemplates(staticResourcesUrl));
@@ -21696,7 +21772,8 @@ var KetcherBuilder = function () {
21696
21772
  'ignore-stereochemistry-errors': true,
21697
21773
  'mass-skip-error-on-pseudoatoms': false,
21698
21774
  'gross-formula-add-rsites': true,
21699
- 'aromatize-skip-superatoms': true
21775
+ 'aromatize-skip-superatoms': true,
21776
+ 'dearomatize-on-load': false
21700
21777
  });
21701
21778
  case 1:
21702
21779
  case "end":
@@ -21730,8 +21807,8 @@ var KetcherBuilder = function () {
21730
21807
  initApp(element, staticResourcesUrl, {
21731
21808
  buttons: buttons || {},
21732
21809
  errorHandler: errorHandler || null,
21733
- version: "2.5.2" ,
21734
- buildDate: "2022-09-07T08:32:56" ,
21810
+ version: "2.6.0-rc.2" ,
21811
+ buildDate: "2022-10-21T11:30:05" ,
21735
21812
  buildNumber: ''
21736
21813
  }, structService, resolve);
21737
21814
  });
@@ -21824,12 +21901,14 @@ function Editor(props) {
21824
21901
  }),
21825
21902
  height = _useResizeObserver.height,
21826
21903
  width = _useResizeObserver.width;
21904
+ var ketcherInitEvent = new Event(KETCHER_INIT_EVENT_NAME);
21827
21905
  React.useEffect(function () {
21828
21906
  buildKetcherAsync(_objectSpread(_objectSpread({}, props), {}, {
21829
21907
  element: rootElRef.current
21830
21908
  })).then(function (ketcher) {
21831
21909
  if (typeof onInit === 'function') {
21832
21910
  onInit(ketcher);
21911
+ window.dispatchEvent(ketcherInitEvent);
21833
21912
  }
21834
21913
  });
21835
21914
  }, []);
@@ -21840,4 +21919,5 @@ function Editor(props) {
21840
21919
  }
21841
21920
 
21842
21921
  exports.Editor = Editor;
21922
+ exports.KETCHER_INIT_EVENT_NAME = KETCHER_INIT_EVENT_NAME;
21843
21923
  //# sourceMappingURL=index.js.map