fix: lint fix

pull/19162/head
G.Wood-Sun 1 year ago
parent a7d6ea011d
commit 9764e9c7cf

@ -30,7 +30,7 @@ const CreateIframeModal = ({ show, onClose, content }: CreateIframeModalProps) =
> >
<iframe <iframe
srcDoc={content} srcDoc={content}
sandbox="allow-scripts" sandbox="allow-scripts allow-same-origin"
title={t(`${prefixPreview}`)} title={t(`${prefixPreview}`)}
style={{ width: '100%', height: '100%', border: 'none' }} style={{ width: '100%', height: '100%', border: 'none' }}
/> />

@ -1,6 +1,10 @@
export const isCompleteHTML = (code: string): boolean => { export const isCompleteHTML = (code: string): boolean => {
// simple check /**
const completeHTMLRegex = /<\s*html\s*[^>]*>[\s\S]*<\/html\s*>/i * A simple check to determine if the input string is a complete HTML document.
* This function supports optional <!DOCTYPE> declarations and comments before the <html> tag.
* Note: This is not a full HTML validator and may not handle all edge cases.
*/
const completeHTMLRegex = /^(?:<!DOCTYPE\s+html\s*[^>]*>\s*)?(?:<!--[\s\S]*?-->\s*)*<\s*html\s*[^>]*>[\s\S]*<\/html\s*>/i
return completeHTMLRegex.test(code) return completeHTMLRegex.test(code)
} }

Loading…
Cancel
Save