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 { t } from "i18next";
|
||||
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 ejs from "ejs";
|
||||
|
||||
@ -212,14 +214,19 @@ function register(router: Router) {
|
||||
}
|
||||
|
||||
if (useDefaultView) {
|
||||
console.log("Got share theme path", shareThemeRoot);
|
||||
const ejsResult = ejs.render(shareThemeRoot, {
|
||||
shareThemeCss,
|
||||
...opts
|
||||
}, {
|
||||
includer(originalPath, parsedPath: string) {
|
||||
console.log("Path ", originalPath, parsedPath);
|
||||
throw new Error("Hi");
|
||||
switch (originalPath) {
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user