mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
only modify toc and move files if the target is a section or book (#17054)
This commit is contained in:
@@ -737,17 +737,19 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onDrop(sources: vscode.TreeDataTransfer, target: BookTreeItem): Promise<void> {
|
async onDrop(sources: vscode.TreeDataTransfer, target: BookTreeItem): Promise<void> {
|
||||||
TelemetryReporter.sendActionEvent(BookTelemetryView, NbTelemetryActions.DragAndDrop);
|
if (target.contextValue === BookTreeItemType.savedBook || target.contextValue === BookTreeItemType.section) {
|
||||||
// gets the tree items that are dragged and dropped
|
TelemetryReporter.sendActionEvent(BookTelemetryView, NbTelemetryActions.DragAndDrop);
|
||||||
let treeItems = JSON.parse(await sources.items.get(this.supportedTypes[0])!.asString()) as BookTreeItem[];
|
// gets the tree items that are dragged and dropped
|
||||||
let rootItems = this.getLocalRoots(treeItems);
|
let treeItems = JSON.parse(await sources.items.get(this.supportedTypes[0])!.asString()) as BookTreeItem[];
|
||||||
rootItems = rootItems.filter(item => item.resourceUri !== target.resourceUri);
|
let rootItems = this.getLocalRoots(treeItems);
|
||||||
if (rootItems && target) {
|
rootItems = rootItems.filter(item => item.resourceUri !== target.resourceUri);
|
||||||
let sourcesByBook = this.groupTreeItemsByBookModel(rootItems);
|
if (rootItems && target) {
|
||||||
const targetBook = this.books.find(book => book.bookPath === target.book.root);
|
let sourcesByBook = this.groupTreeItemsByBookModel(rootItems);
|
||||||
for (let [book, items] of sourcesByBook) {
|
const targetBook = this.books.find(book => book.bookPath === target.book.root);
|
||||||
this.bookTocManager = new BookTocManager(book, targetBook);
|
for (let [book, items] of sourcesByBook) {
|
||||||
await this.bookTocManager.updateBook(items, target);
|
this.bookTocManager = new BookTocManager(book, targetBook);
|
||||||
|
await this.bookTocManager.updateBook(items, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user