File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
src/main/java/com/lukeonuke/lmark Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -16,5 +16,5 @@ public class ApplicationConstants {
16
16
public static final String MARKDOWN_CACHE_PATH = "markdown-renderer-cache" ;
17
17
public static final Font FONTS_AWESOME = Font .loadFont (LMark .class .getResourceAsStream ("/gui/fa-6-solid.otf" ), 12 );
18
18
public static final String TMP = "tmp/" ;
19
- public static final String APPDIR = LMark . class . getName () ;
19
+ public static final String APPDIR = ".lmark" ;
20
20
}
Original file line number Diff line number Diff line change 16
16
import javafx .scene .control .ListView ;
17
17
import javafx .scene .image .Image ;
18
18
import javafx .scene .input .Dragboard ;
19
+ import javafx .scene .input .TransferMode ;
19
20
import javafx .scene .layout .AnchorPane ;
20
21
import javafx .stage .FileChooser ;
21
22
import javafx .stage .Stage ;
@@ -82,12 +83,19 @@ public void show() {
82
83
});
83
84
84
85
root .setOnDragOver (dragEvent -> {
86
+ if (dragEvent .getDragboard ().hasFiles ()) dragEvent .acceptTransferModes (TransferMode .ANY );
87
+ });
88
+
89
+ root .setOnDragDropped (dragEvent -> {
85
90
Dragboard db = dragEvent .getDragboard ();
91
+ if (!db .hasFiles ()) return ;
86
92
File file = db .getFiles ().get (0 );
87
93
88
94
try {
89
95
FileUtils .getInstance (file .getPath ());
90
96
hide ();
97
+ dragEvent .setDropCompleted (true );
98
+ dragEvent .consume ();
91
99
92
100
FileUtils .addToRecents (file );
93
101
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ public static File getAppData(){
143
143
if (OS .equals (OperatingSystem .MACOS )){
144
144
return new File (File .separator + "Library" +
145
145
File .separator + "Application Support" +
146
- File .separator + ApplicationConstants . APPDIR + File .separator );
146
+ File .separator + LMark . class . getName () + File .separator );
147
147
}
148
148
return new File (System .getProperty ("user.home" ) +
149
149
File .separator + ApplicationConstants .APPDIR + File .separator );
You can’t perform that action at this time.
0 commit comments