ketcher-react 3.16.0-rc.1 → 3.16.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/cjs/index.js CHANGED
@@ -349,6 +349,12 @@ function _arrayLikeToArray$m(r, a) { (null == a || a > r.length) && (a = r.lengt
349
349
  function _callSuper$d(t, o, e) { return o = _getPrototypeOf__default["default"](o), _possibleConstructorReturn__default["default"](t, _isNativeReflectConstruct$f() ? Reflect.construct(o, e || [], _getPrototypeOf__default["default"](t).constructor) : o.apply(t, e)); }
350
350
  function _isNativeReflectConstruct$f() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$f = function _isNativeReflectConstruct() { return !!t; })(); }
351
351
  var ieCb = typeof window !== 'undefined' ? window.clipboardData : undefined;
352
+ var isSafariBrowser = function isSafariBrowser() {
353
+ return typeof navigator !== 'undefined' && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
354
+ };
355
+ var isAsyncClipboardWriteAvailable = function isAsyncClipboardWriteAvailable() {
356
+ return ketcherCore.isClipboardAPIAvailable() && !isSafariBrowser();
357
+ };
352
358
  var CLIP_AREA_BASE_CLASS = 'cliparea';
353
359
  var needSkipCopyEvent = false;
354
360
  var isUserEditing = function isUserEditing() {
@@ -393,7 +399,7 @@ var ClipArea = function (_Component) {
393
399
  if (!_this2.props.focused() || isUserEditing()) {
394
400
  return;
395
401
  }
396
- if (ketcherCore.isClipboardAPIAvailable()) {
402
+ if (isAsyncClipboardWriteAvailable()) {
397
403
  _this2.props.onCopy().then(function (data) {
398
404
  if (!data) {
399
405
  return;
@@ -404,31 +410,39 @@ var ClipArea = function (_Component) {
404
410
  });
405
411
  });
406
412
  } else {
407
- if (needSkipCopyEvent) {
408
- needSkipCopyEvent = false;
409
- return;
410
- }
411
- needSkipCopyEvent = true;
412
- _this2.props.onCopy().then(function (data) {
413
- addEventListener('copy', function (evt) {
414
- var clipboardEvent = evt;
415
- if (clipboardEvent.clipboardData && data) {
416
- legacyCopy(clipboardEvent.clipboardData, data);
417
- }
418
- evt.preventDefault();
419
- }, {
420
- once: true
413
+ if (isSafariBrowser()) {
414
+ var data = _this2.props.onLegacyCopy();
415
+ if (data && event.clipboardData) {
416
+ legacyCopy(event.clipboardData, data);
417
+ }
418
+ event.preventDefault();
419
+ } else {
420
+ if (needSkipCopyEvent) {
421
+ needSkipCopyEvent = false;
422
+ return;
423
+ }
424
+ needSkipCopyEvent = true;
425
+ _this2.props.onCopy().then(function (data) {
426
+ addEventListener('copy', function (evt) {
427
+ var clipboardEvent = evt;
428
+ if (clipboardEvent.clipboardData && data) {
429
+ legacyCopy(clipboardEvent.clipboardData, data);
430
+ }
431
+ evt.preventDefault();
432
+ }, {
433
+ once: true
434
+ });
435
+ document.execCommand('copy');
421
436
  });
422
- document.execCommand('copy');
423
- });
424
- event.preventDefault();
437
+ event.preventDefault();
438
+ }
425
439
  }
426
440
  },
427
441
  cut: function cut(event) {
428
442
  if (!_this2.props.focused() || isUserEditing()) {
429
443
  return;
430
444
  }
431
- if (ketcherCore.isClipboardAPIAvailable()) {
445
+ if (isAsyncClipboardWriteAvailable()) {
432
446
  _asyncToGenerator__default["default"](_regeneratorRuntime__default["default"].mark(function _callee() {
433
447
  var data;
434
448
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
@@ -4097,7 +4111,7 @@ var zoom = {
4097
4111
 
4098
4112
  var openHelpLink = function openHelpLink() {
4099
4113
  var _window$open;
4100
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.16.0-rc.1\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
4114
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.16.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
4101
4115
  };
4102
4116
  var help = {
4103
4117
  help: {
@@ -21506,6 +21520,13 @@ function initClipboard(dispatch, getState) {
21506
21520
  var state = getState();
21507
21521
  return !state.modal;
21508
21522
  },
21523
+ onLegacyCopy: function onLegacyCopy() {
21524
+ var state = getState();
21525
+ var editor = state.editor;
21526
+ var data = legacyClipData(editor);
21527
+ editor.selection(null);
21528
+ return data;
21529
+ },
21509
21530
  onLegacyCut: function onLegacyCut() {
21510
21531
  var state = getState();
21511
21532
  var editor = state.editor;
@@ -42733,8 +42754,8 @@ var KetcherBuilder = function () {
42733
42754
  cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
42734
42755
  buttons: buttons !== null && buttons !== void 0 ? buttons : {},
42735
42756
  errorHandler: errorHandler !== null && errorHandler !== void 0 ? errorHandler : null,
42736
- version: (_rc = "3.16.0-rc.1") !== null && _rc !== void 0 ? _rc : '',
42737
- buildDate: (_T = "2026-05-06T20:46:24") !== null && _T !== void 0 ? _T : '',
42757
+ version: (_rc = "3.16.0-rc.3") !== null && _rc !== void 0 ? _rc : '',
42758
+ buildDate: (_T = "2026-06-04T18:41:03") !== null && _T !== void 0 ? _T : '',
42738
42759
  buildNumber: '',
42739
42760
  customButtons: customButtons !== null && customButtons !== void 0 ? customButtons : []
42740
42761
  }, structService, resolve, togglerComponent);
@@ -43047,7 +43068,7 @@ var ModeControl = function ModeControl(_ref4) {
43047
43068
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
43048
43069
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
43049
43070
  var MacromoleculesEditorComponent = React.lazy(function () {
43050
- return Promise.resolve().then(function () { return require('./index.modern-e64c5206.js'); });
43071
+ return Promise.resolve().then(function () { return require('./index.modern-e6e28fd3.js'); });
43051
43072
  });
43052
43073
  var Editor = function Editor(props) {
43053
43074
  var _useState = React.useState(false),