ketcher-react 2.26.0-rc.5 → 2.26.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
@@ -3798,7 +3798,7 @@ var zoom = {
3798
3798
 
3799
3799
  var openHelpLink = function openHelpLink() {
3800
3800
  var _window$open;
3801
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.26.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3801
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.26.0-rc.6\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3802
3802
  };
3803
3803
  var help = {
3804
3804
  help: {
@@ -23364,6 +23364,7 @@ var supportedMimesForRegex = supportedMimes.map(function (item) {
23364
23364
  }).join('|');
23365
23365
  var allowList = new RegExp("^image/(".concat(supportedMimesForRegex, ")$"));
23366
23366
  var MIN_DIMENSION_SIZE = 16;
23367
+ var MIN_SIZELESS_IMAGE_SRC_LENGTH = 320;
23367
23368
  var ImageTool = function () {
23368
23369
  function ImageTool(editor) {
23369
23370
  _classCallCheck__default["default"](this, ImageTool);
@@ -23448,7 +23449,9 @@ var ImageTool = function () {
23448
23449
  });
23449
23450
  image.onload = function () {
23450
23451
  _this.resetElementValue();
23451
- if (image.width < MIN_DIMENSION_SIZE || image.height < MIN_DIMENSION_SIZE) {
23452
+ var isValidSize = image.width >= MIN_DIMENSION_SIZE && image.height >= MIN_DIMENSION_SIZE;
23453
+ var isValidSizeless = image.width === 0 && image.height === 0 && image.src.length >= MIN_SIZELESS_IMAGE_SRC_LENGTH;
23454
+ if (!isValidSize && !isValidSizeless) {
23452
23455
  var _errorMessage = 'Image should be at least 16x16 pixels';
23453
23456
  ketcherCore.KetcherLogger.error("".concat(TAG, ":onLoad"), _errorMessage);
23454
23457
  if (errorHandler) {
@@ -23456,8 +23459,9 @@ var ImageTool = function () {
23456
23459
  }
23457
23460
  return;
23458
23461
  }
23459
- var halfSize = ketcherCore.Scale.canvasToModel(new ketcherCore.Vec2(image.width / 2, image.height / 2), _this.editor.render.options);
23460
- _this.editor.update(ketcherCore.fromImageCreation(_this.editor.render.ctab, image.src, clickPosition, halfSize));
23462
+ var halfSize = isValidSizeless ? new ketcherCore.Vec2(MIN_DIMENSION_SIZE, MIN_DIMENSION_SIZE) : new ketcherCore.Vec2(image.width / 2, image.height / 2);
23463
+ var halfSizeScaled = ketcherCore.Scale.canvasToModel(halfSize, _this.editor.render.options);
23464
+ _this.editor.update(ketcherCore.fromImageCreation(_this.editor.render.ctab, image.src, clickPosition, halfSizeScaled));
23461
23465
  };
23462
23466
  image.onerror = function (e) {
23463
23467
  _this.resetElementValue();
@@ -34845,8 +34849,8 @@ var KetcherBuilder = function () {
34845
34849
  cleanup = initApp(element, appRoot, staticResourcesUrl, {
34846
34850
  buttons: buttons || {},
34847
34851
  errorHandler: errorHandler || null,
34848
- version: "2.26.0-rc.5" ,
34849
- buildDate: "2024-10-21T15:20:30" ,
34852
+ version: "2.26.0-rc.6" ,
34853
+ buildDate: "2024-10-25T09:50:21" ,
34850
34854
  buildNumber: '',
34851
34855
  customButtons: customButtons || []
34852
34856
  }, structService, resolve, togglerComponent);