Skip to content

Commit

Permalink
change: hold command to avoid delete prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
netdcy committed Nov 22, 2024
1 parent cc6ae14 commit ef36e5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions FlowVision/Sources/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,12 @@ class ViewController: NSViewController, NSSplitViewDelegate {
if specialKey == .delete || specialKey == .backspace || specialKey == .deleteForward {
//如果焦点在OutlineView
if publicVar.isOutlineViewFirstResponder{
outlineView.actDelete(isByKeyboard: true)
outlineView.actDelete(isByKeyboard: true, isShowPrompt: !isCommandPressed)
return nil
}
//如果焦点在CollectionView
if publicVar.isCollectionViewFirstResponder{
handleDelete()
handleDelete(isShowPrompt: !isCommandPressed)
return nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions FlowVision/Sources/Views/CustomOutlineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class CustomOutlineView: NSOutlineView, NSMenuDelegate {
pasteboard.writeObjects(urls as [NSPasteboardWriting])
}

@objc func actDelete(isByKeyboard: Bool = false) {
@objc func actDelete(isByKeyboard: Bool = false, isShowPrompt: Bool = true) {
var url: URL?
if isByKeyboard {
url = getFirstSelectedUrl()
Expand All @@ -253,7 +253,7 @@ class CustomOutlineView: NSOutlineView, NSMenuDelegate {
}
guard let url = url else {return}

let result = getViewController(self)?.handleDelete(fileUrls: [url], isShowPrompt: isByKeyboard)
let result = getViewController(self)?.handleDelete(fileUrls: [url], isShowPrompt: isByKeyboard && isShowPrompt)

if result == true && curRightClickedIndex != self.selectedRowIndexes.first {
refreshTreeView()
Expand Down

0 comments on commit ef36e5f

Please sign in to comment.