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";
|
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 {
|
export default {
|
||||||
name: "setup-knowledge-explorer",
|
name: "setup-knowledge-explorer",
|
||||||
|
|
||||||
initialize() {
|
initialize(container) {
|
||||||
withPluginApi("0.8", api => {
|
const siteSettings = container.lookup("site-settings:main");
|
||||||
api.decorateWidget("hamburger-menu:generalLinks", () => {
|
if (!siteSettings.knowledge_explorer_enabled) {
|
||||||
const siteSettings = api.container.lookup("site-settings:main");
|
return;
|
||||||
if (siteSettings.knowledge_explorer_enabled) {
|
}
|
||||||
return {
|
withPluginApi("0.8", api => initialize(api, container));
|
||||||
route: "knowledgeExplorer",
|
|
||||||
label: "knowledge_explorer.title",
|
|
||||||
className: "knowledge-explorer-link"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
api.addKeyboardShortcut("g e", "", { path: "/docs" });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue