pds-dev-kit-web-test 0.3.60 → 0.3.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +4 -0
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +11 -7
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/Embed.js +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/EmbedCore.d.ts +2 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/EmbedCore.js +10 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/EmbedIframe.d.ts +10 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/EmbedIframe.js +47 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/constant.d.ts +2 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/constant.js +74 -1
- package/package.json +1 -1
- package/release-note.md +2 -2
|
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sampleCustomsection6 = exports.sampleCustomsection5 = exports.sampleCustomsection4 = exports.sampleCustomsection3 = exports.sampleCustomsection2 = exports.sampleCustomsection1 = exports.EMBEDED_SAMPLES = void 0;
|
|
4
4
|
exports.EMBEDED_SAMPLES = {
|
|
5
5
|
GOOGLE_MAPS: '<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d508.40856699559515!2d127.04604546611074!3d37.5412884534309!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x357ca484b232aab9%3A0x3016af9babd6093e!2z7ISc7Jq47Yq567OE7IucIOyEseuPmeq1rCDrmp3shKzroZwgMzE3!5e0!3m2!1sko!2skr!4v1690098445797!5m2!1sko!2skr" width="100%" height="100%" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>',
|
|
6
|
-
GOOGLE_FORMS: '<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSeXlFI2qpbGOGQ5Zvk3JkkJXo0qsznrpjjIutpk9nGfpPFCIA/viewform?embedded=true" width="
|
|
6
|
+
GOOGLE_FORMS: '<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSeXlFI2qpbGOGQ5Zvk3JkkJXo0qsznrpjjIutpk9nGfpPFCIA/viewform?embedded=true" width="100%" height="100%" frameborder="0" marginheight="0" marginwidth="0">로드 중…</iframe>',
|
|
7
7
|
SCRIPT: '<div class="whattime-inline-widget" data-code="9WVUWfsUhi" style="min-width: 320px; height: 690px;"></div><link href="https://whattime.co.kr/widget/widget.css" rel="stylesheet"><script src="https://whattime.co.kr/widget/widget.js" type="text/javascript" async></script>',
|
|
8
8
|
DIV: '<div style="background-color: black"><button>sample-button</button></div>',
|
|
9
9
|
DIRTY: '<img src=x onerror=alert(1)//>',
|
|
10
|
-
CLEAN: '<div>CLEAN</div>'
|
|
10
|
+
CLEAN: '<div>CLEAN</div>',
|
|
11
|
+
SCRIPT2: '<script src="https:/hello.js" type="text/javascript" async></script>',
|
|
12
|
+
FACEBOOK: '<iframe src="https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fsminglive%2Fposts%2Fpfbid023o4i8jNwoh9B3bdQSXKcsKZiaU7rK8FuLtgGdt2crQugFWHA7aiPJZWxPpZMqTh3l&show_text=true&width=500" width="500"height="437"style="border:none;overflow:hidden"scrolling="no"frameborder="0"allowfullscreen="true"allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>',
|
|
13
|
+
ALERT: '<script>alert("this-is-no"); console.log("hi"); </script>',
|
|
14
|
+
DAUM: '<div id="daumRoughmapContainer1710850127862" class="root_daum_roughmap root_daum_roughmap_landing"></div><script charset="UTF-8" class="daum_roughmap_loader_script" src="https://ssl.daumcdn.net/dmaps/map_js_init/roughmapLoader.js"></script><script charset="UTF-8">new daum.roughmap.Lander({"timestamp": "1710850127862", "key": "2ikv7", "mapWidth": "640", "mapHeight": "360"}).render(); console.log(\'what is this\')</script>'
|
|
11
15
|
};
|
|
12
16
|
exports.sampleCustomsection1 = {
|
|
13
17
|
administrativeTitle: 'UNTITLED',
|
|
@@ -2035,7 +2039,7 @@ exports.sampleCustomsection5 = {
|
|
|
2035
2039
|
CB_CONTENT_PROP_HOVER_SPEC_MUSE: true
|
|
2036
2040
|
},
|
|
2037
2041
|
CB_CONTENT_PROP_CODEBLOCK: {
|
|
2038
|
-
CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE: exports.EMBEDED_SAMPLES.
|
|
2042
|
+
CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE: exports.EMBEDED_SAMPLES.DAUM
|
|
2039
2043
|
},
|
|
2040
2044
|
CB_CONTENT_PROP_VISIBILITY: {
|
|
2041
2045
|
CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
|
|
@@ -2414,9 +2418,9 @@ exports.sampleCustomsection5 = {
|
|
|
2414
2418
|
'CB_EFFECT_PROP_ENTANIM_SPEC_TFUNC:MOBILE': null
|
|
2415
2419
|
},
|
|
2416
2420
|
CB_LAYOUT_PROP_ARRANGE: {
|
|
2417
|
-
CB_LAYOUT_PROP_ARRANGE_SPEC_HORIZONTAL: '
|
|
2421
|
+
CB_LAYOUT_PROP_ARRANGE_SPEC_HORIZONTAL: 'LEFT',
|
|
2418
2422
|
'CB_LAYOUT_PROP_ARRANGE_SPEC_HORIZONTAL:MOBILE': 'MIDDLE',
|
|
2419
|
-
CB_LAYOUT_PROP_ARRANGE_SPEC_VERTICAL: '
|
|
2423
|
+
CB_LAYOUT_PROP_ARRANGE_SPEC_VERTICAL: 'TOP',
|
|
2420
2424
|
'CB_LAYOUT_PROP_ARRANGE_SPEC_VERTICAL:MOBILE': null
|
|
2421
2425
|
},
|
|
2422
2426
|
CB_LAYOUT_PROP_PADDING: {
|
|
@@ -2431,11 +2435,11 @@ exports.sampleCustomsection5 = {
|
|
|
2431
2435
|
'CB_LAYOUT_PROP_PADDING_SPEC_PADDING:MOBILE': null
|
|
2432
2436
|
},
|
|
2433
2437
|
CB_PLACEMENT_PROP_PLACEMENT: {
|
|
2434
|
-
CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:
|
|
2438
|
+
CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS: 15,
|
|
2435
2439
|
'CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:MOBILE': 8,
|
|
2436
2440
|
CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS: 20,
|
|
2437
2441
|
'CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE': 20,
|
|
2438
|
-
CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX:
|
|
2442
|
+
CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX: 0,
|
|
2439
2443
|
'CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX:MOBILE': 0,
|
|
2440
2444
|
CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY: 0,
|
|
2441
2445
|
'CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY:MOBILE': 0,
|
|
@@ -21,7 +21,7 @@ var hooks_1 = require("../../../../hooks");
|
|
|
21
21
|
var util_1 = require("../../../../util");
|
|
22
22
|
var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
|
|
23
23
|
var S_CB_BoxWithShadow_1 = require("../components/S_CB_BoxWithShadow");
|
|
24
|
-
var
|
|
24
|
+
var EmbedIframe_1 = __importDefault(require("./EmbedIframe"));
|
|
25
25
|
function Embed(props) {
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
27
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
|
@@ -40,6 +40,6 @@ function Embed(props) {
|
|
|
40
40
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
|
41
41
|
var hasEffect = !isNoneEffectType;
|
|
42
42
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, style), layout), effectCssProperties), editModeStyle), hoverStyle: hoverStyle, cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device }, { children: (0, jsx_runtime_1.jsx)(
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, style), layout), effectCssProperties), editModeStyle), hoverStyle: hoverStyle, cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device }, { children: (0, jsx_runtime_1.jsx)(EmbedIframe_1.default, { embedCode: CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE, mode: mode, style: layout }) })) })));
|
|
44
44
|
}
|
|
45
45
|
exports.default = Embed;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { DynamicLayoutProps } from '../../../../../../../DynamicLayout/types';
|
|
2
3
|
interface EmbedCoreProps {
|
|
3
4
|
embedCode: string;
|
|
5
|
+
mode: DynamicLayoutProps['mode'];
|
|
4
6
|
}
|
|
5
7
|
declare const EmbedCore: React.FC<EmbedCoreProps>;
|
|
6
8
|
export default EmbedCore;
|
|
@@ -42,14 +42,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
43
|
var DOMPurify = __importStar(require("dompurify"));
|
|
44
44
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
45
|
+
var constant_1 = require("./constant");
|
|
45
46
|
var PURIFY_CONFIG = {
|
|
46
|
-
ADD_TAGS:
|
|
47
|
-
ADD_ATTR:
|
|
47
|
+
ADD_TAGS: constant_1.PURIFY_BLOCK_TAGS,
|
|
48
|
+
ADD_ATTR: constant_1.PURIFY_BLOCK_ATTRS
|
|
48
49
|
};
|
|
49
50
|
var EmbedCore = function (_a) {
|
|
50
|
-
var embedCode = _a.embedCode;
|
|
51
|
+
var embedCode = _a.embedCode, mode = _a.mode;
|
|
51
52
|
var sanitized = DOMPurify.sanitize(embedCode, PURIFY_CONFIG);
|
|
52
|
-
|
|
53
|
+
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
|
54
|
+
if (node.tagName === 'IFRAME') {
|
|
55
|
+
node.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms');
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (DOMPurify.removed.length > 0 && mode === 'EDIT') {
|
|
53
59
|
var message = removedMessage(DOMPurify.removed).join("\n");
|
|
54
60
|
return (0, jsx_runtime_1.jsx)(S_Error, { children: message });
|
|
55
61
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CSSProperties } from 'styled-components';
|
|
3
|
+
import type { DynamicLayoutProps } from '../../../../../../../DynamicLayout/types';
|
|
4
|
+
interface EmbedCoreProps {
|
|
5
|
+
embedCode: string;
|
|
6
|
+
mode: DynamicLayoutProps['mode'];
|
|
7
|
+
style: CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
declare const EmbedIframe: React.FC<EmbedCoreProps>;
|
|
10
|
+
export default EmbedIframe;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
var react_1 = require("react");
|
|
12
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
13
|
+
var EmbedIframe = function (_a) {
|
|
14
|
+
// const blobUrl = useMemo(() => {
|
|
15
|
+
// return getCodeBlobUrl(embedCode, style);
|
|
16
|
+
// }, [embedCode]);
|
|
17
|
+
var embedCode = _a.embedCode, style = _a.style;
|
|
18
|
+
var parsedCode = (0, react_1.useMemo)(function () {
|
|
19
|
+
return getHtmlCode(embedCode, style);
|
|
20
|
+
}, [embedCode, style]);
|
|
21
|
+
var iframeRef = (0, react_1.useRef)(null);
|
|
22
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
23
|
+
if (!iframeRef.current) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var iframeDoc = iframeRef.current.contentDocument || iframeRef.current.contentWindow.document;
|
|
27
|
+
iframeDoc.open();
|
|
28
|
+
iframeDoc.write(parsedCode);
|
|
29
|
+
iframeDoc.close();
|
|
30
|
+
}, [parsedCode]);
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(S_Iframe, { ref: iframeRef, title: "\uD2B9\uBCC4\uD55C\uC774\uB984", sandbox: "allow-scripts allow-same-origin allow-forms" }));
|
|
32
|
+
};
|
|
33
|
+
var S_Iframe = styled_components_1.default.iframe(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: none;\n height: 100%;\n width: 100%;\n"], ["\n border: none;\n height: 100%;\n width: 100%;\n"])));
|
|
34
|
+
function getHtmlCode(code, style) {
|
|
35
|
+
var styleString = Object.entries(style).reduce(function (styleStr, _a) {
|
|
36
|
+
var prop = _a[0], value = _a[1];
|
|
37
|
+
var kebabProp = prop.replace(/([a-z0])([A-Z])/g, '$1-$2').toLowerCase();
|
|
38
|
+
return "".concat(styleStr).concat(kebabProp, ": ").concat(value, ";");
|
|
39
|
+
}, '');
|
|
40
|
+
var fullCode = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <style>\n html, body {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n ".concat(styleString, "\n }\n\n </style>\n </head>\n <body>\n ").concat(code, "\n </body>\n </html>\n ");
|
|
41
|
+
// Use a blob to handle potentially complex scripts and avoid encoding issues
|
|
42
|
+
// const blob = new Blob([fullCode], { type: 'text/html' });
|
|
43
|
+
// const url = URL.createObjectURL(blob);
|
|
44
|
+
return fullCode;
|
|
45
|
+
}
|
|
46
|
+
exports.default = EmbedIframe;
|
|
47
|
+
var templateObject_1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.attrBlacklist = exports.tagBlacklist = void 0;
|
|
3
|
+
exports.PURIFY_BLOCK_ATTRS = exports.PURIFY_BLOCK_TAGS = exports.attrBlacklist = exports.tagBlacklist = void 0;
|
|
4
4
|
exports.tagBlacklist = [
|
|
5
5
|
// 'script',
|
|
6
6
|
// 'iframe',
|
|
@@ -24,3 +24,76 @@ exports.attrBlacklist = [
|
|
|
24
24
|
// 'style',
|
|
25
25
|
'target'
|
|
26
26
|
];
|
|
27
|
+
exports.PURIFY_BLOCK_TAGS = [
|
|
28
|
+
'applet',
|
|
29
|
+
'base',
|
|
30
|
+
'basefont',
|
|
31
|
+
'command',
|
|
32
|
+
'embed',
|
|
33
|
+
'frame',
|
|
34
|
+
'frameset',
|
|
35
|
+
'iframe',
|
|
36
|
+
'keygen',
|
|
37
|
+
'link',
|
|
38
|
+
'meta',
|
|
39
|
+
'noframes',
|
|
40
|
+
'noscript',
|
|
41
|
+
'object',
|
|
42
|
+
'param',
|
|
43
|
+
'script',
|
|
44
|
+
'title'
|
|
45
|
+
];
|
|
46
|
+
exports.PURIFY_BLOCK_ATTRS = [
|
|
47
|
+
'accept-charset',
|
|
48
|
+
'accesskey',
|
|
49
|
+
'allow',
|
|
50
|
+
'allowfullscreen',
|
|
51
|
+
'async',
|
|
52
|
+
'autocapitalize',
|
|
53
|
+
'autofocus',
|
|
54
|
+
'autoplay',
|
|
55
|
+
'buffered',
|
|
56
|
+
'challenge',
|
|
57
|
+
'charset',
|
|
58
|
+
'code',
|
|
59
|
+
'codebase',
|
|
60
|
+
'content',
|
|
61
|
+
'contenteditable',
|
|
62
|
+
'contextmenu',
|
|
63
|
+
'controls',
|
|
64
|
+
'data',
|
|
65
|
+
'decoding',
|
|
66
|
+
'defer',
|
|
67
|
+
'dirname',
|
|
68
|
+
'draggable',
|
|
69
|
+
'dropzone',
|
|
70
|
+
'form',
|
|
71
|
+
'formaction',
|
|
72
|
+
'http-equiv',
|
|
73
|
+
'icon',
|
|
74
|
+
'importance',
|
|
75
|
+
'itemprop',
|
|
76
|
+
'keytype',
|
|
77
|
+
'kind',
|
|
78
|
+
'language',
|
|
79
|
+
'lazyload',
|
|
80
|
+
'manifest',
|
|
81
|
+
'minlength',
|
|
82
|
+
'muted',
|
|
83
|
+
'ping',
|
|
84
|
+
'sandbox',
|
|
85
|
+
'scoped',
|
|
86
|
+
'slot',
|
|
87
|
+
'spellcheck',
|
|
88
|
+
'srcdoc',
|
|
89
|
+
'srclang',
|
|
90
|
+
'start',
|
|
91
|
+
'target',
|
|
92
|
+
'translate',
|
|
93
|
+
'wrap',
|
|
94
|
+
'referrerpolicy',
|
|
95
|
+
'frameborder',
|
|
96
|
+
'scrolling',
|
|
97
|
+
'marginheight',
|
|
98
|
+
'marginwidth'
|
|
99
|
+
];
|
package/package.json
CHANGED
package/release-note.md
CHANGED