Load documentation from fragment links
This commit is contained in:
@ -222,13 +222,16 @@ export const updateDocumentationContent = (app: Editor, bindings: any) => {
|
|||||||
auto_detection: false
|
auto_detection: false
|
||||||
}), ...bindings],
|
}), ...bindings],
|
||||||
});
|
});
|
||||||
console.log(app.currentDocumentationPane);
|
|
||||||
|
if(Object.keys(app.docs).length === 0) {
|
||||||
|
app.docs = documentation_factory(app);
|
||||||
|
}
|
||||||
|
|
||||||
function _update_and_assign(callback: Function) {
|
function _update_and_assign(callback: Function) {
|
||||||
const converted_markdown = converter.makeHtml(
|
const converted_markdown = converter.makeHtml(
|
||||||
app.docs[app.currentDocumentationPane],
|
app.docs[app.currentDocumentationPane],
|
||||||
);
|
);
|
||||||
callback(converted_markdown)
|
callback(converted_markdown)
|
||||||
}
|
}
|
||||||
_update_and_assign((e: string)=> {
|
_update_and_assign((e: string)=> {
|
||||||
let display_content = e === undefined ? loading_message : e;
|
let display_content = e === undefined ? loading_message : e;
|
||||||
|
|||||||
@ -537,18 +537,16 @@ export const installInterfaceLogic = (app: Editor) => {
|
|||||||
let element = document.getElementById(name);
|
let element = document.getElementById(name);
|
||||||
if (element) {
|
if (element) {
|
||||||
element.addEventListener("click", async () => {
|
element.addEventListener("click", async () => {
|
||||||
|
// Clear query params & set id as hash paremeter for uri
|
||||||
|
window.history.replaceState({}, "", window.location.pathname);
|
||||||
|
window.location.hash = e;
|
||||||
|
app.docs = documentation_factory(app);
|
||||||
|
app.currentDocumentationPane = e;
|
||||||
if (name !== "docs_sample_list") {
|
if (name !== "docs_sample_list") {
|
||||||
app.currentDocumentationPane = e;
|
|
||||||
// Clear query params
|
|
||||||
window.history.replaceState({}, "", window.location.pathname);
|
|
||||||
// Set id as hash paremeter for uri
|
|
||||||
window.location.hash = e;
|
|
||||||
updateDocumentationContent(app, app.bindings);
|
updateDocumentationContent(app, app.bindings);
|
||||||
} else {
|
} else {
|
||||||
console.log("Loading samples!");
|
console.log("Loading samples!");
|
||||||
await loadSamples().then(() => {
|
await loadSamples().then(() => {
|
||||||
app.docs = documentation_factory(app);
|
|
||||||
app.currentDocumentationPane = e;
|
|
||||||
updateDocumentationContent(app, app.bindings);
|
updateDocumentationContent(app, app.bindings);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user