ketcher-react 2.15.0-rc.5 → 2.15.0-rc.6

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
@@ -331,6 +331,15 @@ var debugObj = {
331
331
 
332
332
  var classes$R = {"cliparea":"cliparea-module_cliparea__GdPrN"};
333
333
 
334
+ function isClipboardAPIAvailable() {
335
+ var _navigator;
336
+ return typeof ((_navigator = navigator) === null || _navigator === void 0 || (_navigator = _navigator.clipboard) === null || _navigator === void 0 ? void 0 : _navigator.writeText) === 'function';
337
+ }
338
+ function notifyCopyCut() {
339
+ var event = new Event('copyOrCutComplete');
340
+ window.dispatchEvent(event);
341
+ }
342
+
334
343
  function _createSuper$d(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$d(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
335
344
  function _isNativeReflectConstruct$d() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
336
345
  var ieCb = window.clipboardData;
@@ -360,76 +369,87 @@ var ClipArea = function (_Component) {
360
369
  mousedown: function mousedown(event) {
361
370
  if (event.shiftKey && !isActiveElement(event.target)) event.preventDefault();
362
371
  },
363
- copy: function () {
364
- var _copy2 = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee(event) {
372
+ copy: function copy(event) {
373
+ if (!_this2.props.focused()) {
374
+ return;
375
+ }
376
+ if (isClipboardAPIAvailable()) {
377
+ _this2.props.onCopy().then(function (data) {
378
+ if (!data) {
379
+ return;
380
+ }
381
+ _copy(data).then(function () {
382
+ event.preventDefault();
383
+ notifyCopyCut();
384
+ });
385
+ });
386
+ } else {
387
+ var data = _this2.props.onLegacyCopy();
388
+ if (data) {
389
+ legacyCopy(event.clipboardData, data);
390
+ }
391
+ event.preventDefault();
392
+ }
393
+ },
394
+ cut: function () {
395
+ var _cut = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee(event) {
365
396
  var data;
366
397
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
367
398
  while (1) switch (_context.prev = _context.next) {
368
399
  case 0:
369
- if (!(_this2.props.focused() && _this2.props.onCopy)) {
370
- _context.next = 8;
400
+ if (_this2.props.focused()) {
401
+ _context.next = 2;
371
402
  break;
372
403
  }
373
- _context.next = 3;
374
- return _this2.props.onCopy();
375
- case 3:
376
- data = _context.sent;
377
- if (!data) {
378
- _context.next = 7;
379
- break;
404
+ return _context.abrupt("return");
405
+ case 2:
406
+ if (isClipboardAPIAvailable()) {
407
+ _this2.props.onCut().then(function (data) {
408
+ if (!data) {
409
+ return;
410
+ }
411
+ _copy(data).then(function () {
412
+ event.preventDefault();
413
+ notifyCopyCut();
414
+ });
415
+ });
416
+ } else {
417
+ data = _this2.props.onLegacyCut();
418
+ if (data) {
419
+ legacyCopy(event.clipboardData, data);
420
+ }
421
+ event.preventDefault();
380
422
  }
381
- _context.next = 7;
382
- return _copy(data);
383
- case 7:
384
- event.preventDefault();
385
- case 8:
423
+ case 3:
386
424
  case "end":
387
425
  return _context.stop();
388
426
  }
389
427
  }, _callee);
390
428
  }));
391
- function copy(_x) {
392
- return _copy2.apply(this, arguments);
393
- }
394
- return copy;
395
- }(),
396
- cut: function () {
397
- var _cut = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee2(event) {
398
- var data;
399
- return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
400
- while (1) switch (_context2.prev = _context2.next) {
401
- case 0:
402
- if (!(_this2.props.focused() && _this2.props.onCut)) {
403
- _context2.next = 8;
404
- break;
405
- }
406
- _context2.next = 3;
407
- return _this2.props.onCut();
408
- case 3:
409
- data = _context2.sent;
410
- if (!data) {
411
- _context2.next = 7;
412
- break;
413
- }
414
- _context2.next = 7;
415
- return _copy(data);
416
- case 7:
417
- event.preventDefault();
418
- case 8:
419
- case "end":
420
- return _context2.stop();
421
- }
422
- }, _callee2);
423
- }));
424
- function cut(_x2) {
429
+ function cut(_x) {
425
430
  return _cut.apply(this, arguments);
426
431
  }
427
432
  return cut;
428
433
  }(),
429
434
  paste: function paste(event) {
430
- if (_this2.props.focused() && _this2.props.onPaste) {
431
- var data = _paste(event.clipboardData, _this2.props.formats);
432
- if (data) _this2.props.onPaste(data);
435
+ if (!_this2.props.focused()) {
436
+ return;
437
+ }
438
+ if (isClipboardAPIAvailable()) {
439
+ navigator.clipboard.read().then(function (data) {
440
+ if (!data) {
441
+ return;
442
+ }
443
+ _this2.props.onPaste(data).then(function () {
444
+ event.preventDefault();
445
+ notifyCopyCut();
446
+ });
447
+ });
448
+ } else {
449
+ var data = legacyPaste(event.clipboardData, _this2.props.formats);
450
+ if (data) {
451
+ _this2.props.onLegacyPaste(data);
452
+ }
433
453
  event.preventDefault();
434
454
  }
435
455
  }
@@ -474,32 +494,55 @@ function autoselect(cliparea) {
474
494
  cliparea.value = ' ';
475
495
  cliparea.select();
476
496
  }
477
- function _copy(_x3) {
478
- return _copy3.apply(this, arguments);
497
+ function _copy(_x2) {
498
+ return _copy2.apply(this, arguments);
479
499
  }
480
- function _copy3() {
481
- _copy3 = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee3(data) {
482
- return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
483
- while (1) switch (_context3.prev = _context3.next) {
500
+ function _copy2() {
501
+ _copy2 = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee2(data) {
502
+ var clipboardItemData;
503
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
504
+ while (1) switch (_context2.prev = _context2.next) {
484
505
  case 0:
485
- _context3.prev = 0;
486
- _context3.next = 3;
487
- return navigator.clipboard.writeText(data['text/plain']);
488
- case 3:
489
- _context3.next = 8;
490
- break;
506
+ _context2.prev = 0;
507
+ clipboardItemData = {};
508
+ Object.keys(data).forEach(function (mimeType) {
509
+ var mimeTypeToSet = mimeType === 'text/plain' ? mimeType : "web ".concat(mimeType);
510
+ clipboardItemData[mimeTypeToSet] = Promise.resolve(new Blob([data[mimeType]], {
511
+ type: mimeTypeToSet
512
+ }));
513
+ });
514
+ _context2.next = 5;
515
+ return navigator.clipboard.write([new ClipboardItem(clipboardItemData)]);
491
516
  case 5:
492
- _context3.prev = 5;
493
- _context3.t0 = _context3["catch"](0);
494
- case 8:
517
+ _context2.next = 10;
518
+ break;
519
+ case 7:
520
+ _context2.prev = 7;
521
+ _context2.t0 = _context2["catch"](0);
522
+ case 10:
495
523
  case "end":
496
- return _context3.stop();
524
+ return _context2.stop();
497
525
  }
498
- }, _callee3, null, [[0, 5]]);
526
+ }, _callee2, null, [[0, 7]]);
499
527
  }));
500
- return _copy3.apply(this, arguments);
528
+ return _copy2.apply(this, arguments);
501
529
  }
