[Editing Books] - Refactor buildToc method (#14532)

* refactor buildToc method to only modify the section found and return a boolean

* fix tests

* Address pr comments
This commit is contained in:
Barbara Valdez
2021-03-05 11:41:31 -08:00
committed by GitHub
parent b82942a030
commit a17a4a585e
3 changed files with 71 additions and 91 deletions

View File

@@ -49,6 +49,7 @@ export function closeBookError(resource: string, error: string): string { return
export function duplicateFileError(title: string, path: string, newPath: string): string { return localize('duplicateFileError', "File {0} already exists in the destination folder {1} \n The file has been renamed to {2} to prevent data loss.", title, path, newPath); }
export function editBookError(path: string, error: string): string { return localize('editBookError', "Error while editing book {0}: {1}", path, error); }
export function selectBookError(error: string): string { return localize('selectBookError', "Error while selecting a book or a section to edit: {0}", error); }
export function sectionNotFound(section: string, tocPath: string): string { return localize('sectionNotFound', "Failed to find section {0} in {1}.", section, tocPath); }
// Remote Book dialog constants
export const url = localize('url', "URL");
@@ -97,3 +98,4 @@ export const msgSaveFolderError = localize('msgSaveFolderError', "Save location
export function msgCreateBookWarningMsg(file: string): string { return localize('msgCreateBookWarningMsg', "Error while trying to access: {0}", file); }