pds-dev-kit-web-test 0.3.61 → 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.
@@ -8,6 +8,7 @@ export declare const EMBEDED_SAMPLES: {
8
8
  SCRIPT2: string;
9
9
  FACEBOOK: string;
10
10
  ALERT: string;
11
+ DAUM: string;
11
12
  };
12
13
  export declare const sampleCustomsection1: {
13
14
  administrativeTitle: string;
@@ -10,7 +10,8 @@ exports.EMBEDED_SAMPLES = {
10
10
  CLEAN: '<div>CLEAN</div>',
11
11
  SCRIPT2: '<script src="https:/hello.js" type="text/javascript" async></script>',
12
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>'
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>'
14
15
  };
15
16
  exports.sampleCustomsection1 = {
16
17
  administrativeTitle: 'UNTITLED',
@@ -2038,7 +2039,7 @@ exports.sampleCustomsection5 = {
2038
2039
  CB_CONTENT_PROP_HOVER_SPEC_MUSE: true
2039
2040
  },
2040
2041
  CB_CONTENT_PROP_CODEBLOCK: {
2041
- CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE: exports.EMBEDED_SAMPLES.ALERT
2042
+ CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE: exports.EMBEDED_SAMPLES.DAUM
2042
2043
  },
2043
2044
  CB_CONTENT_PROP_VISIBILITY: {
2044
2045
  CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
@@ -11,24 +11,37 @@ var jsx_runtime_1 = require("react/jsx-runtime");
11
11
  var react_1 = require("react");
12
12
  var styled_components_1 = __importDefault(require("styled-components"));
13
13
  var EmbedIframe = function (_a) {
14
+ // const blobUrl = useMemo(() => {
15
+ // return getCodeBlobUrl(embedCode, style);
16
+ // }, [embedCode]);
14
17
  var embedCode = _a.embedCode, style = _a.style;
15
- var blobUrl = (0, react_1.useMemo)(function () {
16
- return getCodeBlobUrl(embedCode, style);
17
- }, [embedCode]);
18
- return ((0, jsx_runtime_1.jsx)(S_Iframe, { src: blobUrl, title: "\uD2B9\uBCC4\uD55C\uC774\uB984", sandbox: "allow-scripts allow-same-origin allow-forms" }));
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" }));
19
32
  };
20
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"])));
21
- function getCodeBlobUrl(code, style) {
34
+ function getHtmlCode(code, style) {
22
35
  var styleString = Object.entries(style).reduce(function (styleStr, _a) {
23
36
  var prop = _a[0], value = _a[1];
24
37
  var kebabProp = prop.replace(/([a-z0])([A-Z])/g, '$1-$2').toLowerCase();
25
38
  return "".concat(styleStr).concat(kebabProp, ": ").concat(value, ";");
26
39
  }, '');
27
- var fullCode = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title>\uCF54\uB4DC\uC528\uBE44</title>\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 ");
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 ");
28
41
  // Use a blob to handle potentially complex scripts and avoid encoding issues
29
- var blob = new Blob([fullCode], { type: 'text/html' });
30
- var url = URL.createObjectURL(blob);
31
- return url;
42
+ // const blob = new Blob([fullCode], { type: 'text/html' });
43
+ // const url = URL.createObjectURL(blob);
44
+ return fullCode;
32
45
  }
33
46
  exports.default = EmbedIframe;
34
47
  var templateObject_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "0.3.61",
3
+ "version": "0.3.62",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # pds-dev-kit-web-test Release Notes
2
- ## [v0.3.61]
2
+ ## [v0.3.62]
3
3
  ## 기준 pds-dev-kit-web 버전 @2.2.57
4
4
  ### sub
5
5
  * DynamicLayout
6
- * domPurify(sanitizer) 사용하지 않고 blob iframe으로 사용.
7
- * form 을 허용가능하게 한다.
6
+ * blob방식에서 iframe 직접 쓰기로 변경