mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	refactor(react/dialogs): deduplicate raw HTML component
This commit is contained in:
		
							parent
							
								
									f9eb0a20f7
								
							
						
					
					
						commit
						c0d7278827
					
				@ -8,20 +8,20 @@ interface RawHtmlProps {
 | 
				
			|||||||
    style?: CSSProperties;
 | 
					    style?: CSSProperties;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function RawHtml({ className, html, style }: RawHtmlProps) {
 | 
					export default function RawHtml(props: RawHtmlProps) {
 | 
				
			||||||
    return <span
 | 
					    return <span {...getProps(props)} />;
 | 
				
			||||||
        className={className}
 | 
					 | 
				
			||||||
        dangerouslySetInnerHTML={getHtml(html)}
 | 
					 | 
				
			||||||
        style={style}
 | 
					 | 
				
			||||||
    />;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function RawHtmlBlock({ className, html, style }: RawHtmlProps) {
 | 
					export function RawHtmlBlock(props: RawHtmlProps) {
 | 
				
			||||||
    return <div
 | 
					    return <div {...getProps(props)} />
 | 
				
			||||||
        className={className}
 | 
					}
 | 
				
			||||||
        dangerouslySetInnerHTML={getHtml(html)}
 | 
					
 | 
				
			||||||
        style={style}
 | 
					function getProps({ className, html, style }: RawHtmlProps) {
 | 
				
			||||||
    />
 | 
					    return {
 | 
				
			||||||
 | 
					        className: className,
 | 
				
			||||||
 | 
					        dangerouslySetInnerHTML: getHtml(html),
 | 
				
			||||||
 | 
					        style
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getHtml(html: string | HTMLElement | JQuery<HTMLElement>) {
 | 
					function getHtml(html: string | HTMLElement | JQuery<HTMLElement>) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user