Load documentation from fragment links
This commit is contained in:
@ -222,13 +222,16 @@ export const updateDocumentationContent = (app: Editor, bindings: any) => {
|
||||
auto_detection: false
|
||||
}), ...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(
|
||||
app.docs[app.currentDocumentationPane],
|
||||
);
|
||||
callback(converted_markdown)
|
||||
callback(converted_markdown)
|
||||
}
|
||||
_update_and_assign((e: string)=> {
|
||||
let display_content = e === undefined ? loading_message : e;
|
||||
|
||||
@ -537,18 +537,16 @@ export const installInterfaceLogic = (app: Editor) => {
|
||||
let element = document.getElementById(name);
|
||||
if (element) {
|
||||
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") {
|
||||
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);
|
||||
} else {
|
||||
console.log("Loading samples!");
|
||||
await loadSamples().then(() => {
|
||||
app.docs = documentation_factory(app);
|
||||
app.currentDocumentationPane = e;
|
||||
updateDocumentationContent(app, app.bindings);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user