File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
packages/svelte-file-tree/src/lib/components Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 9494 }
9595 }
9696 },
97+ shouldClearClipboard = (operation ) => operation === " cut" ,
9798 onResolveNameConflict = () => " cancel" ,
9899 onCircularReference = noop,
99100 canCopy = truePredicate,
429430 }
430431
431432 export async function paste (destination ?: TreeItemState < TFile , TFolder > ) {
432- let didPaste = false ;
433+ if (pasteOperation === undefined ) {
434+ return false ;
435+ }
436+
437+ let didPaste;
433438 switch (pasteOperation) {
434439 case " copy" : {
435440 didPaste = await copy (destination);
445450 return false ;
446451 }
447452
448- clipboardIds .clear ();
449- pasteOperation = undefined ;
453+ if (shouldClearClipboard (pasteOperation)) {
454+ clipboardIds .clear ();
455+ pasteOperation = undefined ;
456+ }
457+
450458 return true ;
451459 }
452460
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ export interface TreeProps<
8282 isItemDisabled ?: ( node : TFile | TFolder ) => boolean ;
8383 isItemHidden ?: ( node : TFile | TFolder ) => boolean ;
8484 copyNode ?: ( node : TFile | TFolder ) => TFile | TFolder ;
85+ shouldClearClipboard ?: ( operation : PasteOperation ) => boolean ;
8586 onResolveNameConflict ?: (
8687 args : OnResolveNameConflictArgs < TFile , TFolder > ,
8788 ) => MaybePromise < NameConflictResolution > ;
You can’t perform that action at this time.
0 commit comments