502
- function _paste(cb, formats) {
530
+ function legacyCopy(clipboardData, data) {
531
+ if (!clipboardData && ieCb) {
532
+ ieCb.setData('text', data['text/plain']);
533
+ } else {
534
+ var curFmt = null;
535
+ clipboardData.setData('text/plain', data['text/plain']);
536
+ try {
537
+ Object.keys(data).forEach(function (fmt) {
538
+ curFmt = fmt;
539
+ clipboardData.setData(fmt, data[fmt]);
540
+ });
541
+ } catch (e) {
542
+ }
543
+ }
544
+ }
545
+ function legacyPaste(cb, formats) {
503
546
  var data = {};
504
547
  if (!cb && ieCb) {
505
548
  data['text/plain'] = ieCb.getData('text');
@@ -3322,7 +3365,7 @@ var zoom = {
3322
3365
 
3323
3366
  var openHelpLink = function openHelpLink() {
3324
3367
  var _window$open;
3325
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.15.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3368
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.15.0-rc.6\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3326
3369
  };
3327
3370
  var help = {
3328
3371
  help: {
@@ -17237,114 +17280,310 @@ function initClipboard(dispatch) {
17237
17280
  var state = global.currentState;
17238
17281
  return !state.modal;
17239
17282
  },
17283
+ onLegacyCut: function onLegacyCut() {
17284
+ var state = global.currentState;
17285
+ var editor = state.editor;
17286
+ var data = legacyClipData(editor);
17287
+ if (data) debAction({
17288
+ tool: 'eraser',
17289
+ opts: 1
17290
+ });else editor.selection(null);
17291
+ return data;
17292
+ },
17240
17293
  onCut: function onCut() {
17241
- return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee() {
17242
- var state, editor, data;
17243
- return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
17244
- while (1) switch (_context.prev = _context.next) {
17294
+ return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee2() {
17295
+ var ketcherInstance, result;
17296
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
17297
+ while (1) switch (_context2.prev = _context2.next) {
17245
17298
  case 0:
17246
- state = global.currentState;
17247
- editor = state.editor;
17248
- _context.next = 4;
17249
- return clipData(editor);
17250
- case 4:
17251
- data = _context.sent;
17252
- if (data) debAction({
17253
- tool: 'eraser',
17254
- opts: 1
17255
- });else editor.selection(null);
17256
- return _context.abrupt("return", data);
17257
- case 7:
17299
+ ketcherInstance = ketcherCore.ketcherProvider.getKetcher();
17300
+ _context2.next = 3;
17301
+ return ketcherCore.runAsyncAction( _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee() {
17302
+ var state, editor, data;
17303
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
17304
+ while (1) switch (_context.prev = _context.next) {
17305
+ case 0:
17306
+ state = global.currentState;
17307
+ editor = state.editor;
17308
+ _context.next = 4;
17309
+ return clipData(editor);
17310
+ case 4:
17311
+ data = _context.sent;
17312
+ if (data) debAction({
17313
+ tool: 'eraser',
17314
+ opts: 1
17315
+ });else editor.selection(null);
17316
+ return _context.abrupt("return", data);
17317
+ case 7:
17318
+ case "end":
17319
+ return _context.stop();
17320
+ }
17321
+ }, _callee);
17322
+ })), ketcherInstance.eventBus);
17323
+ case 3:
17324
+ result = _context2.sent;
17325
+ return _context2.abrupt("return", result);
17326
+ case 5:
17258
17327
  case "end":
17259
- return _context.stop();
17328
+ return _context2.stop();
17260
17329
  }
17261
- }, _callee);
17330
+ }, _callee2);
17262
17331
  }))();
