Skip to content

Commit 595a347

Browse files
duau-odooGoaman
authored andcommitted
align preview image with the real one when cropping
1 parent c9f1567 commit 595a347

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

addons/html_editor/static/src/main/media/image_crop.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,9 @@ export class ImageCrop extends Component {
158158
offset = { top: 0, left: 0 };
159159
} else {
160160
const rect = this.media.getBoundingClientRect();
161-
const win = this.media.ownerDocument.defaultView;
162161
offset = {
163-
top: rect.top + win.pageYOffset,
164-
left: rect.left + win.pageXOffset,
162+
top: rect.top,
163+
left: rect.left,
165164
};
166165
}
167166

addons/html_editor/static/src/main/media/image_crop_plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class ImageCropPlugin extends Plugin {
3030
return selectedNodes.find((node) => node.tagName === "IMG");
3131
}
3232

33-
async openCropImage(selectedImg, imageCropProps) {
33+
async openCropImage(selectedImg, imageCropProps = {}) {
3434
selectedImg = selectedImg || this.getSelectedImage();
3535
if (!selectedImg) {
3636
return;

0 commit comments

Comments
 (0)