translator: also translate table of contents (#1273)

This commit is contained in:
Huang Xin
2025-05-29 16:08:01 +08:00
committed by GitHub
parent b37a804192
commit 5820191c26
5 changed files with 27 additions and 13 deletions
+6
View File
@@ -60,6 +60,12 @@ export const updateToc = (bookDoc: BookDoc, items: TOCItem[], sections: SectionI
return map;
}, {});
updateTocData(bookDoc, items, sectionsMap);
items.sort((a, b) => {
if (a.location && b.location) {
return a.location.current - b.location.current;
}
return 0;
});
};
const updateTocData = (