11import $ from 'jquery' ;
22import { htmlEscape } from 'escape-goat' ;
33import { createCodeEditor } from './codeeditor.ts' ;
4- import { hideElem , queryElems , showElem } from '../utils/dom.ts' ;
4+ import { hideElem , queryElems , showElem , createElementFromHTML } from '../utils/dom.ts' ;
55import { initMarkupContent } from '../markup/content.ts' ;
66import { attachRefIssueContextPopup } from './contextpopup.ts' ;
77import { POST } from '../modules/fetch.ts' ;
@@ -61,7 +61,7 @@ export function initRepoEditor() {
6161 } ) ;
6262 }
6363
64- const filenameInput = document . querySelector ( '#file-name' ) ;
64+ const filenameInput = document . querySelector < HTMLInputElement > ( '#file-name' ) ;
6565 function joinTreePath ( ) {
6666 const parts = [ ] ;
6767 for ( const el of document . querySelectorAll ( '.breadcrumb span.section' ) ) {
@@ -80,8 +80,12 @@ export function initRepoEditor() {
8080 const value = parts [ i ] ;
8181 if ( i < parts . length - 1 ) {
8282 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+ ) ) ;
8589 }
8690 } else {
8791 filenameInput . value = value ;
0 commit comments