17263
17332
  },
17333
+ onLegacyCopy: function onLegacyCopy() {
17334
+ var state = global.currentState;
17335
+ var editor = state.editor;
17336
+ var data = legacyClipData(editor);
17337
+ editor.selection(null);
17338
+ return data;
17339
+ },
17264
17340
  onCopy: function onCopy() {
17265
- return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee2() {
17266
- var state, editor, data;
17267
- return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
17268
- while (1) switch (_context2.prev = _context2.next) {
17341
+ return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee4() {
17342
+ var ketcherInstance, result;
17343
+ return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
17344
+ while (1) switch (_context4.prev = _context4.next) {
17269
17345
  case 0:
17270
- state = global.currentState;
17271
- editor = state.editor;
17272
- _context2.next = 4;
17273
- return clipData(editor);
17274
- case 4:
17275
- data = _context2.sent;
17276
- editor.selection(null);
17277
- return _context2.abrupt("return", data);
17278
- case 7:
17346
+ ketcherInstance = ketcherCore.ketcherProvider.getKetcher();
17347
+ _context4.next = 3;
17348
+ return ketcherCore.runAsyncAction( _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee3() {
17349
+ var state, editor, data;
17350
+ return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
17351
+ while (1) switch (_context3.prev = _context3.next) {
17352
+ case 0:
17353
+ state = global.currentState;
17354
+ editor = state.editor;
17355
+ _context3.next = 4;
17356
+ return clipData(editor);
17357
+ case 4:
17358
+ data = _context3.sent;
17359
+ editor.selection(null);
17360
+ return _context3.abrupt("return", data);
17361
+ case 7:
17362
+ case "end":
17363
+ return _context3.stop();
17364
+ }
17365
+ }, _callee3);
17366
+ })), ketcherInstance.eventBus);
17367
+ case 3:
17368
+ result = _context4.sent;
17369
+ return _context4.abrupt("return", result);
17370
+ case 5:
17279
17371
  case "end":
17280
- return _context2.stop();
17372
+ return _context4.stop();
17281
17373
  }
