mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Remove Discourse constants from cleanDOM
This commit is contained in:
@@ -15,7 +15,9 @@ export default {
|
|||||||
const router = container.lookup("router:main");
|
const router = container.lookup("router:main");
|
||||||
|
|
||||||
router.on("routeWillChange", viewTrackingRequired);
|
router.on("routeWillChange", viewTrackingRequired);
|
||||||
router.on("routeDidChange", cleanDOM);
|
router.on("routeDidChange", () => {
|
||||||
|
cleanDOM(container);
|
||||||
|
});
|
||||||
|
|
||||||
let appEvents = container.lookup("service:app-events");
|
let appEvents = container.lookup("service:app-events");
|
||||||
let documentTitle = container.lookup("service:document-title");
|
let documentTitle = container.lookup("service:document-title");
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { scheduleOnce } from "@ember/runloop";
|
import { scheduleOnce } from "@ember/runloop";
|
||||||
|
|
||||||
function _clean() {
|
function _clean() {
|
||||||
if (window.MiniProfiler) {
|
if (window.MiniProfiler) {
|
||||||
window.MiniProfiler.pageTransition();
|
window.MiniProfiler.pageTransition();
|
||||||
@@ -23,18 +24,16 @@ function _clean() {
|
|||||||
.not(".no-blur")
|
.not(".no-blur")
|
||||||
.blur();
|
.blur();
|
||||||
|
|
||||||
Discourse.set("contextCount", 0);
|
this.lookup("route:application").send("closeModal");
|
||||||
Discourse.__container__.lookup("route:application").send("closeModal");
|
|
||||||
const hideDropDownFunction = $("html").data("hide-dropdown");
|
const hideDropDownFunction = $("html").data("hide-dropdown");
|
||||||
if (hideDropDownFunction) {
|
if (hideDropDownFunction) {
|
||||||
hideDropDownFunction();
|
hideDropDownFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Avoid container lookup here
|
this.lookup("service:app-events").trigger("dom:clean");
|
||||||
const appEvents = Discourse.__container__.lookup("service:app-events");
|
this.lookup("service:document-title").updateContextCount(0);
|
||||||
appEvents.trigger("dom:clean");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cleanDOM() {
|
export function cleanDOM(container) {
|
||||||
scheduleOnce("afterRender", _clean);
|
scheduleOnce("afterRender", container, _clean);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user