mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
fix(share): loading of tree and table of contents
This commit is contained in:
parent
9469433143
commit
fa5cd150d9
@ -18,6 +18,8 @@ import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/u
|
|||||||
import options from "../services/options.js";
|
import options from "../services/options.js";
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import shareThemeRoot from "@triliumnext/share-theme/templates/page.ejs";
|
import shareThemeRoot from "@triliumnext/share-theme/templates/page.ejs";
|
||||||
|
import shareThemeTreeItem from "@triliumnext/share-theme/templates/tree_item.ejs";
|
||||||
|
import shareThemeTocItem from "@triliumnext/share-theme/templates/toc_item.ejs";
|
||||||
import shareThemeCss from "@triliumnext/share-theme/styles.css";
|
import shareThemeCss from "@triliumnext/share-theme/styles.css";
|
||||||
import ejs from "ejs";
|
import ejs from "ejs";
|
||||||
|
|
||||||
@ -212,14 +214,19 @@ function register(router: Router) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (useDefaultView) {
|
if (useDefaultView) {
|
||||||
console.log("Got share theme path", shareThemeRoot);
|
|
||||||
const ejsResult = ejs.render(shareThemeRoot, {
|
const ejsResult = ejs.render(shareThemeRoot, {
|
||||||
shareThemeCss,
|
shareThemeCss,
|
||||||
...opts
|
...opts
|
||||||
}, {
|
}, {
|
||||||
includer(originalPath, parsedPath: string) {
|
includer(originalPath, parsedPath: string) {
|
||||||
console.log("Path ", originalPath, parsedPath);
|
switch (originalPath) {
|
||||||
throw new Error("Hi");
|
case "tree_item":
|
||||||
|
return { template: shareThemeTreeItem };
|
||||||
|
case "toc_item":
|
||||||
|
return { template: shareThemeTocItem };
|
||||||
|
default:
|
||||||
|
throw new Error(`Unable to find template for ${originalPath}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
res.send(ejsResult);
|
res.send(ejsResult);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user