17282
- }, _callee2);
17374
+ }, _callee4);
17283
17375
  }))();
17284
17376
  },
17285
17377
  onPaste: function onPaste(data) {
17378
+ return _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee6() {
17379
+ var ketcherInstance, result;
17380
+ return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
17381
+ while (1) switch (_context6.prev = _context6.next) {
17382
+ case 0:
17383
+ ketcherInstance = ketcherCore.ketcherProvider.getKetcher();
17384
+ _context6.next = 3;
17385
+ return ketcherCore.runAsyncAction( _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee5() {
17386
+ var structStr;
17387
+ return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context5) {
17388
+ while (1) switch (_context5.prev = _context5.next) {
17389
+ case 0:
17390
+ _context5.next = 2;
17391
+ return getStructStringFromClipboardData(data);
17392
+ case 2:
17393
+ structStr = _context5.sent;
17394
+ if (structStr || !rxnTextPlain.test(data['text/plain'])) {
17395
+ loadStruct(structStr, {
17396
+ fragment: true,
17397
+ isPaste: true
17398
+ });
17399
+ }
17400
+ case 4:
17401
+ case "end":
17402
+ return _context5.stop();
17403
+ }
17404
+ }, _callee5);
17405
+ })), ketcherInstance.eventBus);
17406
+ case 3:
17407
+ result = _context6.sent;
17408
+ return _context6.abrupt("return", result);
17409
+ case 5:
17410
+ case "end":
17411
+ return _context6.stop();
17412
+ }
17413
+ }, _callee6);
17414
+ }))();
17415
+ },
17416
+ onLegacyPaste: function onLegacyPaste(data) {
17286
17417
  var structStr = data[ketcherCore.ChemicalMimeType.KET] || data[ketcherCore.ChemicalMimeType.Mol] || data[ketcherCore.ChemicalMimeType.Rxn] || data['text/plain'];
17287
- if (structStr || !rxnTextPlain.test(data['text/plain'])) loadStruct(structStr, {
17288
- fragment: true,
17289
- isPaste: true
17290
- });
17418
+ if (structStr || !rxnTextPlain.test(data['text/plain'])) {
17419
+ loadStruct(structStr, {
17420
+ fragment: true,
17421
+ isPaste: true
17422
+ });
17423
+ }
17291
17424
  }
17292
17425
  };
17293
17426
  }
