ketcher-react 2.15.0-rc.1 → 2.15.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
CHANGED
|
@@ -360,20 +360,76 @@ var ClipArea = function (_Component) {
|
|
|
360
360
|
mousedown: function mousedown(event) {
|
|
361
361
|
if (event.shiftKey && !isActiveElement(event.target)) event.preventDefault();
|
|
362
362
|
},
|
|
363
|
-
copy: function
|
|
364
|
-
|
|
365
|
-
var data
|
|
366
|
-
|
|
367
|
-
|
|
363
|
+
copy: function () {
|
|
364
|
+
var _copy2 = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee(event) {
|
|
365
|
+
var data;
|
|
366
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
367
|
+
while (1) {
|
|
368
|
+
switch (_context.prev = _context.next) {
|
|
369
|
+
case 0:
|
|
370
|
+
if (!(_this2.props.focused() && _this2.props.onCopy)) {
|
|
371
|
+
_context.next = 8;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
_context.next = 3;
|
|
375
|
+
return _this2.props.onCopy();
|
|
376
|
+
case 3:
|
|
377
|
+
data = _context.sent;
|
|
378
|
+
if (!data) {
|
|
379
|
+
_context.next = 7;
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
_context.next = 7;
|
|
383
|
+
return _copy(data);
|
|
384
|
+
case 7:
|
|
385
|
+
event.preventDefault();
|
|
386
|
+
case 8:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context.stop();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}, _callee);
|
|
392
|
+
}));
|
|
393
|
+
function copy(_x) {
|
|
394
|
+
return _copy2.apply(this, arguments);
|
|
368
395
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
396
|
+
return copy;
|
|
397
|
+
}(),
|
|
398
|
+
cut: function () {
|
|
399
|
+
var _cut = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee2(event) {
|
|
400
|
+
var data;
|
|
401
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
402
|
+
while (1) {
|
|
403
|
+
switch (_context2.prev = _context2.next) {
|
|
404
|
+
case 0:
|
|
405
|
+
if (!(_this2.props.focused() && _this2.props.onCut)) {
|
|
406
|
+
_context2.next = 8;
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
_context2.next = 3;
|
|
410
|
+
return _this2.props.onCut();
|
|
411
|
+
case 3:
|
|
412
|
+
data = _context2.sent;
|
|
413
|
+
if (!data) {
|
|
414
|
+
_context2.next = 7;
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
_context2.next = 7;
|
|
418
|
+
return _copy(data);
|
|
419
|
+
case 7:
|
|
420
|
+
event.preventDefault();
|
|
421
|
+
case 8:
|
|
422
|
+
case "end":
|
|
423
|
+
return _context2.stop();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}, _callee2);
|
|
427
|
+
}));
|
|
428
|
+
function cut(_x2) {
|
|
429
|
+
return _cut.apply(this, arguments);
|
|
375
430
|
}
|
|
376
|
-
|
|
431
|
+
return cut;
|
|
432
|
+
}(),
|
|
377
433
|
paste: function paste(event) {
|
|
378
434
|
if (_this2.props.focused() && _this2.props.onPaste) {
|
|
379
435
|
var data = _paste(event.clipboardData, _this2.props.formats);
|
|
@@ -422,20 +478,32 @@ function autoselect(cliparea) {
|
|
|
422
478
|
cliparea.value = ' ';
|
|
423
479
|
cliparea.select();
|
|
424
480
|
}
|
|
425
|
-
function _copy(
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
481
|
+
function _copy(_x3) {
|
|
482
|
+
return _copy3.apply(this, arguments);
|
|
483
|
+
}
|
|
484
|
+
function _copy3() {
|
|
485
|
+
_copy3 = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee3(data) {
|
|
486
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
487
|
+
while (1) {
|
|
488
|
+
switch (_context3.prev = _context3.next) {
|
|
489
|
+
case 0:
|
|
490
|
+
_context3.prev = 0;
|
|
491
|
+
_context3.next = 3;
|
|
492
|
+
return navigator.clipboard.writeText(data['text/plain']);
|
|
493
|
+
case 3:
|
|
494
|
+
_context3.next = 8;
|
|
495
|
+
break;
|
|
496
|
+
case 5:
|
|
497
|
+
_context3.prev = 5;
|
|
498
|
+
_context3.t0 = _context3["catch"](0);
|
|
499
|
+
case 8:
|
|
500
|
+
case "end":
|
|
501
|
+
return _context3.stop();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}, _callee3, null, [[0, 5]]);
|
|
505
|
+
}));
|
|
506
|
+
return _copy3.apply(this, arguments);
|
|
439
507
|
}
|
|
440
508
|
function _paste(cb, formats) {
|
|
441
509
|
var data = {};
|
|
@@ -3264,7 +3332,7 @@ var zoom = {
|
|
|
3264
3332
|
|
|
3265
3333
|
var openHelpLink = function openHelpLink() {
|
|
3266
3334
|
var _window$open;
|
|
3267
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.15.0-rc.
|
|
3335
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.15.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3268
3336
|
};
|
|
3269
3337
|
var help = {
|
|
3270
3338
|
help: {
|
|
@@ -17055,21 +17123,53 @@ function initClipboard(dispatch) {
|
|
|
17055
17123
|
return !state.modal;
|
|
17056
17124
|
},
|
|
17057
17125
|
onCut: function onCut() {
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17126
|
+
return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee() {
|
|
17127
|
+
var state, editor, data;
|
|
17128
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
17129
|
+
while (1) {
|
|
17130
|
+
switch (_context.prev = _context.next) {
|
|
17131
|
+
case 0:
|
|
17132
|
+
state = global.currentState;
|
|
17133
|
+
editor = state.editor;
|
|
17134
|
+
_context.next = 4;
|
|
17135
|
+
return clipData(editor);
|
|
17136
|
+
case 4:
|
|
17137
|
+
data = _context.sent;
|
|
17138
|
+
if (data) debAction({
|
|
17139
|
+
tool: 'eraser',
|
|
17140
|
+
opts: 1
|
|
17141
|
+
});else editor.selection(null);
|
|
17142
|
+
return _context.abrupt("return", data);
|
|
17143
|
+
case 7:
|
|
17144
|
+
case "end":
|
|
17145
|
+
return _context.stop();
|
|
17146
|
+
}
|
|
17147
|
+
}
|
|
17148
|
+
}, _callee);
|
|
17149
|
+
}))();
|
|
17066
17150
|
},
|
|
17067
17151
|
onCopy: function onCopy() {
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17152
|
+
return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee2() {
|
|
17153
|
+
var state, editor, data;
|
|
17154
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
17155
|
+
while (1) {
|
|
17156
|
+
switch (_context2.prev = _context2.next) {
|
|
17157
|
+
case 0:
|
|
17158
|
+
state = global.currentState;
|
|
17159
|
+
editor = state.editor;
|
|
17160
|
+
_context2.next = 4;
|
|
17161
|
+
return clipData(editor);
|
|
17162
|
+
case 4:
|
|
17163
|
+
data = _context2.sent;
|
|
17164
|
+
editor.selection(null);
|
|
17165
|
+
return _context2.abrupt("return", data);
|
|
17166
|
+
case 7:
|
|
17167
|
+
case "end":
|
|
17168
|
+
return _context2.stop();
|
|
17169
|
+
}
|
|
17170
|
+
}
|
|
17171
|
+
}, _callee2);
|
|
17172
|
+
}))();
|
|
17073
17173
|
},
|
|
17074
17174
|
onPaste: function onPaste(data) {
|
|
17075
17175
|
var structStr = data[ketcherCore.ChemicalMimeType.KET] || data[ketcherCore.ChemicalMimeType.Mol] || data[ketcherCore.ChemicalMimeType.Rxn] || data['text/plain'];
|
|
@@ -17080,30 +17180,61 @@ function initClipboard(dispatch) {
|
|
|
17080
17180
|
}
|
|
17081
17181
|
};
|
|
17082
17182
|
}
|
|
17083
|
-
function clipData(
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
|
|
17101
|
-
|
|
17102
|
-
|
|
17103
|
-
|
|
17104
|
-
|
|
17105
|
-
|
|
17106
|
-
|
|
17183
|
+
function clipData(_x) {
|
|
17184
|
+
return _clipData.apply(this, arguments);
|
|
17185
|
+
}
|
|
17186
|
+
function _clipData() {
|
|
17187
|
+
_clipData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee3(editor) {
|
|
17188
|
+
var res, struct, errorHandler, simpleObjectOrText, serializer, ket, ketcherInstance, data, type;
|
|
17189
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
17190
|
+
while (1) {
|
|
17191
|
+
switch (_context3.prev = _context3.next) {
|
|
17192
|
+
case 0:
|
|
17193
|
+
res = {};
|
|
17194
|
+
struct = editor.structSelected();
|
|
17195
|
+
errorHandler = editor.errorHandler;
|
|
17196
|
+
if (!struct.isBlank()) {
|
|
17197
|
+
_context3.next = 5;
|
|
17198
|
+
break;
|
|
17199
|
+
}
|
|
17200
|
+
return _context3.abrupt("return", null);
|
|
17201
|
+
case 5:
|
|
17202
|
+
simpleObjectOrText = Boolean(struct.simpleObjects.size || struct.texts.size);
|
|
17203
|
+
if (!(simpleObjectOrText && reactDeviceDetect.isIE && errorHandler)) {
|
|
17204
|
+
_context3.next = 9;
|
|
17205
|
+
break;
|
|
17206
|
+
}
|
|
17207
|
+
errorHandler('The structure you are trying to copy contains Simple object or/and Text object.' + 'To copy Simple object or Text object in Internet Explorer try "Copy as KET" button');
|
|
17208
|
+
return _context3.abrupt("return", null);
|
|
17209
|
+
case 9:
|
|
17210
|
+
_context3.prev = 9;
|
|
17211
|
+
serializer = new ketcherCore.KetSerializer();
|
|
17212
|
+
ket = serializer.serialize(struct);
|
|
17213
|
+
ketcherInstance = ketcherCore.ketcherProvider.getKetcher();
|
|
17214
|
+
_context3.next = 15;
|
|
17215
|
+
return ketcherCore.getStructure(ketcherCore.SupportedFormat.molAuto,
|
|
17216
|
+
ketcherInstance.formatterFactory, struct);
|
|
17217
|
+
case 15:
|
|
17218
|
+
data = _context3.sent;
|
|
17219
|
+
res[ketcherCore.ChemicalMimeType.KET] = ket;
|
|
17220
|
+
type = struct.isReaction ? ketcherCore.ChemicalMimeType.Mol : ketcherCore.ChemicalMimeType.Rxn;
|
|
17221
|
+
res['text/plain'] = data;
|
|
17222
|
+
res[type] = data;
|
|
17223
|
+
return _context3.abrupt("return", res);
|
|
17224
|
+
case 23:
|
|
17225
|
+
_context3.prev = 23;
|
|
17226
|
+
_context3.t0 = _context3["catch"](9);
|
|
17227
|
+
errorHandler && errorHandler(_context3.t0.message);
|
|
17228
|
+
case 26:
|
|
17229
|
+
return _context3.abrupt("return", null);
|
|
17230
|
+
case 27:
|
|
17231
|
+
case "end":
|
|
17232
|
+
return _context3.stop();
|
|
17233
|
+
}
|
|
17234
|
+
}
|
|
17235
|
+
}, _callee3, null, [[9, 23]]);
|
|
17236
|
+
}));
|
|
17237
|
+
return _clipData.apply(this, arguments);
|
|
17107
17238
|
}
|
|
17108
17239
|
|
|
17109
17240
|
var AppClipArea = reactRedux.connect(null, function (dispatch) {
|
|
@@ -22590,35 +22721,45 @@ var useDelete$1 = function useDelete() {
|
|
|
22590
22721
|
return handler;
|
|
22591
22722
|
};
|
|
22592
22723
|
|
|
22724
|
+
var getAtomIdByProps = function getAtomIdByProps(props, ketcher) {
|
|
22725
|
+
var _props$atomIds, _props$rgroupAttachme;
|
|
22726
|
+
var editor = ketcher.editor;
|
|
22727
|
+
var restruct = editor.render.ctab;
|
|
22728
|
+
var atomId = props === null || props === void 0 ? void 0 : (_props$atomIds = props.atomIds) === null || _props$atomIds === void 0 ? void 0 : _props$atomIds[0];
|
|
22729
|
+
if (atomId != null) {
|
|
22730
|
+
return atomId;
|
|
22731
|
+
}
|
|
22732
|
+
var attachmentPointId = props === null || props === void 0 ? void 0 : (_props$rgroupAttachme = props.rgroupAttachmentPoints) === null || _props$rgroupAttachme === void 0 ? void 0 : _props$rgroupAttachme[0];
|
|
22733
|
+
assert_1(attachmentPointId != null);
|
|
22734
|
+
var attachmentPoint = restruct.molecule.rgroupAttachmentPoints.get(attachmentPointId);
|
|
22735
|
+
assert_1(attachmentPoint != null);
|
|
22736
|
+
return attachmentPoint.atomId;
|
|
22737
|
+
};
|
|
22593
22738
|
var useRGroupAttachmentPointEdit = function useRGroupAttachmentPointEdit() {
|
|
22594
22739
|
var _useAppContext = useAppContext(),
|
|
22595
22740
|
getKetcherInstance = _useAppContext.getKetcherInstance;
|
|
22596
22741
|
var handler = React.useCallback(function (_ref) {
|
|
22597
|
-
var _props$atomIds;
|
|
22598
22742
|
var props = _ref.props;
|
|
22599
|
-
var
|
|
22600
|
-
var restruct = editor.render.ctab;
|
|
22601
|
-
var atomId = props
|
|
22602
|
-
assert_1(atomId != null);
|
|
22743
|
+
var ketcher = getKetcherInstance();
|
|
22744
|
+
var restruct = ketcher.editor.render.ctab;
|
|
22745
|
+
var atomId = getAtomIdByProps(props, ketcher);
|
|
22603
22746
|
var atom = restruct.molecule.atoms.get(atomId);
|
|
22604
22747
|
assert_1(atom != null);
|
|
22605
|
-
editRGroupAttachmentPoint(editor, atom, atomId);
|
|
22748
|
+
editRGroupAttachmentPoint(ketcher.editor, atom, atomId);
|
|
22606
22749
|
}, [getKetcherInstance]);
|
|
22607
22750
|
var disabled = React.useCallback(function (_ref2) {
|
|
22608
|
-
var _props$atomIds2;
|
|
22609
22751
|
var props = _ref2.props;
|
|
22610
|
-
var
|
|
22611
|
-
var restruct = editor.render.ctab;
|
|
22612
|
-
var atomId = props
|
|
22613
|
-
assert_1(atomId != null);
|
|
22752
|
+
var ketcher = getKetcherInstance();
|
|
22753
|
+
var restruct = ketcher.editor.render.ctab;
|
|
22754
|
+
var atomId = getAtomIdByProps(props, ketcher);
|
|
22614
22755
|
var atom = restruct.molecule.atoms.get(atomId);
|
|
22615
22756
|
assert_1(atom != null);
|
|
22616
22757
|
return atom.isRGroupAttachmentPointEditDisabled;
|
|
22617
22758
|
}, [getKetcherInstance]);
|
|
22618
22759
|
var hidden = React.useCallback(function (_ref3) {
|
|
22619
|
-
var _props$
|
|
22760
|
+
var _props$atomIds2;
|
|
22620
22761
|
var props = _ref3.props;
|
|
22621
|
-
var atomLength = (props === null || props === void 0 ? void 0 : (_props$
|
|
22762
|
+
var atomLength = (props === null || props === void 0 ? void 0 : (_props$atomIds2 = props.atomIds) === null || _props$atomIds2 === void 0 ? void 0 : _props$atomIds2.length) || 0;
|
|
22622
22763
|
return atomLength > 1;
|
|
22623
22764
|
}, []);
|
|
22624
22765
|
return [handler, disabled, hidden];
|
|
@@ -30687,8 +30828,8 @@ var KetcherBuilder = function () {
|
|
|
30687
30828
|
initApp(element, appRoot, staticResourcesUrl, {
|
|
30688
30829
|
buttons: buttons || {},
|
|
30689
30830
|
errorHandler: errorHandler || null,
|
|
30690
|
-
version: "2.15.0-rc.
|
|
30691
|
-
buildDate: "2023-
|
|
30831
|
+
version: "2.15.0-rc.3" ,
|
|
30832
|
+
buildDate: "2023-10-06T10:46:54" ,
|
|
30692
30833
|
buildNumber: ''
|
|
30693
30834
|
}, structService, resolve);
|
|
30694
30835
|
});
|
|
@@ -30729,6 +30870,7 @@ var KetcherBuilder = function () {
|
|
|
30729
30870
|
if (initialMol) {
|
|
30730
30871
|
ketcher.setMolecule(initialMol);
|
|
30731
30872
|
}
|
|
30873
|
+
ketcherCore.ketcherProvider.setKetcherInstance(ketcher);
|
|
30732
30874
|
return ketcher;
|
|
30733
30875
|
}
|
|
30734
30876
|
}]);
|