opentiny 6.9.21 → 6.9.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentiny",
3
- "version": "6.9.21",
3
+ "version": "6.9.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mild-blue/opentiny"
package/tinymce.js CHANGED
@@ -26295,8 +26295,9 @@
26295
26295
  const img = new Image();
26296
26296
  img.src = blobInfo.blobUri();
26297
26297
  img.onload = () => {
26298
- const contentBodyElement = editor.dom.select('.mce-content-body')[0];
26299
- const maxImageWidth = contentBodyElement ? parseInt(window.getComputedStyle(contentBodyElement).width) : defaultMaxImageWidthPx;
26298
+ const contentBodyElement = editor.dom.select('.mce-content-body')[0].children[0];
26299
+ const computedStyles = contentBodyElement ? window.getComputedStyle(contentBodyElement) : null;
26300
+ const maxImageWidth = computedStyles ? parseInt(computedStyles.width) - parseInt(computedStyles.paddingLeft) - parseInt(computedStyles.paddingRight) : defaultMaxImageWidthPx;
26300
26301
  const imageWidth = Math.min(img.naturalWidth, maxImageWidth);
26301
26302
  pasteHtml(editor, `<img src="${ blobInfo.blobUri() }" width="${ imageWidth }px">`, false, true);
26302
26303
  };