feat: render OneNote notebook hierarchy

This commit is contained in:
2026-07-22 19:05:49 +02:00
parent d282b832ac
commit 670310ea9e
14 changed files with 887 additions and 103 deletions

View File

@@ -103,7 +103,7 @@ export function parseOneNoteTableOfContents(
return {
sourceName: options.sourceName ?? 'Open Notebook.onetoc2',
fileIdentity: store.fileIdentity,
color: optionalU32(root, TOC_PROPERTY.color),
color: optionalColor(root),
enableHistory: optionalBool(root, TOC_PROPERTY.enableHistory),
entries,
diagnostics,
@@ -151,7 +151,7 @@ function parseChildren(
filename: decodeFolderChildFilename(filename),
fileIdentity: requiredGuid(child, TOC_PROPERTY.fileIdentity),
orderingId: requiredU32(child, TOC_PROPERTY.orderingId),
color: optionalU32(child, TOC_PROPERTY.color),
color: optionalColor(child),
});
} else {
result.push(...parseChildren(context, child, depth + 1));
@@ -293,6 +293,11 @@ function optionalU32(
return value.value;
}
function optionalColor(object: StoreObject): number | undefined {
const color = optionalU32(object, TOC_PROPERTY.color);
return color === 0xffff_ffff ? undefined : color;
}
function optionalBool(
object: StoreObject,
propertyId: number