FIX: Return `naturalWidth` and `naturalHeight` for Composer image sizes (#13271)
Rather than returning the size of the currently rendered image in the composer window (which is dependent on browser settings such as window size and zoom level), return the actual dimensions of the image file itself.
(Also see commit abac614492
which was an earlier attempt to fix this by excluding Oneboxed images entirely. That was reverted as the CSS selector didn’t work on all browsers.)
This commit is contained in:
parent
9a449ac534
commit
9d8bc6a405
|
@ -770,12 +770,13 @@ export default Controller.extend({
|
|||
|
||||
// TODO: This should not happen in model
|
||||
const imageSizes = {};
|
||||
$("#reply-control .d-editor-preview img").each((i, e) => {
|
||||
const $img = $(e);
|
||||
const src = $img.prop("src");
|
||||
document
|
||||
.querySelectorAll("#reply-control .d-editor-preview img")
|
||||
.forEach((e) => {
|
||||
const src = e.src;
|
||||
|
||||
if (src && src.length) {
|
||||
imageSizes[src] = { width: $img.width(), height: $img.height() };
|
||||
imageSizes[src] = { width: e.naturalWidth, height: e.naturalHeight };
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue