@@ -140,6 +140,7 @@ if (typeof $ !== typeof undefined) {
140140 $ ( document ) . find ( 'input[name="file-data-idx"]' ) . val ( $relTgt . attr ( 'data-idx' ) ) ;
141141 $ ( document ) . find ( 'input[name="file-data-nodeid"]' ) . val ( $relTgt . attr ( 'data-nodeid' ) ) ;
142142 $ ( document ) . find ( 'input[name="file-old-filename"]' ) . val ( $relTgt . attr ( 'data-old-filename' ) ) ;
143+ $ ( document ) . find ( 'input[name="file-new-filename"]' ) . val ( $relTgt . attr ( 'data-old-filename' ) ) ;
143144 } ;
144145 }
145146
@@ -208,6 +209,18 @@ if (typeof $ !== typeof undefined) {
208209 Editors . onOpenFile ( ) ;
209210 } ) ;
210211
212+ // Rename file
213+ $ ( document ) . on ( 'click' , '.action-rename-file' , function ( ) {
214+ $ . event . trigger ( {
215+ type : "_file.rename" ,
216+ time : new Date ( ) ,
217+ idx : $ ( document ) . find ( 'input[name="file-data-idx"]' ) . first ( ) . val ( ) ,
218+ nodeId : $ ( document ) . find ( 'input[name="file-data-nodeid"]' ) . first ( ) . val ( ) ,
219+ oldFileName : $ ( document ) . find ( 'input[name="file-old-filename"]' ) . first ( ) . val ( ) ,
220+ newFileName : $ ( document ) . find ( 'input[name="file-new-filename"]' ) . first ( ) . val ( )
221+ } ) ;
222+ } ) ;
223+
211224 // Open project
212225 $ ( document ) . on ( 'click' , '.action-project-open' , function ( ) {
213226 Sidebar . onOpenProject ( ) ;
@@ -220,7 +233,6 @@ if (typeof $ !== typeof undefined) {
220233
221234 // Rename file
222235 $ ( document ) . on ( '_file.rename' , function ( e ) {
223-
224236 Files . fileRename ( Editors . getEditorFileEntry ( e . idx ) , e . oldFileName , e . newFileName ) . then ( function ( fileEntry ) {
225237 if ( typeof fileEntry !== typeof undefined ) {
226238 Editors . onRenameFile ( e . idx , fileEntry ) ;
0 commit comments