feat: render OneNote notebook hierarchy
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user