File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,11 @@ export function initRepoEditor() {
107
107
108
108
const $editFilename = $ ( '#file-name' ) ;
109
109
$editFilename . on ( 'input' , function ( ) {
110
- let value ;
111
110
const parts = $ ( this ) . val ( ) . split ( '/' ) ;
112
111
113
112
if ( parts . length > 1 ) {
114
113
for ( let i = 0 ; i < parts . length ; ++ i ) {
115
- value = parts [ i ] ;
114
+ const value = parts [ i ] ;
116
115
if ( i < parts . length - 1 ) {
117
116
if ( value . length ) {
118
117
$ ( `<span class="section"><a href="#">${ htmlEscape ( value ) } </a></span>` ) . insertBefore ( $ ( this ) ) ;
@@ -130,18 +129,16 @@ export function initRepoEditor() {
130
129
131
130
$editFilename . on ( 'keyup' , function ( e ) {
132
131
const $section = $ ( '.breadcrumb span.section' ) ;
133
- const $divider = $ ( '.breadcrumb div.divider' ) ;
134
- let value ;
135
132
136
133
if ( e . keyCode === 8 && getCursorPosition ( $ ( this ) ) === 0 && $section . length > 0 ) {
137
- value = $section . last ( ) . find ( 'a' ) . text ( ) ;
134
+ const $divider = $ ( '.breadcrumb div.divider' ) ;
135
+ const value = $section . last ( ) . find ( 'a' ) . text ( ) ;
138
136
$ ( this ) . val ( value + $ ( this ) . val ( ) ) ;
139
137
$ ( this ) [ 0 ] . setSelectionRange ( value . length , value . length ) ;
140
138
$section . last ( ) . remove ( ) ;
141
139
$divider . last ( ) . remove ( ) ;
140
+ joinTreePath ( $ ( this ) ) ;
142
141
}
143
-
144
- joinTreePath ( $ ( this ) ) ;
145
142
} ) ;
146
143
147
144
const $editArea = $ ( '.repository.editor textarea#edit_area' ) ;
You can’t perform that action at this time.
0 commit comments