FIX: place image scale buttons unconditionally

Defer placing scale buttons causes "scale image" buttons to be missing if
you manage to scroll mouse to the area where the image is prior to image
rendering.

This fix ensures scale buttons are always rendered leaving all the hiding
and styling entirely to CSS.

This also corrects a bug where scaling toolbar was missing on mobile
This commit is contained in:
Sam Saffron 2019-10-29 15:49:55 +11:00
parent 6d381b33a4
commit 001c593155

View File

@ -202,14 +202,6 @@ export default Component.extend({
);
}
if (!this.site.mobileView) {
$preview
.off("touchstart mouseenter", "img")
.on("touchstart mouseenter", "img", () => {
this._placeImageScaleButtons($preview);
});
}
// Focus on the body unless we have a title
if (
!this.get("composer.canEditTitle") &&
@ -928,8 +920,6 @@ export default Component.extend({
},
showPreview() {
const $preview = $(this.element.querySelector(".d-editor-preview-wrapper"));
this._placeImageScaleButtons($preview);
this.send("togglePreview");
},
@ -1078,9 +1068,7 @@ export default Component.extend({
);
}
if (this.site.mobileView && $preview.is(":visible")) {
this._placeImageScaleButtons($preview);
}
this._placeImageScaleButtons($preview);
this.trigger("previewRefreshed", $preview);
this.afterRefresh($preview);