mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 07:01:31 +08:00 
			
		
		
		
	feat(in-app-help): use preprocessed subtree data
This commit is contained in:
		
							parent
							
								
									fe7650f6ce
								
							
						
					
					
						commit
						d05bc03074
					
				@ -13,6 +13,9 @@
 | 
			
		||||
*   Markdown export:
 | 
			
		||||
    *   Reduce extra whitespace between list items.
 | 
			
		||||
    *   Preserve include note.
 | 
			
		||||
*   In-app help:
 | 
			
		||||
    *   Document structure is now precalculated, so start-up time should be slightly increased.
 | 
			
		||||
    *   Optimized the content in order to reduce the size on disk.
 | 
			
		||||
 | 
			
		||||
## 🌍 Internationalization
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,7 @@ import cls from "./src/services/cls.js";
 | 
			
		||||
import type { AdvancedExportOptions } from "./src/services/export/zip.js";
 | 
			
		||||
import TaskContext from "./src/services/task_context.js";
 | 
			
		||||
import { deferred } from "./src/services/utils.js";
 | 
			
		||||
import { parseNoteMetaFile } from "./src/services/in_app_help.js";
 | 
			
		||||
 | 
			
		||||
const NOTE_ID_USER_GUIDE = "pOsGYCXsbNQG";
 | 
			
		||||
const NOTE_ID_RELEASE_NOTES = "hD3V4hiu2VW4";
 | 
			
		||||
@ -172,8 +173,13 @@ async function cleanUpMeta(outputPath: string, minify: boolean) {
 | 
			
		||||
        el.isExpanded = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const json = minify ? JSON.stringify(meta) : JSON.stringify(meta, null, 4);
 | 
			
		||||
    await fs.writeFile(metaPath, json);
 | 
			
		||||
    if (minify) {
 | 
			
		||||
        const subtree = parseNoteMetaFile(meta);
 | 
			
		||||
        await fs.writeFile(metaPath, JSON.stringify(subtree));
 | 
			
		||||
    } else {
 | 
			
		||||
        await fs.writeFile(metaPath, JSON.stringify(meta, null, 4));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function registerHandlers() {
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -15,15 +15,14 @@ export function getHelpHiddenSubtreeData() {
 | 
			
		||||
    const metaFilePath = path.join(helpDir, "!!!meta.json");
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
        const metaFileContent = JSON.parse(fs.readFileSync(metaFilePath).toString("utf-8"));
 | 
			
		||||
        return parseNoteMetaFile(metaFileContent as NoteMetaFile);
 | 
			
		||||
        return JSON.parse(fs.readFileSync(metaFilePath).toString("utf-8"));
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
        console.warn(e);
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function parseNoteMetaFile(noteMetaFile: NoteMetaFile): HiddenSubtreeItem[] {
 | 
			
		||||
export function parseNoteMetaFile(noteMetaFile: NoteMetaFile): HiddenSubtreeItem[] {
 | 
			
		||||
    if (!noteMetaFile.files) {
 | 
			
		||||
        console.log("No meta files");
 | 
			
		||||
        return [];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user