mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:47:22 +08:00
FIX: gives composer options to post:highlight trigger (#15384)
This change allows to prevent page jump, when jump is prevented, due to highlightPost causing a `focus()`.
This commit is contained in:
parent
80591724cf
commit
96982ca2bc
|
@ -1,3 +1,4 @@
|
|||
import { isBlank } from "@ember/utils";
|
||||
import { later, schedule, scheduleOnce, throttle } from "@ember/runloop";
|
||||
import AddArchetypeClass from "discourse/mixins/add-archetype-class";
|
||||
import ClickTrack from "discourse/lib/click-track";
|
||||
|
@ -48,8 +49,10 @@ export default Component.extend(
|
|||
}
|
||||
},
|
||||
|
||||
_highlightPost(postNumber) {
|
||||
scheduleOnce("afterRender", null, highlightPost, postNumber);
|
||||
_highlightPost(postNumber, options = {}) {
|
||||
if (isBlank(options.jump) || options.jump !== false) {
|
||||
scheduleOnce("afterRender", null, highlightPost, postNumber);
|
||||
}
|
||||
},
|
||||
|
||||
_hideTopicInHeader() {
|
||||
|
|
|
@ -894,7 +894,11 @@ export default Controller.extend({
|
|||
|
||||
if (result.responseJson.action === "create_post") {
|
||||
this.appEvents.trigger("composer:created-post");
|
||||
this.appEvents.trigger("post:highlight", result.payload.post_number);
|
||||
this.appEvents.trigger(
|
||||
"post:highlight",
|
||||
result.payload.post_number,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
if (this.get("model.draftKey") === Composer.NEW_TOPIC_KEY) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user