Skip to content

Commit

Permalink
FIX: place image scale buttons unconditionally
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SamSaffron committed Oct 29, 2019
1 parent 6d381b3 commit 001c593
Showing 1 changed file with 1 addition and 13 deletions.
Expand Up @@ -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") &&
Expand Down Expand Up @@ -928,8 +920,6 @@ export default Component.extend({
},

showPreview() {
const $preview = $(this.element.querySelector(".d-editor-preview-wrapper"));
this._placeImageScaleButtons($preview);
this.send("togglePreview");
},

Expand Down Expand Up @@ -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);
Expand Down

1 comment on commit 001c593

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/make-it-more-obvious-an-image-is-resizable-when-uploading-an-image/132030/8

Please sign in to comment.