mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: allows to select the action when agreeing with penalty (#9099)
Note this commit also fixes an issue where the edit post actions was trying to focus the edit textarea, but was using jquery functions on a DOM node. scrollTo is not available on IE11 but that shouldn't cause much trouble.
This commit is contained in:
parent
93b8b04b06
commit
33f77e51b8
@ -1,7 +1,7 @@
|
|||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { equal } from "@ember/object/computed";
|
import { equal } from "@ember/object/computed";
|
||||||
import { scheduleOnce } from "@ember/runloop";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { afterRender } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
const ACTIONS = ["delete", "delete_replies", "edit", "none"];
|
const ACTIONS = ["delete", "delete_replies", "edit", "none"];
|
||||||
|
|
||||||
@ -20,16 +20,21 @@ export default Component.extend({
|
|||||||
editing: equal("postAction", "edit"),
|
editing: equal("postAction", "edit"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
penaltyChanged() {
|
penaltyChanged(postAction) {
|
||||||
|
this.set("postAction", postAction);
|
||||||
|
|
||||||
// If we switch to edit mode, jump to the edit textarea
|
// If we switch to edit mode, jump to the edit textarea
|
||||||
if (this.postAction === "edit") {
|
if (postAction === "edit") {
|
||||||
scheduleOnce("afterRender", () => {
|
this._focusEditTextarea();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
@afterRender
|
||||||
|
_focusEditTextarea() {
|
||||||
const elem = this.element;
|
const elem = this.element;
|
||||||
const body = elem.closest(".modal-body");
|
const body = elem.closest(".modal-body");
|
||||||
body.scrollTop(body.height());
|
body.scrollTo(0, body.clientHeight);
|
||||||
elem.querySelector(".post-editor").focus();
|
elem.querySelector(".post-editor").focus();
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user