FIX: Initializer needed to account for disabled plugin
This commit is contained in:
parent
3ec3a82dbf
commit
35d234a85a
|
@ -1,22 +1,25 @@
|
|||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
|
||||
function initialize(api) {
|
||||
api.decorateWidget("hamburger-menu:generalLinks", () => {
|
||||
return {
|
||||
route: "knowledgeExplorer",
|
||||
label: "knowledge_explorer.title",
|
||||
className: "knowledge-explorer-link"
|
||||
};
|
||||
});
|
||||
|
||||
api.addKeyboardShortcut("g e", "", { path: "/docs" });
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "setup-knowledge-explorer",
|
||||
|
||||
initialize() {
|
||||
withPluginApi("0.8", api => {
|
||||
api.decorateWidget("hamburger-menu:generalLinks", () => {
|
||||
const siteSettings = api.container.lookup("site-settings:main");
|
||||
if (siteSettings.knowledge_explorer_enabled) {
|
||||
return {
|
||||
route: "knowledgeExplorer",
|
||||
label: "knowledge_explorer.title",
|
||||
className: "knowledge-explorer-link"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
api.addKeyboardShortcut("g e", "", { path: "/docs" });
|
||||
});
|
||||
initialize(container) {
|
||||
const siteSettings = container.lookup("site-settings:main");
|
||||
if (!siteSettings.knowledge_explorer_enabled) {
|
||||
return;
|
||||
}
|
||||
withPluginApi("0.8", api => initialize(api, container));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue