ketcher-react 2.20.0 → 2.21.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -122
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +26 -117
- package/dist/index.modern.js.map +1 -1
- package/dist/script/builders/ketcher/KetcherBuilder.d.ts +1 -1
- package/dist/script/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/script/ui/component/cliparea/clipboardUtils.d.ts +0 -7
package/dist/index.js
CHANGED
|
@@ -336,15 +336,6 @@ var debugObj = {
|
|
|
336
336
|
|
|
337
337
|
var classes$R = {"cliparea":"cliparea-module_cliparea__GdPrN"};
|
|
338
338
|
|
|
339
|
-
function isClipboardAPIAvailable() {
|
|
340
|
-
var _navigator, _navigator2;
|
|
341
|
-
return typeof ((_navigator = navigator) === null || _navigator === void 0 || (_navigator = _navigator.clipboard) === null || _navigator === void 0 ? void 0 : _navigator.writeText) === 'function' && typeof ((_navigator2 = navigator) === null || _navigator2 === void 0 || (_navigator2 = _navigator2.clipboard) === null || _navigator2 === void 0 ? void 0 : _navigator2.read) === 'function';
|
|
342
|
-
}
|
|
343
|
-
function notifyCopyCut() {
|
|
344
|
-
var event = new Event('copyOrCutComplete');
|
|
345
|
-
window.dispatchEvent(event);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
339
|
function _createForOfIteratorHelper$f(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$g(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
349
340
|
function _unsupportedIterableToArray$g(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$g(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$g(o, minLen); }
|
|
350
341
|
function _arrayLikeToArray$g(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -381,14 +372,14 @@ var ClipArea = function (_Component) {
|
|
|
381
372
|
if (!_this2.props.focused()) {
|
|
382
373
|
return;
|
|
383
374
|
}
|
|
384
|
-
if (isClipboardAPIAvailable()) {
|
|
375
|
+
if (ketcherCore.isClipboardAPIAvailable()) {
|
|
385
376
|
_this2.props.onCopy().then(function (data) {
|
|
386
377
|
if (!data) {
|
|
387
378
|
return;
|
|
388
379
|
}
|
|
389
380
|
_copy(data).then(function () {
|
|
390
381
|
event.preventDefault();
|
|
391
|
-
notifyCopyCut();
|
|
382
|
+
ketcherCore.notifyCopyCut();
|
|
392
383
|
});
|
|
393
384
|
});
|
|
394
385
|
} else {
|
|
@@ -421,14 +412,14 @@ var ClipArea = function (_Component) {
|
|
|
421
412
|
}
|
|
422
413
|
return _context.abrupt("return");
|
|
423
414
|
case 2:
|
|
424
|
-
if (isClipboardAPIAvailable()) {
|
|
415
|
+
if (ketcherCore.isClipboardAPIAvailable()) {
|
|
425
416
|
_this2.props.onCut().then(function (data) {
|
|
426
417
|
if (!data) {
|
|
427
418
|
return;
|
|
428
419
|
}
|
|
429
420
|
_copy(data).then(function () {
|
|
430
421
|
event.preventDefault();
|
|
431
|
-
notifyCopyCut();
|
|
422
|
+
ketcherCore.notifyCopyCut();
|
|
432
423
|
});
|
|
433
424
|
});
|
|
434
425
|
} else {
|
|
@@ -453,7 +444,7 @@ var ClipArea = function (_Component) {
|
|
|
453
444
|
if (!_this2.props.focused()) {
|
|
454
445
|
return;
|
|
455
446
|
}
|
|
456
|
-
if (isClipboardAPIAvailable()) {
|
|
447
|
+
if (ketcherCore.isClipboardAPIAvailable()) {
|
|
457
448
|
navigator.clipboard.read().then(function (data) {
|
|
458
449
|
if (!data) {
|
|
459
450
|
return;
|
|
@@ -3660,7 +3651,7 @@ var zoom = {
|
|
|
3660
3651
|
|
|
3661
3652
|
var openHelpLink = function openHelpLink() {
|
|
3662
3653
|
var _window$open;
|
|
3663
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.
|
|
3654
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.21.0-rc.2\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3664
3655
|
};
|
|
3665
3656
|
var help = {
|
|
3666
3657
|
help: {
|
|
@@ -18991,7 +18982,7 @@ function initClipboard(dispatch) {
|
|
|
18991
18982
|
while (1) switch (_context5.prev = _context5.next) {
|
|
18992
18983
|
case 0:
|
|
18993
18984
|
_context5.next = 2;
|
|
18994
|
-
return getStructStringFromClipboardData(data);
|
|
18985
|
+
return ketcherCore.getStructStringFromClipboardData(data);
|
|
18995
18986
|
case 2:
|
|
18996
18987
|
structStr = _context5.sent;
|
|
18997
18988
|
if (structStr || !rxnTextPlain.test(data['text/plain'])) {
|
|
@@ -19043,92 +19034,6 @@ function initClipboard(dispatch) {
|
|
|
19043
19034
|
}
|
|
19044
19035
|
};
|
|
19045
19036
|
}
|
|
19046
|
-
function safelyGetMimeType(_x, _x2) {
|
|
19047
|
-
return _safelyGetMimeType.apply(this, arguments);
|
|
19048
|
-
}
|
|
19049
|
-
function _safelyGetMimeType() {
|
|
19050
|
-
_safelyGetMimeType = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee7(clipboardItem, mimeType) {
|
|
19051
|
-
var result;
|
|
19052
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context7) {
|
|
19053
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
19054
|
-
case 0:
|
|
19055
|
-
_context7.prev = 0;
|
|
19056
|
-
_context7.next = 3;
|
|
19057
|
-
return clipboardItem.getType(mimeType);
|
|
19058
|
-
case 3:
|
|
19059
|
-
result = _context7.sent;
|
|
19060
|
-
return _context7.abrupt("return", result);
|
|
19061
|
-
case 7:
|
|
19062
|
-
_context7.prev = 7;
|
|
19063
|
-
_context7.t0 = _context7["catch"](0);
|
|
19064
|
-
return _context7.abrupt("return", '');
|
|
19065
|
-
case 10:
|
|
19066
|
-
case "end":
|
|
19067
|
-
return _context7.stop();
|
|
19068
|
-
}
|
|
19069
|
-
}, _callee7, null, [[0, 7]]);
|
|
19070
|
-
}));
|
|
19071
|
-
return _safelyGetMimeType.apply(this, arguments);
|
|
19072
|
-
}
|
|
19073
|
-
function getStructStringFromClipboardData(_x3) {
|
|
19074
|
-
return _getStructStringFromClipboardData.apply(this, arguments);
|
|
19075
|
-
}
|
|
19076
|
-
function _getStructStringFromClipboardData() {
|
|
19077
|
-
_getStructStringFromClipboardData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee8(data) {
|
|
19078
|
-
var clipboardItem, structStr;
|
|
19079
|
-
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context8) {
|
|
19080
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
19081
|
-
case 0:
|
|
19082
|
-
clipboardItem = data[0];
|
|
19083
|
-
if (!(clipboardItem instanceof ClipboardItem)) {
|
|
19084
|
-
_context8.next = 23;
|
|
19085
|
-
break;
|
|
19086
|
-
}
|
|
19087
|
-
_context8.next = 4;
|
|
19088
|
-
return safelyGetMimeType(clipboardItem, "web ".concat(ketcherCore.ChemicalMimeType.KET));
|
|
19089
|
-
case 4:
|
|
19090
|
-
_context8.t2 = _context8.sent;
|
|
19091
|
-
if (_context8.t2) {
|
|
19092
|
-
_context8.next = 9;
|
|
19093
|
-
break;
|
|
19094
|
-
}
|
|
19095
|
-
_context8.next = 8;
|
|
19096
|
-
return safelyGetMimeType(clipboardItem, "web ".concat(ketcherCore.ChemicalMimeType.Mol));
|
|
19097
|
-
case 8:
|
|
19098
|
-
_context8.t2 = _context8.sent;
|
|
19099
|
-
case 9:
|
|
19100
|
-
_context8.t1 = _context8.t2;
|
|
19101
|
-
if (_context8.t1) {
|
|
19102
|
-
_context8.next = 14;
|
|
19103
|
-
break;
|
|
19104
|
-
}
|
|
19105
|
-
_context8.next = 13;
|
|
19106
|
-
return safelyGetMimeType(clipboardItem, "web ".concat(ketcherCore.ChemicalMimeType.Rxn));
|
|
19107
|
-
case 13:
|
|
19108
|
-
_context8.t1 = _context8.sent;
|
|
19109
|
-
case 14:
|
|
19110
|
-
_context8.t0 = _context8.t1;
|
|
19111
|
-
if (_context8.t0) {
|
|
19112
|
-
_context8.next = 19;
|
|
19113
|
-
break;
|
|
19114
|
-
}
|
|
19115
|
-
_context8.next = 18;
|
|
19116
|
-
return safelyGetMimeType(clipboardItem, 'text/plain');
|
|
19117
|
-
case 18:
|
|
19118
|
-
_context8.t0 = _context8.sent;
|
|
19119
|
-
case 19:
|
|
19120
|
-
structStr = _context8.t0;
|
|
19121
|
-
return _context8.abrupt("return", structStr === '' ? '' : structStr.text());
|
|
19122
|
-
case 23:
|
|
19123
|
-
return _context8.abrupt("return", data[ketcherCore.ChemicalMimeType.KET] || data[ketcherCore.ChemicalMimeType.Mol] || data[ketcherCore.ChemicalMimeType.Rxn] || data['text/plain']);
|
|
19124
|
-
case 24:
|
|
19125
|
-
case "end":
|
|
19126
|
-
return _context8.stop();
|
|
19127
|
-
}
|
|
19128
|
-
}, _callee8);
|
|
19129
|
-
}));
|
|
19130
|
-
return _getStructStringFromClipboardData.apply(this, arguments);
|
|
19131
|
-
}
|
|
19132
19037
|
function isAbleToCopy(editor) {
|
|
19133
19038
|
var struct = editor.structSelected();
|
|
19134
19039
|
var errorHandler = editor.errorHandler;
|
|
@@ -19142,49 +19047,49 @@ function isAbleToCopy(editor) {
|
|
|
19142
19047
|
}
|
|
19143
19048
|
return true;
|
|
19144
19049
|
}
|
|
19145
|
-
function clipData(
|
|
19050
|
+
function clipData(_x) {
|
|
19146
19051
|
return _clipData.apply(this, arguments);
|
|
19147
19052
|
}
|
|
19148
19053
|
function _clipData() {
|
|
19149
|
-
_clipData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function
|
|
19054
|
+
_clipData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee7(editor) {
|
|
19150
19055
|
var res, struct, errorHandler, serializer, ket, ketcherInstance, data, type;
|
|
19151
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
19152
|
-
while (1) switch (
|
|
19056
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context7) {
|
|
19057
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
19153
19058
|
case 0:
|
|
19154
19059
|
if (isAbleToCopy(editor)) {
|
|
19155
|
-
|
|
19060
|
+
_context7.next = 2;
|
|
19156
19061
|
break;
|
|
19157
19062
|
}
|
|
19158
|
-
return
|
|
19063
|
+
return _context7.abrupt("return", null);
|
|
19159
19064
|
case 2:
|
|
19160
19065
|
res = {};
|
|
19161
19066
|
struct = editor.structSelected();
|
|
19162
19067
|
errorHandler = editor.errorHandler;
|
|
19163
|
-
|
|
19068
|
+
_context7.prev = 5;
|
|
19164
19069
|
serializer = new ketcherCore.KetSerializer();
|
|
19165
19070
|
ket = serializer.serialize(struct);
|
|
19166
19071
|
ketcherInstance = ketcherCore.ketcherProvider.getKetcher();
|
|
19167
|
-
|
|
19072
|
+
_context7.next = 11;
|
|
19168
19073
|
return ketcherCore.getStructure(ketcherCore.SupportedFormat.molAuto, ketcherInstance.formatterFactory, struct);
|
|
19169
19074
|
case 11:
|
|
19170
|
-
data =
|
|
19075
|
+
data = _context7.sent;
|
|
19171
19076
|
res[ketcherCore.ChemicalMimeType.KET] = ket;
|
|
19172
19077
|
type = struct.isReaction ? ketcherCore.ChemicalMimeType.Mol : ketcherCore.ChemicalMimeType.Rxn;
|
|
19173
19078
|
res['text/plain'] = data;
|
|
19174
19079
|
res[type] = data;
|
|
19175
|
-
return
|
|
19080
|
+
return _context7.abrupt("return", res);
|
|
19176
19081
|
case 19:
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
ketcherCore.KetcherLogger.error('hotkeys.ts::clipData',
|
|
19180
|
-
errorHandler && errorHandler(
|
|
19082
|
+
_context7.prev = 19;
|
|
19083
|
+
_context7.t0 = _context7["catch"](5);
|
|
19084
|
+
ketcherCore.KetcherLogger.error('hotkeys.ts::clipData', _context7.t0);
|
|
19085
|
+
errorHandler && errorHandler(_context7.t0.message);
|
|
19181
19086
|
case 23:
|
|
19182
|
-
return
|
|
19087
|
+
return _context7.abrupt("return", null);
|
|
19183
19088
|
case 24:
|
|
19184
19089
|
case "end":
|
|
19185
|
-
return
|
|
19090
|
+
return _context7.stop();
|
|
19186
19091
|
}
|
|
19187
|
-
},
|
|
19092
|
+
}, _callee7, null, [[5, 19]]);
|
|
19188
19093
|
}));
|
|
19189
19094
|
return _clipData.apply(this, arguments);
|
|
19190
19095
|
}
|
|
@@ -32919,8 +32824,8 @@ var KetcherBuilder = function () {
|
|
|
32919
32824
|
initApp(element, appRoot, staticResourcesUrl, {
|
|
32920
32825
|
buttons: buttons || {},
|
|
32921
32826
|
errorHandler: errorHandler || null,
|
|
32922
|
-
version: "2.
|
|
32923
|
-
buildDate: "2024-
|
|
32827
|
+
version: "2.21.0-rc.2" ,
|
|
32828
|
+
buildDate: "2024-05-07T11:51:00" ,
|
|
32924
32829
|
buildNumber: ''
|
|
32925
32830
|
}, structService, resolve, togglerComponent);
|
|
32926
32831
|
});
|
|
@@ -32955,6 +32860,10 @@ var KetcherBuilder = function () {
|
|
|
32955
32860
|
}
|
|
32956
32861
|
var ketcher = new ketcherCore.Ketcher(this.editor, this.structService, this.formatterFactory);
|
|
32957
32862
|
ketcher[this.serviceMode] = true;
|
|
32863
|
+
var userInput = document.location.search;
|
|
32864
|
+
if (userInput === '__proto__' || userInput === 'constructor' || userInput === 'prototype') {
|
|
32865
|
+
return;
|
|
32866
|
+
}
|
|
32958
32867
|
var params = new URLSearchParams(document.location.search);
|
|
32959
32868
|
var initialMol = params.get('moll');
|
|
32960
32869
|
if (initialMol) {
|
|
@@ -33019,7 +32928,7 @@ function Editor(props) {
|
|
|
33019
32928
|
element: rootElRef.current,
|
|
33020
32929
|
appRoot: appRoot
|
|
33021
32930
|
})).then(function (ketcher) {
|
|
33022
|
-
if (typeof onInit === 'function') {
|
|
32931
|
+
if (typeof onInit === 'function' && ketcher) {
|
|
33023
32932
|
onInit(ketcher);
|
|
33024
32933
|
window.dispatchEvent(ketcherInitEvent);
|
|
33025
32934
|
}
|