17294
- function clipData(_x) {
17427
+ function safelyGetMimeType(_x, _x2) {
17428
+ return _safelyGetMimeType.apply(this, arguments);
17429
+ }
17430
+ function _safelyGetMimeType() {
17431
+ _safelyGetMimeType = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee7(clipboardItem, mimeType) {
17432
+ var result;
17433
+ return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context7) {
17434
+ while (1) switch (_context7.prev = _context7.next) {
17435
+ case 0:
17436
+ _context7.prev = 0;
17437
+ _context7.next = 3;
17438
+ return clipboardItem.getType(mimeType);
17439
+ case 3:
17440
+ result = _context7.sent;
17441
+ return _context7.abrupt("return", result);
17442
+ case 7:
17443
+ _context7.prev = 7;
17444
+ _context7.t0 = _context7["catch"](0);
17445
+ return _context7.abrupt("return", '');
17446
+ case 10:
17447
+ case "end":
17448
+ return _context7.stop();
17449
+ }
17450
+ }, _callee7, null, [[0, 7]]);
17451
+ }));
17452
+ return _safelyGetMimeType.apply(this, arguments);
17453
+ }
17454
+ function getStructStringFromClipboardData(_x3) {
17455
+ return _getStructStringFromClipboardData.apply(this, arguments);
17456
+ }
17457
+ function _getStructStringFromClipboardData() {
17458
+ _getStructStringFromClipboardData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee8(data) {
17459
+ var clipboardItem, structStr;
17460
+ return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context8) {
17461
+ while (1) switch (_context8.prev = _context8.next) {
17462
+ case 0:
17463
+ clipboardItem = data[0];
17464
+ _context8.next = 3;
17465
+ return safelyGetMimeType(clipboardItem, "web ".concat(ketcherCore.ChemicalMimeType.KET));
17466
+ case 3:
17467
+ _context8.t2 = _context8.sent;
17468
+ if (_context8.t2) {
17469
+ _context8.next = 8;
17470
+ break;
17471
+ }
17472
+ _context8.next = 7;
17473
+ return safelyGetMimeType(clipboardItem, "web ".concat(ketcherCore.ChemicalMimeType.Mol));
17474
+ case 7:
17475
+ _context8.t2 = _context8.sent;
17476
+ case 8:
17477
+ _context8.t1 = _context8.t2;
17478
+ if (_context8.t1) {
17479
+ _context8.next = 13;
17480
+ break;
17481
+ }
17482
+ _context8.next = 12;
17483
+ return safelyGetMimeType(clipboardItem, "web ".concat(ketcherCore.ChemicalMimeType.Rxn));
17484
+ case 12:
17485
+ _context8.t1 = _context8.sent;
17486
+ case 13:
17487
+ _context8.t0 = _context8.t1;
17488
+ if (_context8.t0) {
17489
+ _context8.next = 18;
17490
+ break;
17491
+ }
17492
+ _context8.next = 17;
17493
+ return safelyGetMimeType(clipboardItem, 'text/plain');
17494
+ case 17:
17495
+ _context8.t0 = _context8.sent;
17496
+ case 18:
17497
+ structStr = _context8.t0;
17498
+ return _context8.abrupt("return", structStr === '' ? '' : structStr.text());
17499
+ case 20:
17500
+ case "end":
17501
+ return _context8.stop();
17502
+ }
17503
+ }, _callee8);
17504
+ }));
17505
+ return _getStructStringFromClipboardData.apply(this, arguments);
17506
+ }
17507
+ function isAbleToCopy(editor) {
17508
+ var struct = editor.structSelected();
17509
+ var errorHandler = editor.errorHandler;
17510
+ if (struct.isBlank()) {
17511
+ return false;
17512
+ }
17513
+ var simpleObjectOrText = Boolean(struct.simpleObjects.size || struct.texts.size);
17514
+ if (simpleObjectOrText && reactDeviceDetect.isIE && errorHandler) {
17515
+ 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');
17516
+ return false;
17517
+ }
17518
+ return true;
17519
+ }
17520
+ function clipData(_x4) {
17295
17521
  return _clipData.apply(this, arguments);
17296
17522
  }
