ketcher-react 2.15.0-rc.2 → 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.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$2 from '@babel/runtime/helpers/classCallCheck';
|
|
26
26
|
import _createClass$1 from '@babel/runtime/helpers/createClass';
|
|
27
|
-
import { KetSerializer, MolSerializer, Ketcher, defaultBondThickness, FormatterFactory, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SdfSerializer, Bond as Bond$2, Elements, AtomList, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, SimpleObjectMode, emitEventRequestIsFinished, SGroup as SGroup$1, Pile, getStereoAtomsMap, identifyStructFormat, SupportedFormat, ChemicalMimeType, RenderStruct, Struct, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, Vec2, fromMultipleMove, scrollByVector, FunctionalGroup, Scale, fromSgroupDeletion, fromFragmentDeletion, mergeMapOfItemsToSet, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, fromSimpleObjectResizing, fromArrowResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, isCloseToEdgeOfCanvas, isCloseToEdgeOfScreen, getDirections, shiftAndExtendCanvasByVector, formatProperties, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, fromPaste, fromTemplateOnAtom, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromPlusAddition, fromRotate, fromFlip, fromSimpleObjectAddition, fromTemplateOnBondAction, fromTemplateOnCanvas, fromTextCreation, fromHighlightCreate, fromHighlightClear, fromNewCanvas, Render, fromDescriptorsAlign, atomGetAttr, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, b64toBlob, Generics, TextCommand, DefaultStructServiceOptions } from 'ketcher-core';
|
|
27
|
+
import { KetSerializer, MolSerializer, Ketcher, defaultBondThickness, FormatterFactory, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SdfSerializer, Bond as Bond$2, Elements, AtomList, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, SimpleObjectMode, emitEventRequestIsFinished, SGroup as SGroup$1, Pile, getStereoAtomsMap, identifyStructFormat, SupportedFormat, ChemicalMimeType, RenderStruct, Struct, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, Vec2, fromMultipleMove, scrollByVector, FunctionalGroup, Scale, fromSgroupDeletion, fromFragmentDeletion, mergeMapOfItemsToSet, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, fromSimpleObjectResizing, fromArrowResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, isCloseToEdgeOfCanvas, isCloseToEdgeOfScreen, getDirections, shiftAndExtendCanvasByVector, formatProperties, ketcherProvider, getStructure, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, fromPaste, fromTemplateOnAtom, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromPlusAddition, fromRotate, fromFlip, fromSimpleObjectAddition, fromTemplateOnBondAction, fromTemplateOnCanvas, fromTextCreation, fromHighlightCreate, fromHighlightClear, fromNewCanvas, Render, fromDescriptorsAlign, atomGetAttr, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, b64toBlob, Generics, TextCommand, DefaultStructServiceOptions } from 'ketcher-core';
|
|
28
28
|
import * as React from 'react';
|
|
29
29
|
import React__default, { createRef, Component, useRef, useEffect, useState, useMemo, createElement, forwardRef, useCallback, useLayoutEffect, Fragment as Fragment$2, PureComponent, lazy, Suspense } from 'react';
|
|
30
30
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -297,20 +297,76 @@ var ClipArea = function (_Component) {
|
|
|
297
297
|
mousedown: function mousedown(event) {
|
|
298
298
|
if (event.shiftKey && !isActiveElement(event.target)) event.preventDefault();
|
|
299
299
|
},
|
|
300
|
-
copy: function
|
|
301
|
-
|
|
302
|
-
var data
|
|
303
|
-
|
|
304
|
-
|
|
300
|
+
copy: function () {
|
|
301
|
+
var _copy2 = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(event) {
|
|
302
|
+
var data;
|
|
303
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
304
|
+
while (1) {
|
|
305
|
+
switch (_context.prev = _context.next) {
|
|
306
|
+
case 0:
|
|
307
|
+
if (!(_this2.props.focused() && _this2.props.onCopy)) {
|
|
308
|
+
_context.next = 8;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
_context.next = 3;
|
|
312
|
+
return _this2.props.onCopy();
|
|
313
|
+
case 3:
|
|
314
|
+
data = _context.sent;
|
|
315
|
+
if (!data) {
|
|
316
|
+
_context.next = 7;
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
_context.next = 7;
|
|
320
|
+
return _copy(data);
|
|
321
|
+
case 7:
|
|
322
|
+
event.preventDefault();
|
|
323
|
+
case 8:
|
|
324
|
+
case "end":
|
|
325
|
+
return _context.stop();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, _callee);
|
|
329
|
+
}));
|
|
330
|
+
function copy(_x) {
|
|
331
|
+
return _copy2.apply(this, arguments);
|
|
305
332
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
333
|
+
return copy;
|
|
334
|
+
}(),
|
|
335
|
+
cut: function () {
|
|
336
|
+
var _cut = _asyncToGenerator( _regeneratorRuntime.mark(function _callee2(event) {
|
|
337
|
+
var data;
|
|
338
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
339
|
+
while (1) {
|
|
340
|
+
switch (_context2.prev = _context2.next) {
|
|
341
|
+
case 0:
|
|
342
|
+
if (!(_this2.props.focused() && _this2.props.onCut)) {
|
|
343
|
+
_context2.next = 8;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
_context2.next = 3;
|
|
347
|
+
return _this2.props.onCut();
|
|
348
|
+
case 3:
|
|
349
|
+
data = _context2.sent;
|
|
350
|
+
if (!data) {
|
|
351
|
+
_context2.next = 7;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
_context2.next = 7;
|
|
355
|
+
return _copy(data);
|
|
356
|
+
case 7:
|
|
357
|
+
event.preventDefault();
|
|
358
|
+
case 8:
|
|
359
|
+
case "end":
|
|
360
|
+
return _context2.stop();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}, _callee2);
|
|
364
|
+
}));
|
|
365
|
+
function cut(_x2) {
|
|
366
|
+
return _cut.apply(this, arguments);
|
|
312
367
|
}
|
|
313
|
-
|
|
368
|
+
return cut;
|
|
369
|
+
}(),
|
|
314
370
|
paste: function paste(event) {
|
|
315
371
|
if (_this2.props.focused() && _this2.props.onPaste) {
|
|
316
372
|
var data = _paste(event.clipboardData, _this2.props.formats);
|
|
@@ -359,20 +415,32 @@ function autoselect(cliparea) {
|
|
|
359
415
|
cliparea.value = ' ';
|
|
360
416
|
cliparea.select();
|
|
361
417
|
}
|
|
362
|
-
function _copy(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
418
|
+
function _copy(_x3) {
|
|
419
|
+
return _copy3.apply(this, arguments);
|
|
420
|
+
}
|
|
421
|
+
function _copy3() {
|
|
422
|
+
_copy3 = _asyncToGenerator( _regeneratorRuntime.mark(function _callee3(data) {
|
|
423
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
424
|
+
while (1) {
|
|
425
|
+
switch (_context3.prev = _context3.next) {
|
|
426
|
+
case 0:
|
|
427
|
+
_context3.prev = 0;
|
|
428
|
+
_context3.next = 3;
|
|
429
|
+
return navigator.clipboard.writeText(data['text/plain']);
|
|
430
|
+
case 3:
|
|
431
|
+
_context3.next = 8;
|
|
432
|
+
break;
|
|
433
|
+
case 5:
|
|
434
|
+
_context3.prev = 5;
|
|
435
|
+
_context3.t0 = _context3["catch"](0);
|
|
436
|
+
case 8:
|
|
437
|
+
case "end":
|
|
438
|
+
return _context3.stop();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}, _callee3, null, [[0, 5]]);
|
|
442
|
+
}));
|
|
443
|
+
return _copy3.apply(this, arguments);
|
|
376
444
|
}
|
|
377
445
|
function _paste(cb, formats) {
|
|
378
446
|
var data = {};
|
|
@@ -16992,21 +17060,53 @@ function initClipboard(dispatch) {
|
|
|
16992
17060
|
return !state.modal;
|
|
16993
17061
|
},
|
|
16994
17062
|
onCut: function onCut() {
|
|
16995
|
-
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17001
|
-
|
|
17002
|
-
|
|
17063
|
+
return _asyncToGenerator( _regeneratorRuntime.mark(function _callee() {
|
|
17064
|
+
var state, editor, data;
|
|
17065
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17066
|
+
while (1) {
|
|
17067
|
+
switch (_context.prev = _context.next) {
|
|
17068
|
+
case 0:
|
|
17069
|
+
state = global.currentState;
|
|
17070
|
+
editor = state.editor;
|
|
17071
|
+
_context.next = 4;
|
|
17072
|
+
return clipData(editor);
|
|
17073
|
+
case 4:
|
|
17074
|
+
data = _context.sent;
|
|
17075
|
+
if (data) debAction({
|
|
17076
|
+
tool: 'eraser',
|
|
17077
|
+
opts: 1
|
|
17078
|
+
});else editor.selection(null);
|
|
17079
|
+
return _context.abrupt("return", data);
|
|
17080
|
+
case 7:
|
|
17081
|
+
case "end":
|
|
17082
|
+
return _context.stop();
|
|
17083
|
+
}
|
|
17084
|
+
}
|
|
17085
|
+
}, _callee);
|
|
17086
|
+
}))();
|
|
17003
17087
|
},
|
|
17004
17088
|
onCopy: function onCopy() {
|
|
17005
|
-
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17089
|
+
return _asyncToGenerator( _regeneratorRuntime.mark(function _callee2() {
|
|
17090
|
+
var state, editor, data;
|
|
17091
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
17092
|
+
while (1) {
|
|
17093
|
+
switch (_context2.prev = _context2.next) {
|
|
17094
|
+
case 0:
|
|
17095
|
+
state = global.currentState;
|
|
17096
|
+
editor = state.editor;
|
|
17097
|
+
_context2.next = 4;
|
|
17098
|
+
return clipData(editor);
|
|
17099
|
+
case 4:
|
|
17100
|
+
data = _context2.sent;
|
|
17101
|
+
editor.selection(null);
|
|
17102
|
+
return _context2.abrupt("return", data);
|
|
17103
|
+
case 7:
|
|
17104
|
+
case "end":
|
|
17105
|
+
return _context2.stop();
|
|
17106
|
+
}
|
|
17107
|
+
}
|
|
17108
|
+
}, _callee2);
|
|
17109
|
+
}))();
|
|
17010
17110
|
},
|
|
17011
17111
|
onPaste: function onPaste(data) {
|
|
17012
17112
|
var structStr = data[ChemicalMimeType.KET] || data[ChemicalMimeType.Mol] || data[ChemicalMimeType.Rxn] || data['text/plain'];
|
|
@@ -17017,30 +17117,61 @@ function initClipboard(dispatch) {
|
|
|
17017
17117
|
}
|
|
17018
17118
|
};
|
|
17019
17119
|
}
|
|
17020
|
-
function clipData(
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
|
|
17028
|
-
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
|
|
17042
|
-
|
|
17043
|
-
|
|
17120
|
+
function clipData(_x) {
|
|
17121
|
+
return _clipData.apply(this, arguments);
|
|
17122
|
+
}
|
|
17123
|
+
function _clipData() {
|
|
17124
|
+
_clipData = _asyncToGenerator( _regeneratorRuntime.mark(function _callee3(editor) {
|
|
17125
|
+
var res, struct, errorHandler, simpleObjectOrText, serializer, ket, ketcherInstance, data, type;
|
|
17126
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
17127
|
+
while (1) {
|
|
17128
|
+
switch (_context3.prev = _context3.next) {
|
|
17129
|
+
case 0:
|
|
17130
|
+
res = {};
|
|
17131
|
+
struct = editor.structSelected();
|
|
17132
|
+
errorHandler = editor.errorHandler;
|
|
17133
|
+
if (!struct.isBlank()) {
|
|
17134
|
+
_context3.next = 5;
|
|
17135
|
+
break;
|
|
17136
|
+
}
|
|
17137
|
+
return _context3.abrupt("return", null);
|
|
17138
|
+
case 5:
|
|
17139
|
+
simpleObjectOrText = Boolean(struct.simpleObjects.size || struct.texts.size);
|
|
17140
|
+
if (!(simpleObjectOrText && isIE && errorHandler)) {
|
|
17141
|
+
_context3.next = 9;
|
|
17142
|
+
break;
|
|
17143
|
+
}
|
|
17144
|
+
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');
|
|
17145
|
+
return _context3.abrupt("return", null);
|
|
17146
|
+
case 9:
|
|
17147
|
+
_context3.prev = 9;
|
|
17148
|
+
serializer = new KetSerializer();
|
|
17149
|
+
ket = serializer.serialize(struct);
|
|
17150
|
+
ketcherInstance = ketcherProvider.getKetcher();
|
|
17151
|
+
_context3.next = 15;
|
|
17152
|
+
return getStructure(SupportedFormat.molAuto,
|
|
17153
|
+
ketcherInstance.formatterFactory, struct);
|
|
17154
|
+
case 15:
|
|
17155
|
+
data = _context3.sent;
|
|
17156
|
+
res[ChemicalMimeType.KET] = ket;
|
|
17157
|
+
type = struct.isReaction ? ChemicalMimeType.Mol : ChemicalMimeType.Rxn;
|
|
17158
|
+
res['text/plain'] = data;
|
|
17159
|
+
res[type] = data;
|
|
17160
|
+
return _context3.abrupt("return", res);
|
|
17161
|
+
case 23:
|
|
17162
|
+
_context3.prev = 23;
|
|
17163
|
+
_context3.t0 = _context3["catch"](9);
|
|
17164
|
+
errorHandler && errorHandler(_context3.t0.message);
|
|
17165
|
+
case 26:
|
|
17166
|
+
return _context3.abrupt("return", null);
|
|
17167
|
+
case 27:
|
|
17168
|
+
case "end":
|
|
17169
|
+
return _context3.stop();
|
|
17170
|
+
}
|
|
17171
|
+
}
|
|
17172
|
+
}, _callee3, null, [[9, 23]]);
|
|
17173
|
+
}));
|
|
17174
|
+
return _clipData.apply(this, arguments);
|
|
17044
17175
|
}
|
|
17045
17176
|
|
|
17046
17177
|
var AppClipArea = connect(null, function (dispatch) {
|
|
@@ -30634,8 +30765,8 @@ var KetcherBuilder = function () {
|
|
|
30634
30765
|
initApp(element, appRoot, staticResourcesUrl, {
|
|
30635
30766
|
buttons: buttons || {},
|
|
30636
30767
|
errorHandler: errorHandler || null,
|
|
30637
|
-
version: "2.15.0-rc.
|
|
30638
|
-
buildDate: "2023-
|
|
30768
|
+
version: "2.15.0-rc.3" ,
|
|
30769
|
+
buildDate: "2023-10-06T10:46:54" ,
|
|
30639
30770
|
buildNumber: ''
|
|
30640
30771
|
}, structService, resolve);
|
|
30641
30772
|
});
|
|
@@ -30676,6 +30807,7 @@ var KetcherBuilder = function () {
|
|
|
30676
30807
|
if (initialMol) {
|
|
30677
30808
|
ketcher.setMolecule(initialMol);
|
|
30678
30809
|
}
|
|
30810
|
+
ketcherProvider.setKetcherInstance(ketcher);
|
|
30679
30811
|
return ketcher;
|
|
30680
30812
|
}
|
|
30681
30813
|
}]);
|