opentiny 6.9.4 → 6.9.5
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 +1 -1
- package/tinymce.js +12 -1
- package/tinymce.min.js +1 -1
package/package.json
CHANGED
package/tinymce.js
CHANGED
|
@@ -26176,6 +26176,7 @@
|
|
|
26176
26176
|
}
|
|
26177
26177
|
};
|
|
26178
26178
|
|
|
26179
|
+
const defaultMaxImageWidthPx = 300;
|
|
26179
26180
|
const uniqueId = createIdGenerator('mceclip');
|
|
26180
26181
|
const createPasteDataTransfer = html => {
|
|
26181
26182
|
const dataTransfer = createDataTransfer();
|
|
@@ -26245,7 +26246,17 @@
|
|
|
26245
26246
|
const blobCache = editor.editorUpload.blobCache;
|
|
26246
26247
|
const existingBlobInfo = blobCache.getByData(base64, type);
|
|
26247
26248
|
const blobInfo = existingBlobInfo !== null && existingBlobInfo !== void 0 ? existingBlobInfo : createBlobInfo(editor, blobCache, file, base64);
|
|
26248
|
-
|
|
26249
|
+
const img = new Image();
|
|
26250
|
+
img.src = blobInfo.blobUri();
|
|
26251
|
+
img.onload = () => {
|
|
26252
|
+
const contentBodyElement = editor.dom.select('.mce-content-body')[0];
|
|
26253
|
+
const maxImageWidth = contentBodyElement ? parseInt(window.getComputedStyle(contentBodyElement).width) : defaultMaxImageWidthPx;
|
|
26254
|
+
const imageWidth = Math.min(img.naturalWidth, maxImageWidth);
|
|
26255
|
+
pasteHtml(editor, `<img src="${ blobInfo.blobUri() }" width="${ imageWidth }px">`, false, true);
|
|
26256
|
+
};
|
|
26257
|
+
img.onerror = err => {
|
|
26258
|
+
console.error('Failed to load the image blob:', err);
|
|
26259
|
+
};
|
|
26249
26260
|
});
|
|
26250
26261
|
};
|
|
26251
26262
|
const isClipboardEvent = event => event.type === 'paste';
|