mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Update tree drag and drop sample
This commit is contained in:
@ -91,10 +91,8 @@ export class TestViewDragAndDrop implements vscode.TreeDataProvider<Node>, vscod
|
||||
}
|
||||
}
|
||||
|
||||
public async handleDrag(source: Node[]): Promise<vscode.TreeDataTransfer> {
|
||||
const dataTransfer = new vscode.TreeDataTransfer<TestViewObjectTransferItem>();
|
||||
dataTransfer.set('text/treeitems', new TestViewObjectTransferItem(source));
|
||||
return dataTransfer;
|
||||
public async handleDrag(source: Node[], treeDataTransfer: vscode.TreeDataTransfer): Promise<void> {
|
||||
treeDataTransfer.set('text/treeitems', new TestViewObjectTransferItem(source));
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
@ -102,11 +102,10 @@ declare module 'vscode' {
|
||||
* When the items are dropped on **another tree item** in **the same tree**, your `TreeDataTransferItem` objects
|
||||
* will be preserved. See the documentation for `TreeDataTransferItem` for how best to take advantage of this.
|
||||
*
|
||||
* The returned `TreeDataTransfer` will be merged with the original`TreeDataTransfer` for the operation.
|
||||
*
|
||||
* @param source The source items for the drag and drop operation.
|
||||
* @param treeDataTransfer The data transfer associated with this drag.
|
||||
*/
|
||||
handleDrag?(source: T[]): Thenable<TreeDataTransfer>;
|
||||
handleDrag?(source: T[], treeDataTransfer: TreeDataTransfer): Thenable<void> | void;
|
||||
|
||||
/**
|
||||
* Called when a drag and drop action results in a drop on the tree that this `DragAndDropController` belongs too.
|
||||
|
||||
Reference in New Issue
Block a user