1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6
Angus McLeod d128565979 various
2020-04-14 15:46:06 +10:00

19 Zeilen
552 B
JavaScript

import { withPluginApi } from 'discourse/lib/plugin-api';
import DiscourseURL from 'discourse/lib/url';
export default {
name: 'custom-wizard-edits',
initialize(container) {
const siteSettings = container.lookup('site-settings:main');
if (!siteSettings.custom_wizard_enabled) return;
const existing = DiscourseURL.routeTo;
DiscourseURL.routeTo = function(path, opts) {
if (path && path.indexOf('/w/') > -1) {
return window.location = path;
}
return existing.apply(this, [path, opts]);
};
}
};