File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ export function matchFigureTag(content: string): string[] | null {
1010 const matches : string [ ] = [ ] ;
1111 const openingTag = '<figure' ;
1212 const closingTag = '</figure>' ;
13- let startIndex = 0 ;
14- while ( ( startIndex = content . indexOf ( openingTag , startIndex ) ) !== - 1 ) {
13+ let startIndex = content . indexOf ( openingTag ) ;
14+ while ( startIndex !== - 1 ) {
1515 const endIndex = content . indexOf ( closingTag , startIndex ) ;
1616 if ( endIndex !== - 1 && endIndex > startIndex ) {
1717 matches . push ( content . substring ( startIndex , endIndex + closingTag . length ) ) ;
18- startIndex = endIndex + closingTag . length ;
18+ startIndex = content . indexOf ( openingTag , endIndex + closingTag . length ) ;
1919 } else {
2020 console . error ( 'Malformed figure tag found in content' ) ;
2121 break ;
2222 }
23- }
23+ }
2424 return matches . length > 0 ? matches : null ;
2525}
2626
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ import * as DOMPurify from 'dompurify';
88export const defaultOptions : RenderOption = {
99 [ StyleType . BLOCK ] : ( item : EmbeddedItem | EntryNode ) => {
1010 const title = DOMPurify . sanitize ( item . title || item . uid ) ;
11- const content_type_uid = DOMPurify . sanitize ( item . _content_type_uid || ( item . system ? item . system . content_type_uid : '' ) ) ;
12- return `<div><p>${ title } </p><p>Content type: <span>${ content_type_uid } </span></p></div>` ;
11+ const contentTypeUid = DOMPurify . sanitize ( item . _content_type_uid || ( item . system ? item . system . content_type_uid : '' ) ) ;
12+ return `<div><p>${ title } </p><p>Content type: <span>${ contentTypeUid } </span></p></div>` ;
1313 } ,
1414 [ StyleType . INLINE ] : ( item : EmbeddedItem | EntryNode ) => {
1515 const title = DOMPurify . sanitize ( item . title || item . uid ) ;
You can’t perform that action at this time.
0 commit comments