mirror of
https://github.com/zadam/trilium.git
synced 2026-01-01 04:04:25 +01:00
render js notes as-is
This commit is contained in:
parent
7e45aaa1da
commit
94d1181fe8
@ -70,6 +70,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
||||
}) : "";
|
||||
|
||||
content = renderNoteForExport(note, branch, basePath, noteMeta.notePath.slice(0, -1));
|
||||
// TODO: This will probably never match, but should it be exclude from running on code/jsFrontend notes?
|
||||
if (typeof content === "string") {
|
||||
content = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, (match, id) => {
|
||||
if (match.includes("/assets/")) return match;
|
||||
|
||||
@ -149,6 +149,15 @@ interface RenderArgs {
|
||||
}
|
||||
|
||||
function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) {
|
||||
if (renderArgs.isStatic && note.type == "code" && note.mime === "application/javascript;env=frontend") {
|
||||
if (note.isProtected) {
|
||||
// TODO: how to handle this case here?
|
||||
throw new Error(`note ${note.noteId} is protected and cannot be exported`);
|
||||
}
|
||||
|
||||
return note.getContent();
|
||||
}
|
||||
|
||||
const { header, content, isEmpty } = getContent(note);
|
||||
const showLoginInShareTheme = options.getOption("showLoginInShareTheme");
|
||||
const opts = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user