mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Create directory when adding a book section from book tree view (#18966)
* create folder when creating a book section * fix test
This commit is contained in:
@@ -460,7 +460,6 @@ export class BookTocManager implements IBookTocManager {
|
||||
|
||||
public async addNewTocEntry(pathDetails: TocEntryPathHandler, bookItem: BookTreeItem, isSection?: boolean): Promise<void> {
|
||||
let findSection: JupyterBookSection | undefined = undefined;
|
||||
await fs.writeFile(pathDetails.filePath, '');
|
||||
if (bookItem.contextValue === BookTreeItemType.section) {
|
||||
findSection = { file: bookItem.book.page.file, title: bookItem.book.page.title };
|
||||
}
|
||||
@@ -470,8 +469,10 @@ export class BookTocManager implements IBookTocManager {
|
||||
};
|
||||
|
||||
if (isSection) {
|
||||
await fs.mkdir(path.dirname(pathDetails.filePath));
|
||||
fileEntryInToc.sections = [];
|
||||
}
|
||||
await fs.writeFile(pathDetails.filePath, '');
|
||||
|
||||
if (bookItem.book.version === BookVersion.v1) {
|
||||
fileEntryInToc = convertTo(BookVersion.v1, fileEntryInToc);
|
||||
|
||||
Reference in New Issue
Block a user