1
1
import $ from 'jquery' ;
2
2
import { htmlEscape } from 'escape-goat' ;
3
3
import { createCodeEditor } from './codeeditor.ts' ;
4
- import { hideElem , queryElems , showElem } from '../utils/dom.ts' ;
4
+ import { hideElem , queryElems , showElem , createElementFromHTML } from '../utils/dom.ts' ;
5
5
import { initMarkupContent } from '../markup/content.ts' ;
6
6
import { attachRefIssueContextPopup } from './contextpopup.ts' ;
7
7
import { POST } from '../modules/fetch.ts' ;
@@ -61,7 +61,7 @@ export function initRepoEditor() {
61
61
} ) ;
62
62
}
63
63
64
- const filenameInput = document . querySelector ( '#file-name' ) ;
64
+ const filenameInput = document . querySelector < HTMLInputElement > ( '#file-name' ) ;
65
65
function joinTreePath ( ) {
66
66
const parts = [ ] ;
67
67
for ( const el of document . querySelectorAll ( '.breadcrumb span.section' ) ) {
@@ -80,8 +80,12 @@ export function initRepoEditor() {
80
80
const value = parts [ i ] ;
81
81
if ( i < parts . length - 1 ) {
82
82
if ( value . length ) {
83
- $ ( `<span class="section"><a href="#">${ htmlEscape ( value ) } </a></span>` ) . insertBefore ( $ ( filenameInput ) ) ;
84
- $ ( '<div class="breadcrumb-divider">/</div>' ) . insertBefore ( $ ( filenameInput ) ) ;
83
+ filenameInput . before ( createElementFromHTML (
84
+ `<span class="section"><a href="#">${ htmlEscape ( value ) } </a></span>` ,
85
+ ) ) ;
86
+ filenameInput . before ( createElementFromHTML (
87
+ `<div class="breadcrumb-divider">/</div>` ,
88
+ ) ) ;
85
89
}
86
90
} else {
87
91
filenameInput . value = value ;
0 commit comments