@@ -24,43 +24,43 @@ const humanReadablePane = {
2424 if ( subject && isMarkdownFile ( subject . uri ) ) {
2525 return icons . iconBase + 'markdown.svg'
2626 }
27-
27+
2828 // Dokieli files detected by content check
2929 if ( subject ) {
3030 const kb = context . session . store
31-
31+
3232 // Check cache from previous detection
3333 const cachedResult = dokieliCache . get ( subject . uri )
3434 if ( cachedResult === 'dokieli' ) {
3535 return icons . iconBase + 'dokieli-logo.png'
3636 } else if ( cachedResult === 'html' ) {
3737 return icons . originalIconBase + 'tango/22-text-x-generic.png'
3838 }
39-
39+
4040 // Check if content already fetched (synchronous)
4141 const responseText = kb . fetcher . getHeader ( subject . doc ( ) , 'content' )
4242 if ( responseText && responseText . length > 0 ) {
4343 const text = responseText [ 0 ]
44- const isDokieli = text . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
44+ const isDokieli = text . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
4545 text . includes ( 'dokieli.css' )
4646 dokieliCache . set ( subject . uri , isDokieli ? 'dokieli' : 'html' )
47- return isDokieli
47+ return isDokieli
4848 ? icons . iconBase + 'dokieli-logo.png'
4949 : icons . originalIconBase + 'tango/22-text-x-generic.png'
5050 }
51-
51+
5252 // Content not yet fetched - return a promise (async detection)
5353 const cts = kb . fetcher . getHeader ( subject . doc ( ) , 'content-type' )
5454 const ct = cts ? cts [ 0 ] . split ( ';' , 1 ) [ 0 ] . trim ( ) : null
55-
55+
5656 if ( ct === 'text/html' ) {
5757 return kb . fetcher . _fetch ( subject . uri )
5858 . then ( response => response . text ( ) )
5959 . then ( text => {
60- const isDokieli = text . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
60+ const isDokieli = text . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
6161 text . includes ( 'dokieli.css' )
6262 dokieliCache . set ( subject . uri , isDokieli ? 'dokieli' : 'html' )
63- return isDokieli
63+ return isDokieli
6464 ? icons . iconBase + 'dokieli-logo.png'
6565 : icons . originalIconBase + 'tango/22-text-x-generic.png'
6666 } )
@@ -70,7 +70,7 @@ const humanReadablePane = {
7070 } )
7171 }
7272 }
73-
73+
7474 // Default for all other human-readable content
7575 return icons . originalIconBase + 'tango/22-text-x-generic.png'
7676 } ,
@@ -135,21 +135,21 @@ const humanReadablePane = {
135135 // For HTML files, check if it's dokieli (async check, store result for later)
136136 const cts = kb . fetcher . getHeader ( subject . doc ( ) , 'content-type' )
137137 const ct = cts ? cts [ 0 ] . split ( ';' , 1 ) [ 0 ] . trim ( ) : null
138-
138+
139139 if ( ct === 'text/html' && ! dokieliCache . has ( subject . uri ) ) {
140140 // Async check for dokieli, don't wait for result
141141 kb . fetcher . _fetch ( subject . uri )
142142 . then ( response => response . text ( ) )
143143 . then ( text => {
144- const isDokieli = text . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
144+ const isDokieli = text . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
145145 text . includes ( 'dokieli.css' )
146146 dokieliCache . set ( subject . uri , isDokieli ? 'dokieli' : 'html' )
147147 } )
148148 . catch ( ( ) => {
149149 dokieliCache . set ( subject . uri , 'html' )
150150 } )
151151 }
152-
152+
153153 return 'View'
154154 }
155155
@@ -219,12 +219,12 @@ const humanReadablePane = {
219219 const blobText = response . responseText
220220 const newLines = blobText . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ? - 10 : 5
221221 const lines = Math . min ( 30 , blobText . split ( / \n / ) . length + newLines )
222-
222+
223223 // Cache dokieli detection result
224- const isDokieli = blobText . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
224+ const isDokieli = blobText . includes ( '<script src="https://dokie.li/scripts/dokieli.js">' ) ||
225225 blobText . includes ( 'dokieli.css' )
226226 dokieliCache . set ( subject . uri , isDokieli ? 'dokieli' : 'html' )
227-
227+
228228 setIframeAttributes ( frame , lines )
229229 } ) . catch ( error => {
230230 console . error ( 'Error fetching content for line calculation:' , error )
0 commit comments