@gem-sdk/components 17.0.0-staging.48 → 17.0.0-staging.49

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.
@@ -1,4 +1,11 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react"),r=require("../common/helpers.js");exports.default=(o,s)=>{let p=e.useEditorMode(),{editorData:l}=o||{},{customLabel:i}=s||{},u=t.useMemo(()=>`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("react");const s=["SCRIPT"],l=["EMBED","IMG","INPUT","PICTURE","VIDEO"];exports.default=(p,n)=>{let a=e.useEditorMode(),{editorData:i}=p||{},{customLabel:o}=n||{},r=t.useCallback((e,t,s)=>`
2
2
  <p class="gp-text-center gp-text-sm gp-py-4 gp-leading-6 gp-text-light-500 gp-flex gp-flex-col gp-gap-[4px]">
3
- <span>${i||"Custom Code"}</span>
4
- </p>`,[i]),m=t.useMemo(()=>{if("edit"===p){let e=r.removeScriptTags(l?.html||""),t=r.checkIsEmpty(e);return t?u:e.trim()}return l?.html?.trim()},[p,l?.html,u]);return{mode:p,htmlPlainText:m,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};
3
+ <span>${o||"Custom Code"}</span>
4
+ ${e||t||s?'<span class="gp-text-[#676767] gp-text-12 gp-leading-5">Publish the page to see the content.</span>':""}
5
+ </p>`,[o]),c=(e,t)=>{let p=document.createElement("div");p.innerHTML=e;let n=p.childNodes,a=!1,i=!0;if(n.length>0){n.forEach(e=>{s.includes(e?.tagName)&&(a=!0,e?.remove())});let e=p.childNodes;e.forEach(e=>{if(l.includes(e?.tagName))i=!1;else if(e?.nodeName!=="#comment"){let t=e?.textContent?.trim();t&&(i=!1)}})}return i&&(i=!p?.textContent?.trim()),t&&(a=!0),{empty:i,hasScript:a}},g=t.useMemo(()=>{if("edit"===a){let{empty:e,hasScript:t}=c(i?.html||"",i?.javascript||"");if(t)return`
6
+ <div class="gp-py-4 gp-font-[sans-serif] gp-flex gp-flex-col gp-gap-[4px]" >
7
+ <p class="gp-text-center gp-text-sm gp-leading-[21px] gp-text-[#676767] ">
8
+ Publish the page to see the content.
9
+ </p>
10
+ </div>
11
+ `;if(e)return r(i?.css||"",i?.javascript||"",i?.html||"")}return i?.html?.trim()},[a,i?.html,i?.javascript,i?.css,r]);return{mode:a,htmlPlainText:g,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};
@@ -1,4 +1,11 @@
1
- import{useEditorMode as e}from"@gem-sdk/core";import{useMemo as t}from"react";import{removeScriptTags as o,checkIsEmpty as p}from"../common/helpers.js";let l=(l,r)=>{let m=e(),{editorData:s}=l||{},{customLabel:i}=r||{},n=t(()=>`
1
+ import{useEditorMode as e}from"@gem-sdk/core";import{useCallback as t,useMemo as p}from"react";let l=["SCRIPT"],s=["EMBED","IMG","INPUT","PICTURE","VIDEO"],n=(n,a)=>{let o=e(),{editorData:i}=n||{},{customLabel:r}=a||{},g=t((e,t,p)=>`
2
2
  <p class="gp-text-center gp-text-sm gp-py-4 gp-leading-6 gp-text-light-500 gp-flex gp-flex-col gp-gap-[4px]">
3
- <span>${i||"Custom Code"}</span>
4
- </p>`,[i]),d=t(()=>{if("edit"===m){let e=o(s?.html||""),t=p(e);return t?n:e.trim()}return s?.html?.trim()},[m,s?.html,n]);return{mode:m,htmlPlainText:d,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};export{l as default};
3
+ <span>${r||"Custom Code"}</span>
4
+ ${e||t||p?'<span class="gp-text-[#676767] gp-text-12 gp-leading-5">Publish the page to see the content.</span>':""}
5
+ </p>`,[r]),c=(e,t)=>{let p=document.createElement("div");p.innerHTML=e;let n=p.childNodes,a=!1,o=!0;if(n.length>0){n.forEach(e=>{l.includes(e?.tagName)&&(a=!0,e?.remove())});let e=p.childNodes;e.forEach(e=>{if(s.includes(e?.tagName))o=!1;else if(e?.nodeName!=="#comment"){let t=e?.textContent?.trim();t&&(o=!1)}})}return o&&(o=!p?.textContent?.trim()),t&&(a=!0),{empty:o,hasScript:a}},d=p(()=>{if("edit"===o){let{empty:e,hasScript:t}=c(i?.html||"",i?.javascript||"");if(t)return`
6
+ <div class="gp-py-4 gp-font-[sans-serif] gp-flex gp-flex-col gp-gap-[4px]" >
7
+ <p class="gp-text-center gp-text-sm gp-leading-[21px] gp-text-[#676767] ">
8
+ Publish the page to see the content.
9
+ </p>
10
+ </div>
11
+ `;if(e)return g(i?.css||"",i?.javascript||"",i?.html||"")}return i?.html?.trim()},[o,i?.html,i?.javascript,i?.css,g]);return{mode:o,htmlPlainText:d,handleDoubleClickCustomCode:e=>{if(2===e.detail){let e=new CustomEvent("editor:toolbar:open-custom-code",{bubbles:!0});window.dispatchEvent(e)}}}};export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "17.0.0-staging.48",
3
+ "version": "17.0.0-staging.49",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,9 +26,9 @@
26
26
  "i18n:extract": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/translate/extract-texts-to-locales.js && node ./scripts/translate/en-keys-usage.js"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "17.0.0-staging.46",
30
- "@gem-sdk/styles": "17.0.0-staging.44",
31
- "@gem-sdk/system": "17.0.0-staging.26",
29
+ "@gem-sdk/core": "17.0.0-staging.49",
30
+ "@gem-sdk/styles": "17.0.0-staging.49",
31
+ "@gem-sdk/system": "17.0.0-staging.49",
32
32
  "@types/react-transition-group": "^4.4.12",
33
33
  "postcss-import": "16.1.1",
34
34
  "@thedutchcoder/postcss-rem-to-px": "0.0.2",
@@ -1 +0,0 @@
1
- "use strict";exports.checkIsEmpty=e=>{let t=document.createElement("div");t.innerHTML=e;let r=t.querySelector("embed, img, input, picture, video");return!r&&!t?.textContent?.trim()},exports.removeScriptTags=e=>e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*\/>/gi,"");
@@ -1 +0,0 @@
1
- let e=e=>{let t=document.createElement("div");t.innerHTML=e;let r=t.querySelector("embed, img, input, picture, video");return!r&&!t?.textContent?.trim()},t=e=>e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*\/>/gi,"");export{e as checkIsEmpty,t as removeScriptTags};