mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 14:51:05 +08:00
fix(export/share): header link not working
This commit is contained in:
parent
87c055913f
commit
c54befa8a1
1 changed files with 5 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
|||
private assetsMeta: NoteMeta[] = [];
|
||||
private indexMeta: NoteMeta | null = null;
|
||||
private searchIndex: Map<string, SearchIndexEntry> = new Map();
|
||||
private rootMeta: NoteMeta | null = null;
|
||||
|
||||
prepareMeta(metaFile: NoteMetaFile): void {
|
||||
const assets = [
|
||||
|
|
@ -50,6 +51,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
|||
noImport: true,
|
||||
dataFileName: "index.html"
|
||||
};
|
||||
this.rootMeta = metaFile.files[0];
|
||||
|
||||
metaFile.files.push(this.indexMeta);
|
||||
}
|
||||
|
|
@ -71,6 +73,9 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
|||
if (typeof content === "string") {
|
||||
content = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, (match, id) => {
|
||||
if (match.includes("/assets/")) return match;
|
||||
if (id === this.rootMeta?.noteId) {
|
||||
return `href="${basePath}"`;
|
||||
}
|
||||
return `href="#root/${id}"`;
|
||||
});
|
||||
content = this.rewriteFn(content, noteMeta);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue