fix search action (#14937)

* fix search action

* remove book version from book tree item
This commit is contained in:
Barbara Valdez
2021-04-01 11:16:32 -07:00
committed by GitHub
parent 37af88e265
commit a00ffa0469
4 changed files with 7 additions and 9 deletions

View File

@@ -316,7 +316,7 @@ export class BookTocManager implements IBookTocManager {
* @param section The section that's been moved.
* @param book The target book.
*/
async moveSectionFiles(section: BookTreeItem, book: BookTreeItem): Promise<void> {
async moveSectionFiles(section: BookTreeItem, bookItem: BookTreeItem): Promise<void> {
const uri = path.posix.join(path.posix.sep, path.relative(section.rootContentPath, section.book.contentPath));
let moveFile = path.join(path.parse(uri).dir, path.parse(uri).name);
let fileName = undefined;
@@ -349,9 +349,9 @@ export class BookTocManager implements IBookTocManager {
this.cleanUp(path.dirname(section.book.contentPath));
}
if (book.version === BookVersion.v1) {
if (bookItem.book.version === BookVersion.v1) {
// here we only convert if is v1 because we are already using the v2 notation for every book that we read.
this.newSection = convertTo(book.version, this.newSection);
this.newSection = convertTo(bookItem.book.version, this.newSection);
}
}
@@ -385,9 +385,9 @@ export class BookTocManager implements IBookTocManager {
fileName = fileName === undefined ? filePath.name : path.parse(fileName).name;
this.newSection.file = path.posix.join(path.posix.sep, fileName);
this.newSection.title = file.book.title;
if (book.version === BookVersion.v1) {
if (book.book.version === BookVersion.v1) {
// here we only convert if is v1 because we are already using the v2 notation for every book that we read.
this.newSection = convertTo(book.version, this.newSection);
this.newSection = convertTo(book.book.version, this.newSection);
}
}