File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,16 @@ besogo.makeFilePanel = function(container, editor) {
24
24
container . appendChild ( element ) ;
25
25
26
26
// Save file button
27
+ let currentName = 'export.sgf' ; // Reference to the current file name.
27
28
element = document . createElement ( 'input' ) ;
28
29
element . type = 'button' ;
29
30
element . value = 'Save' ;
30
31
element . title = 'Export SGF' ;
31
32
element . onclick = function ( ) {
32
- var fileName = prompt ( 'Save file as' , 'export.sgf' ) ;
33
+ var fileName = prompt ( 'Save file as' , currentName ) ;
33
34
if ( fileName ) { // Canceled or empty string does nothing
34
35
saveFile ( fileName , besogo . composeSgf ( editor ) ) ;
36
+ currentName = fileName ;
35
37
}
36
38
} ;
37
39
container . appendChild ( element ) ;
@@ -94,6 +96,7 @@ besogo.makeFilePanel = function(container, editor) {
94
96
besogo . loadSgf ( sgf , editor ) ;
95
97
} ;
96
98
if ( confirm ( "Load '" + file . name + "'?\n" + WARNING ) ) {
99
+ currentName = file . name ; // Use the file name for the next save
97
100
reader . readAsText ( file ) ; // Initiate file read
98
101
}
99
102
}
You can’t perform that action at this time.
0 commit comments