iframe 경고와 페이지네이션 강조 수정
This commit is contained in:
@@ -49,6 +49,22 @@ const sanitizeAllowValue = (value) => String(value || '')
|
||||
.replace(/[^\w\s;*.:/-]/g, '')
|
||||
.trim()
|
||||
|
||||
/**
|
||||
* iframe allow 속성과 fullscreen 권한을 정리한다.
|
||||
* @param {Record<string, string>} attributes - iframe 속성 객체
|
||||
* @param {string} openerAttributes - iframe 여는 태그 원본 속성 문자열
|
||||
* @returns {string} 정리된 allow 값
|
||||
*/
|
||||
const normalizeAllowValue = (attributes, openerAttributes) => {
|
||||
const allow = sanitizeAllowValue(attributes.allow || 'fullscreen; picture-in-picture; encrypted-media; web-share')
|
||||
|
||||
if (!/\ballowfullscreen\b/i.test(openerAttributes) || /\bfullscreen\b/i.test(allow)) {
|
||||
return allow
|
||||
}
|
||||
|
||||
return [allow, 'fullscreen'].filter(Boolean).join('; ')
|
||||
}
|
||||
|
||||
/**
|
||||
* iframe HTML 코드인지 확인한다.
|
||||
* @param {string} value - 검사할 문자열
|
||||
@@ -59,7 +75,7 @@ export const isIframeEmbedMarkup = (value) => /^<iframe\b[\s\S]*?(?:<\/iframe>\s
|
||||
/**
|
||||
* iframe HTML 코드에서 렌더링 가능한 정보만 추출한다.
|
||||
* @param {string} value - iframe HTML 코드
|
||||
* @returns {{ src: string, title: string, allow: string, width: string, height: string, allowFullscreen: boolean }|null} iframe 정보
|
||||
* @returns {{ src: string, title: string, allow: string, width: string, height: string }|null} iframe 정보
|
||||
*/
|
||||
export const parseIframeEmbedMarkup = (value) => {
|
||||
const source = String(value || '').trim()
|
||||
@@ -79,9 +95,8 @@ export const parseIframeEmbedMarkup = (value) => {
|
||||
return {
|
||||
src,
|
||||
title: attributes.title || 'Embedded content',
|
||||
allow: sanitizeAllowValue(attributes.allow || 'fullscreen; picture-in-picture; encrypted-media; web-share'),
|
||||
allow: normalizeAllowValue(attributes, opener[1]),
|
||||
width: sanitizeSizeValue(attributes.width),
|
||||
height: sanitizeSizeValue(attributes.height),
|
||||
allowFullscreen: /\ballowfullscreen\b/i.test(opener[1])
|
||||
height: sanitizeSizeValue(attributes.height)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user