mirror of
https://github.com/zadam/trilium.git
synced 2026-01-08 23:54:29 +01:00
implement the second part of the sharejs
This commit is contained in:
parent
afcd23cb99
commit
8368969932
@ -295,6 +295,14 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
|
||||
return url ? `href="${url}"` : match;
|
||||
});
|
||||
|
||||
if (format === "share") {
|
||||
content = content.replace(/src="[^"]*api\/notes\/([a-zA-Z0-9_]+)\/download"/g, (match, targetNoteId) => {
|
||||
const url = getNoteTargetUrl(targetNoteId, noteMeta);
|
||||
|
||||
return url ? `src="${url}"` : match;
|
||||
});
|
||||
}
|
||||
|
||||
return content;
|
||||
|
||||
function findAttachment(targetAttachmentId: string) {
|
||||
|
||||
@ -73,6 +73,14 @@ export function renderNoteForExport(note: BNote, parentBranch: BBranch, basePath
|
||||
note: parentBranch.getNote()
|
||||
};
|
||||
|
||||
// Determine JS to load.
|
||||
const jsToLoad: string[] = [
|
||||
`${basePath}assets/scripts.js`
|
||||
];
|
||||
for (const jsRelation of note.getRelations("shareJs")) {
|
||||
jsToLoad.push(`api/notes/${jsRelation.value}/download`);
|
||||
}
|
||||
|
||||
return renderNoteContentInternal(note, {
|
||||
subRoot,
|
||||
rootNoteId: parentBranch.noteId,
|
||||
@ -80,9 +88,7 @@ export function renderNoteForExport(note: BNote, parentBranch: BBranch, basePath
|
||||
`${basePath}assets/styles.css`,
|
||||
`${basePath}assets/scripts.css`,
|
||||
],
|
||||
jsToLoad: [
|
||||
`${basePath}assets/scripts.js`
|
||||
],
|
||||
jsToLoad,
|
||||
logoUrl: `${basePath}icon-color.svg`,
|
||||
faviconUrl: `${basePath}favicon.ico`,
|
||||
ancestors,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user