Fix book editing issues (#14177)

* Fix issue moving a duplicated section to another book
This commit is contained in:
Barbara Valdez
2021-02-05 18:50:29 -08:00
committed by GitHub
parent 67829af0c5
commit 467a34e878
2 changed files with 28 additions and 21 deletions

View File

@@ -213,9 +213,9 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
const sourceBook = this.books.find(book => book.bookPath === movingElement.book.root);
const targetBook = this.books.find(book => book.bookPath === updateBook.book.root);
this.bookTocManager = new BookTocManager(targetBook, sourceBook);
// remove watch on toc file from both books.
// remove watch on toc file from source book.
if (sourceBook) {
fs.unwatchFile(movingElement.tableOfContentsPath);
fs.unwatchFile(sourceBook.tableOfContentsPath);
}
try {
await this.bookTocManager.updateBook(movingElement, updateBook, targetSection);
@@ -232,7 +232,6 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
if (sourceBook) {
this.setFileWatcher(sourceBook);
}
this.setFileWatcher(targetBook);
}
}
}