17297
17523
  function _clipData() {
17298
- _clipData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee3(editor) {
17299
- var res, struct, errorHandler, simpleObjectOrText, serializer, ket, ketcherInstance, data, type;
17300
- return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
17301
- while (1) switch (_context3.prev = _context3.next) {
17524
+ _clipData = _asyncToGenerator__default["default"]( _regeneratorRuntime__default["default"].mark(function _callee9(editor) {
17525
+ var res, struct, errorHandler, serializer, ket, ketcherInstance, data, type;
17526
+ return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context9) {
17527
+ while (1) switch (_context9.prev = _context9.next) {
17302
17528
  case 0:
17529
+ if (isAbleToCopy(editor)) {
17530
+ _context9.next = 2;
17531
+ break;
17532
+ }
17533
+ return _context9.abrupt("return", null);
17534
+ case 2:
17303
17535
  res = {};
17304
17536
  struct = editor.structSelected();
17305
17537
  errorHandler = editor.errorHandler;
17306
- if (!struct.isBlank()) {
17307
- _context3.next = 5;
17308
- break;
17309
- }
17310
- return _context3.abrupt("return", null);
17311
- case 5:
17312
- simpleObjectOrText = Boolean(struct.simpleObjects.size || struct.texts.size);
17313
- if (!(simpleObjectOrText && reactDeviceDetect.isIE && errorHandler)) {
17314
- _context3.next = 9;
17315
- break;
17316
- }
17317
- 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');
17318
- return _context3.abrupt("return", null);
17319
- case 9:
17320
- _context3.prev = 9;
17538
+ _context9.prev = 5;
17321
17539
  serializer = new ketcherCore.KetSerializer();
17322
17540
  ket = serializer.serialize(struct);
17323
17541
  ketcherInstance = ketcherCore.ketcherProvider.getKetcher();
17324
- _context3.next = 15;
17325
- return ketcherCore.getStructure(ketcherCore.SupportedFormat.molAuto,
17326
- ketcherInstance.formatterFactory, struct);
17327
- case 15:
17328
- data = _context3.sent;
17542
+ _context9.next = 11;
17543
+ return ketcherCore.getStructure(ketcherCore.SupportedFormat.molAuto, ketcherInstance.formatterFactory, struct);
17544
+ case 11:
17545
+ data = _context9.sent;
17329
17546
  res[ketcherCore.ChemicalMimeType.KET] = ket;
17330
17547
  type = struct.isReaction ? ketcherCore.ChemicalMimeType.Mol : ketcherCore.ChemicalMimeType.Rxn;
17331
17548
  res['text/plain'] = data;
17332
17549
  res[type] = data;
17333
- return _context3.abrupt("return", res);
17550
+ return _context9.abrupt("return", res);
17551
+ case 19:
17552
+ _context9.prev = 19;
17553
+ _context9.t0 = _context9["catch"](5);
17554
+ errorHandler && errorHandler(_context9.t0.message);
17555
+ case 22:
17556
+ return _context9.abrupt("return", null);
17334
17557
  case 23:
17335
- _context3.prev = 23;
17336
- _context3.t0 = _context3["catch"](9);
17337
- errorHandler && errorHandler(_context3.t0.message);
17338
- case 26:
17339
- return _context3.abrupt("return", null);
17340
- case 27:
17341
17558
  case "end":
17342
- return _context3.stop();
17559
+ return _context9.stop();
17343
17560
  }
17344
- }, _callee3, null, [[9, 23]]);
17561
+ }, _callee9, null, [[5, 19]]);
17345
17562
  }));
17346
17563
  return _clipData.apply(this, arguments);
17347
17564
  }
17565
+ function legacyClipData(editor) {
17566
+ if (!isAbleToCopy(editor)) {
17567
+ return null;
17568
+ }
17569
+ var res = {};
17570
+ var struct = editor.structSelected();
17571
+ var errorHandler = editor.errorHandler;
17572
+ var molSerializer = new ketcherCore.MolSerializer();
17573
+ try {
17574
+ var serializer = new ketcherCore.KetSerializer();
17575
+ var ket = serializer.serialize(struct);
17576
+ res[ketcherCore.ChemicalMimeType.KET] = ket;
17577
+ var type = struct.isReaction ? ketcherCore.ChemicalMimeType.Mol : ketcherCore.ChemicalMimeType.Rxn;
17578
+ var data = molSerializer.serialize(struct);
17579
+ res['text/plain'] = data;
17580
+ res[type] = data;
17581
+ return res;
17582
+ } catch (e) {
17583
+ errorHandler && errorHandler(e.message);
17584
+ }
17585
+ return null;
17586
+ }
17348
17587
 
17349
17588
  var AppClipArea = reactRedux.connect(null, function (dispatch) {
17350
17589
  return dispatch(initClipboard);
@@ -30940,8 +31179,8 @@ var KetcherBuilder = function () {
30940
31179
  initApp(element, appRoot, staticResourcesUrl, {
30941
31180
  buttons: buttons || {},
30942
31181
  errorHandler: errorHandler || null,
30943
- version: "2.15.0-rc.5" ,
30944
- buildDate: "2023-10-24T11:53:09" ,
31182
+ version: "2.15.0-rc.6" ,
31183
+ buildDate: "2023-10-27T14:41:31" ,
30945
31184
  buildNumber: ''
30946
31185
  }, structService, resolve);
30947
31186
  });