File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,22 +229,27 @@ function main() {
229229 customDictionaryErrorList . innerHTML = "" ;
230230 for ( const error of errors ) {
231231 const listItem = document . createElement ( "li" ) ;
232- const link = document . createElement ( "a" ) ;
233- listItem . appendChild ( link ) ;
234232 customDictionaryErrorList . appendChild ( listItem ) ;
235233
236- link . href = "#" ;
237- link . innerText = error . message ;
238- const { position : { position, length } } = error as PositionedError & {
239- position : Position ;
240- } ;
241- link . addEventListener ( "click" , ( ) => {
242- customDictionaryTextBox . focus ( ) ;
243- customDictionaryTextBox . setSelectionRange (
244- position ,
245- position + length ,
246- ) ;
247- } ) ;
234+ if ( error instanceof PositionedError && error . position != null ) {
235+ const link = document . createElement ( "a" ) ;
236+ listItem . appendChild ( link ) ;
237+
238+ link . href = "#" ;
239+ link . innerText = error . message ;
240+ const { position : { position, length } } = error as PositionedError & {
241+ position : Position ;
242+ } ;
243+ link . addEventListener ( "click" , ( ) => {
244+ customDictionaryTextBox . focus ( ) ;
245+ customDictionaryTextBox . setSelectionRange (
246+ position ,
247+ position + length ,
248+ ) ;
249+ } ) ;
250+ } else {
251+ listItem . innerText = error . message ;
252+ }
248253 }
249254 }
250255 // add all event listener
You can’t perform that action at this time.
0 commit comments