Fix not numbered inconsistency (#14269)

* fix not numbered field

* fix for adding extra field and removing it from sections

* use const for variable

* use spread operator to create new object

* address pr comments

* change function name and simplify

* Add comment and put the initializeContents in the finally block
This commit is contained in:
Barbara Valdez
2021-02-12 19:17:22 -08:00
committed by GitHub
parent 238a0c60d9
commit 0f748a60b3
3 changed files with 21 additions and 5 deletions

View File

@@ -343,7 +343,9 @@ export class BookTocManager implements IBookTocManager {
if (this._sourceBook) {
const sectionTOC = this._sourceBook.bookItems[0].findChildSection(notebook.uri);
this.newSection = sectionTOC;
if (sectionTOC) {
this.newSection = sectionTOC;
}
}
fileName = fileName === undefined ? notebookPath.name : path.parse(fileName).name;
this.newSection.file = path.sep.concat(fileName).replace(/\\/g, '/');