1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6

20 Zeilen
552 B
Text

2021-02-24 08:43:35 +01:00
import { withPluginApi } from "discourse/lib/plugin-api";
import DiscourseURL from "discourse/lib/url";
2017-11-22 10:34:21 +01:00
export default {
2021-02-24 08:43:35 +01:00
name: "custom-wizard-edits",
initialize(container) {
2021-02-24 08:43:35 +01:00
const siteSettings = container.lookup("site-settings:main");
if (!siteSettings.custom_wizard_enabled) return;
const existing = DiscourseURL.routeTo;
2021-02-24 08:43:35 +01:00
DiscourseURL.routeTo = function (path, opts) {
if (path && path.indexOf("/w/") > -1) {
return (window.location = path);
}
return existing.apply(this, [path, opts]);
};
2021-02-24 08:43:35 +01:00
},
2017-11-22 10:34:21 +01:00
};