@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
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/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(m,h){typeof exports=="object"&&typeof module<"u"?module.exports=h(require("react/jsx-runtime"),require("react"),require("react-dom/client")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react","react-dom/client"],h):(m=typeof globalThis<"u"?globalThis:m||self,m.StudioSdkPlugins_rendererReact=h(m.jsxRuntime,m.React,m.ReactDOMClient))})(this,function(m,h,U){"use strict";const S="app.grapesjs.com",R="app-stage.grapesjs.com",N=[S,"app2.grapesjs.com",R,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],j="license:check:start",W="license:check:end",M=()=>typeof window<"u",B=({isDev:e,isStage:t})=>`${e?"":`https://${t?R:S}`}/api`,$=()=>{const e=M()&&window.location.hostname;return!!e&&(N.includes(e)||N.some(t=>e.endsWith(t)))},F=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),T=e=>typeof e=="string";function K(e){return typeof e=="function"}async function V({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:r,body:o}){const c=`${t||B({isDev:!1,isStage:!1})}${e}`,a={method:n,headers:{"Content-Type":"application/json",...s}};o&&(a.body=JSON.stringify(o));const d=r?new URLSearchParams(r).toString():"",l=d?`?${d}`:"",u=await fetch(`${c}${l}`,a);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{});const x={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function z(e){const t=e;return t.init=n=>s=>e(s,n),t}const q=e=>z(e);async function G({editor:e,plan:t,pluginName:n,licenseKey:s,cleanup:r}){let o="",i=!1;const c=$(),a=l=>{console.warn("Cleanup plugin:",n,"Reason:",l),r()},d=(l={})=>{var g;const{error:u,sdkLicense:y}=l,f=(g=l.plan)==null?void 0:g.category;if(!(y||l.license)||u)a(u||"Invalid license");else if(f){const A=x[t],w=x[f];A>w&&a({pluginRequiredPlan:t,licensePlan:f})}};e.on(j,l=>{o=l==null?void 0:l.baseApiUrl,i=!0}),e.on(W,l=>{d(l)}),setTimeout(async()=>{if(!i){if(c)return;if(s){const l=await J({licenseKey:s,pluginName:n,baseApiUrl:o});l&&d(l)}else a("The `licenseKey` option not provided")}},2e3)}async function J(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await V({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}function H(e){const t={};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const s=F(n);t[s]=e[n]}return t}const Z=(e,t)=>{const n=e.components||{};for(const s in n){const r=n[s];if(r.component===t)return{cmpConfig:r,type:s}}};function O(e){const t={};let n=!1;for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(typeof r=="string"||typeof r=="number"){const o=s.includes("-")?s.replace(/-([a-z])/g,i=>i[1].toUpperCase()):s;t[o]=r,n=!0}}return n?t:void 0}function Q(e){const t={};return e.split(";").forEach(n=>{if(!n.trim())return;const s=n.indexOf(":");if(s>0){const r=n.substring(0,s).trim(),o=n.substring(s+1).trim();if(r&&o){const i=r.replace(/-([a-z])/g,c=>c[1].toUpperCase());t[i]=o}}}),Object.keys(t).length>0?t:void 0}function X(e){if(e){if(typeof e=="object"&&!Array.isArray(e))return O(e);if(typeof e=="string"){let t=Q(e);if(!t)try{const n=JSON.parse(e);typeof n=="object"&&n!==null&&!Array.isArray(n)&&(t=O(n))}catch(n){console.error("Failed to parse style string as JSON",n)}return t}if(Array.isArray(e)){const t={};return e.forEach(n=>{if(typeof n=="object"&&n!==null){const s=n.name||n.property,r=n.value;if(typeof s=="string"&&s&&r!==void 0&&r!==""){const o=s.replace(/-([a-z])/g,i=>i[1].toUpperCase());t[o]=r}}}),Object.keys(t).length>0?t:void 0}}}function Y(e){return P[e]?P[e]:e.includes("-")?e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase()):e}function ee(e){var n;const t={};for(const[s,r]of Object.entries(e))if(s==="style")t.style=X(r);else if(s.startsWith("data-"))t[s]=r;else{const o=Y(s);((n=e.xmlns)==null?void 0:n.includes("svg"))||e.viewBox!==void 0||e.d!==void 0||ne.has(o)||o.startsWith("svg")?t[o]=r:!te.has(o)&&!o.startsWith("on")&&!o.startsWith("aria-")&&!o.startsWith("data-")?t[s]=r:t[o]=r}return t}const te=new Set(["className","id","style","href","src","alt","title","target","rel","type","name","value","placeholder","onClick","onChange","onSubmit","onBlur","onFocus","disabled","readOnly","checked","selected","multiple","width","height","maxLength","min","max","step","rows","cols","autoComplete","autoFocus","required","spellCheck","tabIndex","aria-label","aria-labelledby","aria-describedby","role"]),ne=new Set(["x","y","d","cx","cy","r","rx","ry","x1","x2","y1","y2","points","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeOpacity","fillOpacity","fillRule","clipRule","transform","viewBox","preserveAspectRatio","pathLength","vectorEffect","dominantBaseline","alignmentBaseline","textAnchor","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","baselineShift","opacity","mask","clipPath","overflow","pointerEvents"]),P={class:"className",for:"htmlFor","http-equiv":"httpEquiv","accept-charset":"acceptCharset","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","fill-rule":"fillRule","clip-rule":"clipRule","stroke-miterlimit":"strokeMiterlimit","stroke-dasharray":"strokeDasharray","stroke-opacity":"strokeOpacity","fill-opacity":"fillOpacity","font-family":"fontFamily","font-size":"fontSize","text-anchor":"textAnchor"},b=e=>(e==null?void 0:e.$$typeof)&&typeof e.props=="object";function oe(e){return t=>{const n=t.getContent();b(n)&&t.set({content:k({...e,model:n}),reactContent:n})}}const se=e=>t=>{const n=t.component;b(n)&&(t.component={components:k({...e,model:n})})};function k(e){const{model:t,editor:n,config:s}=e;if(b(t)){const r=t,o={},{type:i,props:c={}}=r,{children:a,className:d,style:l,...u}=c,y=p=>({type:"textnode",content:p}),f=typeof i=="symbol";if(K(i)){const p=Z(s,i);o.type=p==null?void 0:p.type}else n.Components.getType(i)?o.type=i:f||(o.tagName=i);if(d&&(o.classes=d),l&&(o.style=H(l)),Array.isArray(a)?o.components=a.map(p=>T(p)?y(p):k({...e,model:p})).filter(Boolean):T(a)&&(o.components=y(a)),Object.keys(u).length){const p=n.Parser.parserHtml.splitPropsFromAttr(u);o.attributes=p.attrs,Object.assign(o,p.props)}return o}}function re(e){const{component:t}=e,[n,s]=h.useState(0),[r,o]=h.useState();return h.useEffect(()=>{if(!t)return()=>{};const c=()=>s(p=>p+1),a=()=>{[...t.views].forEach(g=>g.remove()),o(void 0)},{em:d}=t,l=d.Components.events,y=[...["components","attributes","classes"].map(p=>`${l.update}:${p}`),"rerender"].join(" "),f=[l.removed,"rerender"].join(" ");return t.on(y,c),t.on(f,a),()=>{t.off(y,c),t.off(f,a),a()}},[t]),{key:n,view:r,connectDom:c=>{if(!c)return;const a=ce({...e,el:c});o(a)}}}function ce(e){var a;const{editor:t,component:n,el:s,frameView:r}=e,{em:o,Components:i}=t;let c=n.getView(r.model);if((c==null?void 0:c.el)===s)return c;if(!c){const{ComponentView:d}=i,l=n.attributes.type||"default",u=((a=i.getType(l))==null?void 0:a.view)||d,y={...i.config,frameView:r,em:o},f=u.extend({initComponents(){},_createElement(){return s},_removeElement(){},__clearAttributes(){},render(){var p;return this._ensureElement(),this._setData(),this.renderAttributes(),(p=this.updateSrc)==null||p.call(this),this}});c=new f({el:s,config:y,model:n})}return c.el=s,c.render(),c}function ie(e,t){const{Components:n}=e,s=r=>{const{id:o,model:i}=r;n.addType(o,{model:{toJSON(...c){const a=i.prototype.toJSON.apply(this,c);return a.tagName=this.tagName,a}}})};n.getTypes().forEach(s),e.on("component:type:add",s),Object.entries(t.components||{}).forEach(([r,o])=>{var y,f;const{allowPropClassName:i,allowPropId:c,allowChildren:a}=o,d=!c&&!i,l=()=>({disabled:d}),u=()=>({disableClasses:!i,disableComponent:!c});n.addType(r,{isComponent:p=>(p==null?void 0:p.tagName)===r,model:{defaults:{type:r,traits:((y=o.props)==null?void 0:y.call(o))||[],droppable:!!a,stylable:!d,styleManager:l,selectorManager:u,...((f=o.model)==null?void 0:f.defaults)||{}}}})})}function D(e){var I;const{component:t,config:n,editor:s,frameView:r,onMount:o,tagName:i,children:c}=e,{key:a,view:d,connectDom:l}=re(e);h.useEffect(()=>{if(!d&&!o)return;const C=setTimeout(()=>{d&&(o==null||o(d),setTimeout(()=>d.postRender()))});return()=>clearTimeout(C)},[d]);const u=t.get("type")||"default",y=t.content,f=(I=n.components)==null?void 0:I[u],p=(f==null?void 0:f.component)||i||t.tagName||"div",g=t.components(),A=g.length?g.map(C=>m.jsx(D,{component:C,config:n,editor:s,frameView:r},C.cid)):[y||void 0],w=ee(t.getAttributes()),_=f==null?void 0:f.editorRender,L=[...A,c].filter(C=>C??!1),E=L.length?L:null;if(_)return m.jsx(_,{props:w,editor:s,component:t,connectDom:l,children:E});if(f!=null&&f.component)return m.jsx("gjs-wrapper",{ref:l,style:f.wrapperStyle,children:m.jsx(p,{...w,children:E})});if(t.isInstanceOf("textnode"))return y;const fe=t.isInstanceOf("text")?a:void 0;return h.createElement(p,{...w,ref:l,key:fe},t.get("void")?null:E)}const ae=e=>{const{frame:t,window:n,onMount:s,editor:r}=e,o=r.Canvas.events,{root:i}=t;try{const c=U.createRoot(n.document.body);c.render(m.jsx(le,{...e,component:i,onMount:s}));const a=()=>c.unmount();t.once(o.frameUnload,a),n.addEventListener("unload",a)}catch(c){console.warn(c)}return i.getView()};function le(e){const{editor:t,component:n,window:s,frameView:r,config:o,onMount:i}=e,c=s.document,a=o.rootComponent||h.Fragment,d=o.rootComponent?{editorProps:{doc:c,editor:t,frameView:r}}:{},l=(o==null?void 0:o.bodyAfter)||h.Fragment;return m.jsx(a,{...d,children:m.jsx(D,{tagName:"div",component:n,config:o,editor:t,frameView:r,onMount:i,children:m.jsx(l,{...d})})})}const pe="rendererReact",de=v.startup;return q(function(e,t={}){const{Blocks:n,Pages:s}=e,r=n.events,o=s.events;e.Canvas.config.customRenderer=c=>ae({...c,config:t}),e.Components.config.processor=c=>k({model:c,editor:e,config:t}),ie(e,t);const i=[[r.add,oe({editor:e,config:t})],[o.addBefore,se({editor:e,config:t})]];i.forEach(([c,a])=>e.on(c,a)),G({editor:e,licenseKey:t.licenseKey,plan:de,pluginName:pe,cleanup:()=>{e.Canvas.config.customRenderer=void 0,e.Components.config.processor=void 0,i.forEach(([c,a])=>e.off(c,a))}})})});
|
|
1
|
+
(function(y,h){typeof exports=="object"&&typeof module<"u"?module.exports=h(require("react/jsx-runtime"),require("react"),require("react-dom/client")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react","react-dom/client"],h):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_rendererReact=h(y.jsxRuntime,y.React,y.ReactDOMClient))})(this,function(y,h,j){"use strict";const N="app.grapesjs.com",T="app-stage.grapesjs.com",x=[N,"app2.grapesjs.com",T,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],W="license:check:start",M="license:check:end",$=()=>typeof window<"u",B=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?T:N}`}/${n?"platform-api":"api"}`,L=()=>{const e=$()&&window.location.hostname;return!!e&&(x.includes(e)||x.some(t=>e.endsWith(t)))},F=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),O=e=>typeof e=="string";function K(e){return typeof e=="function"}async function V({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:r,body:o}){const c=`${t||B({isDev:!1,isStage:!1})}${e}`,a={method:n,headers:{"Content-Type":"application/json",...s}};o&&(a.body=JSON.stringify(o));const d=r?new URLSearchParams(r).toString():"",u=d?`?${d}`:"",p=await fetch(`${c}${u}`,a);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{});const P={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function z(e){const t=e;return t.init=n=>s=>e(s,n),t}const q=e=>z(e);async function G({editor:e,plan:t,pluginName:n,licenseKey:s,onLicenseCheckResponse:r,cleanup:o}){let i="",c=!1;const a=L(),d=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),o()},u=(p={})=>{var A;const{error:m,sdkLicense:f}=p,l=(A=p.plan)==null?void 0:A.category;if(!(f||p.license)||m)d(m||"Invalid license");else if(l){const C=P[t],E=P[l];C>E&&d({pluginRequiredPlan:t,licensePlan:l})}};e.on(W,p=>{i=p==null?void 0:p.baseApiUrl,c=!0}),e.on(M,p=>{r==null||r(p),u(p)}),setTimeout(async()=>{if(!c){if(a)return;if(s){const p=await J({licenseKey:s,pluginName:n,baseApiUrl:i});r==null||r(p),p&&u(p)}else d("The `licenseKey` option not provided")}},2e3)}async function J(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await V({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}function H(e){const t={};for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const s=F(n);t[s]=e[n]}return t}const Z=(e,t)=>{const n=e.components||{};for(const s in n){const r=n[s];if(r.component===t)return{cmpConfig:r,type:s}}};function R(e){const t={};let n=!1;for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(typeof r=="string"||typeof r=="number"){const o=s.includes("-")?s.replace(/-([a-z])/g,i=>i[1].toUpperCase()):s;t[o]=r,n=!0}}return n?t:void 0}function Q(e){const t={};return e.split(";").forEach(n=>{if(!n.trim())return;const s=n.indexOf(":");if(s>0){const r=n.substring(0,s).trim(),o=n.substring(s+1).trim();if(r&&o){const i=r.replace(/-([a-z])/g,c=>c[1].toUpperCase());t[i]=o}}}),Object.keys(t).length>0?t:void 0}function X(e){if(e){if(typeof e=="object"&&!Array.isArray(e))return R(e);if(typeof e=="string"){let t=Q(e);if(!t)try{const n=JSON.parse(e);typeof n=="object"&&n!==null&&!Array.isArray(n)&&(t=R(n))}catch(n){console.error("Failed to parse style string as JSON",n)}return t}if(Array.isArray(e)){const t={};return e.forEach(n=>{if(typeof n=="object"&&n!==null){const s=n.name||n.property,r=n.value;if(typeof s=="string"&&s&&r!==void 0&&r!==""){const o=s.replace(/-([a-z])/g,i=>i[1].toUpperCase());t[o]=r}}}),Object.keys(t).length>0?t:void 0}}}function Y(e){return D[e]?D[e]:e.includes("-")?e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase()):e}function ee(e){var n;const t={};for(const[s,r]of Object.entries(e))if(s==="style")t.style=X(r);else if(s.startsWith("data-"))t[s]=r;else{const o=Y(s);((n=e.xmlns)==null?void 0:n.includes("svg"))||e.viewBox!==void 0||e.d!==void 0||ne.has(o)||o.startsWith("svg")?t[o]=r:!te.has(o)&&!o.startsWith("on")&&!o.startsWith("aria-")&&!o.startsWith("data-")?t[s]=r:t[o]=r}return t}const te=new Set(["className","id","style","href","src","alt","title","target","rel","type","name","value","placeholder","onClick","onChange","onSubmit","onBlur","onFocus","disabled","readOnly","checked","selected","multiple","width","height","maxLength","min","max","step","rows","cols","autoComplete","autoFocus","required","spellCheck","tabIndex","aria-label","aria-labelledby","aria-describedby","role"]),ne=new Set(["x","y","d","cx","cy","r","rx","ry","x1","x2","y1","y2","points","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeOpacity","fillOpacity","fillRule","clipRule","transform","viewBox","preserveAspectRatio","pathLength","vectorEffect","dominantBaseline","alignmentBaseline","textAnchor","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","baselineShift","opacity","mask","clipPath","overflow","pointerEvents"]),D={class:"className",for:"htmlFor","http-equiv":"httpEquiv","accept-charset":"acceptCharset","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","fill-rule":"fillRule","clip-rule":"clipRule","stroke-miterlimit":"strokeMiterlimit","stroke-dasharray":"strokeDasharray","stroke-opacity":"strokeOpacity","fill-opacity":"fillOpacity","font-family":"fontFamily","font-size":"fontSize","text-anchor":"textAnchor"},S=e=>(e==null?void 0:e.$$typeof)&&typeof e.props=="object";function oe(e){return t=>{const n=t.getContent();S(n)&&t.set({content:b({...e,model:n}),reactContent:n})}}const se=e=>t=>{const n=t.component;S(n)&&(t.component={components:b({...e,model:n})})};function b(e){const{model:t,editor:n,config:s}=e;if(S(t)){const r=t,o={},{type:i,props:c={}}=r,{children:a,className:d,style:u,...p}=c,m=l=>({type:"textnode",content:l}),f=typeof i=="symbol";if(K(i)){const l=Z(s,i);o.type=l==null?void 0:l.type}else n.Components.getType(i)?o.type=i:f||(o.tagName=i);if(d&&(o.classes=d),u&&(o.style=H(u)),Array.isArray(a)?o.components=a.map(l=>O(l)?m(l):b({...e,model:l})).filter(Boolean):O(a)&&(o.components=m(a)),Object.keys(p).length){const l=n.Parser.parserHtml.splitPropsFromAttr(p);o.attributes=l.attrs,Object.assign(o,l.props)}return o}}function re(e){const{component:t}=e,[n,s]=h.useState(0),[r,o]=h.useState();return h.useEffect(()=>{if(!t)return()=>{};const c=()=>s(l=>l+1),a=()=>{[...t.views].forEach(w=>w.remove()),o(void 0)},{em:d}=t,u=d.Components.events,m=[...["components","attributes","classes"].map(l=>`${u.update}:${l}`),"rerender"].join(" "),f=[u.removed,"rerender"].join(" ");return t.on(m,c),t.on(f,a),()=>{t.off(m,c),t.off(f,a),a()}},[t]),{key:n,view:r,connectDom:c=>{if(!c)return;const a=ce({...e,el:c});o(a)}}}function ce(e){var a;const{editor:t,component:n,el:s,frameView:r}=e,{em:o,Components:i}=t;let c=n.getView(r.model);if((c==null?void 0:c.el)===s)return c;if(!c){const{ComponentView:d}=i,u=n.attributes.type||"default",p=((a=i.getType(u))==null?void 0:a.view)||d,m={...i.config,frameView:r,em:o},f=p.extend({initComponents(){},_createElement(){return s},_removeElement(){},__clearAttributes(){},render(){var l;return this._ensureElement(),this._setData(),this.renderAttributes(),(l=this.updateSrc)==null||l.call(this),this}});c=new f({el:s,config:m,model:n})}return c.el=s,c.render(),c}function ie(e,t){const{Components:n}=e,s=r=>{const{id:o,model:i}=r;n.addType(o,{model:{toJSON(...c){const a=i.prototype.toJSON.apply(this,c);return a.tagName=this.tagName,a}}})};n.getTypes().forEach(s),e.on("component:type:add",s),Object.entries(t.components||{}).forEach(([r,o])=>{var m,f;const{allowPropClassName:i,allowPropId:c,allowChildren:a}=o,d=!c&&!i,u=()=>({disabled:d}),p=()=>({disableClasses:!i,disableComponent:!c});n.addType(r,{isComponent:l=>(l==null?void 0:l.tagName)===r,model:{defaults:{type:r,traits:((m=o.props)==null?void 0:m.call(o))||[],droppable:!!a,stylable:!d,styleManager:u,selectorManager:p,...((f=o.model)==null?void 0:f.defaults)||{}}}})})}function _(e){var U;const{component:t,config:n,editor:s,frameView:r,onMount:o,tagName:i,children:c}=e,{key:a,view:d,connectDom:u}=re(e);h.useEffect(()=>{if(!d&&!o)return;const v=setTimeout(()=>{d&&(o==null||o(d),setTimeout(()=>d.postRender()))});return()=>clearTimeout(v)},[d]);const p=t.get("type")||"default",m=t.content,f=(U=n.components)==null?void 0:U[p],l=(f==null?void 0:f.component)||i||t.tagName||"div",w=t.components(),A=w.length?w.map(v=>y.jsx(_,{component:v,config:n,editor:s,frameView:r},v.cid)):[m||void 0],C=ee(t.getAttributes()),E=f==null?void 0:f.editorRender,I=[...A,c].filter(v=>v??!1),k=I.length?I:null;if(E)return y.jsx(E,{props:C,editor:s,component:t,connectDom:u,children:k});if(f!=null&&f.component)return y.jsx("gjs-wrapper",{ref:u,style:f.wrapperStyle,children:y.jsx(l,{...C,children:k})});if(t.isInstanceOf("textnode"))return m;const fe=t.isInstanceOf("text")?a:void 0;return h.createElement(l,{...C,ref:u,key:fe},t.get("void")?null:k)}const ae=e=>{const{frame:t,window:n,onMount:s,editor:r}=e,o=r.Canvas.events,{root:i}=t;try{const c=j.createRoot(n.document.body);c.render(y.jsx(le,{...e,component:i,onMount:s}));const a=()=>c.unmount();t.once(o.frameUnload,a),n.addEventListener("unload",a)}catch(c){console.warn(c)}return i.getView()};function le(e){const{editor:t,component:n,window:s,frameView:r,config:o,onMount:i}=e,c=s.document,a=o.rootComponent||h.Fragment,d=o.rootComponent?{editorProps:{doc:c,editor:t,frameView:r}}:{},u=(o==null?void 0:o.bodyAfter)||h.Fragment;return y.jsx(a,{...d,children:y.jsx(_,{tagName:"div",component:n,config:o,editor:t,frameView:r,onMount:i,children:y.jsx(u,{...d})})})}const pe="rendererReact",de=g.startup;return q(function(e,t={}){const{Blocks:n,Pages:s}=e,r=n.events,o=s.events;e.Canvas.config.customRenderer=c=>ae({...c,config:t}),e.Components.config.processor=c=>b({model:c,editor:e,config:t}),ie(e,t);const i=[[r.add,oe({editor:e,config:t})],[o.addBefore,se({editor:e,config:t})]];i.forEach(([c,a])=>e.on(c,a)),G({editor:e,licenseKey:t.licenseKey,plan:de,pluginName:pe,cleanup:()=>{e.Canvas.config.customRenderer=void 0,e.Components.config.processor=void 0,i.forEach(([c,a])=>e.off(c,a))}})})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{}),m=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(m||{}),
|
|
1
|
+
"use strict";var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{}),m=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(m||{}),O=(t=>(t.dark="dark",t.light="light",t.auto="auto",t))(O||{});const I="app.grapesjs.com",L="app-stage.grapesjs.com",M="app2.grapesjs.com",N="app-stage2.grapesjs.com",R=[I,M,L,N,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],B="license:check:start",U="license:check:end",j=()=>typeof window<"u",W=({isDev:t,isStage:s,isPlatform:n})=>`${t?"":`https://${s?L:I}`}/${n?"platform-api":"api"}`,$=()=>{const t=j()&&window.location.hostname;return!!t&&(R.includes(t)||R.some(s=>t.endsWith(s)))};async function F({path:t,baseApiUrl:s,method:n="GET",headers:a={},params:r,body:c}){const l=`${s||W({isDev:!1,isStage:!1})}${t}`,i={method:n,headers:{"Content-Type":"application/json",...a}};c&&(i.body=JSON.stringify(c));const u=r?new URLSearchParams(r).toString():"",e=u?`?${u}`:"",o=await fetch(`${l}${e}`,i);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}const k={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function S(t){const s=t;return s.init=n=>a=>t(a,n),s}const K=t=>S(t);async function q({editor:t,plan:s,pluginName:n,licenseKey:a,onLicenseCheckResponse:r,cleanup:c}){let d="",l=!1;const i=$(),u=o=>{console.warn("Cleanup plugin:",n,"Reason:",o),c()},e=(o={})=>{var w;const{error:b,sdkLicense:x}=o,g=(w=o.plan)==null?void 0:w.category;if(!(x||o.license)||b)u(b||"Invalid license");else if(g){const p=k[s],P=k[g];p>P&&u({pluginRequiredPlan:s,licensePlan:g})}};t.on(B,o=>{d=o==null?void 0:o.baseApiUrl,l=!0}),t.on(U,o=>{r==null||r(o),e(o)}),setTimeout(async()=>{if(!l){if(i)return;if(a){const o=await H({licenseKey:a,pluginName:n,baseApiUrl:d});r==null||r(o),o&&e(o)}else u("The `licenseKey` option not provided")}},2e3)}async function H(t){const{licenseKey:s,pluginName:n,baseApiUrl:a}=t;try{return(await F({baseApiUrl:a,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}const z=(t,s,n)=>{const{doc:a=document}=n,r=n.target||a.head,c=r.querySelector(`style[${t}]`)||a.createElement("style");c.setAttribute(t,"true"),c.innerHTML=s,!r.contains(c)&&r.appendChild(c)},C=t=>t.dispatchEvent(new CustomEvent("input"));function V(t,s){if(!s)return()=>{};const n=t.Components.events,a=e=>t.getSelectedAll().includes(e),r=e=>e.isInstanceOf("text")&&!e.isChildOf("text"),c=e=>e.isChildOf("text"),d=e=>t.getEditing()===e,l=(e,o={})=>{e.trigger("focus",o.event)},i=(e,o)=>{a(e)&&r(e)&&!d(e)&&l(e,o)},u=(e,o)=>{if(a(e)&&!r(e)&&c(e)){const b=e.parents().find(x=>x.isInstanceOf("text"));b&&(l(b,o),setTimeout(()=>t.select(b),0))}};return t.on(n.select,i),t.on(n.selectBefore,u),()=>{t.off(n.select,i),t.off(n.selectBefore,u)}}const J="rteTinyMce",X=v.startup,Y=`
|
|
2
2
|
.tox .tox-toolbar,
|
|
3
3
|
.tox .tox-toolbar__overflow,
|
|
4
4
|
.tox .tox-toolbar__primary,
|
|
@@ -101,4 +101,4 @@
|
|
|
101
101
|
background-color: var(--gs-theme-cl-prm-bg1);
|
|
102
102
|
border-color: var(--gs-theme-cl-prm-bg3);
|
|
103
103
|
opacity: 0.75;
|
|
104
|
-
}`,
|
|
104
|
+
}`,E=new WeakMap,Q=(t,s)=>{E.set(t,s)},Z=t=>{E.delete(t)},T=t=>E.get(t),y=t=>{const s=t.target,n=s.closest(".tox"),a=s.matches(".ephox-snooker-resizer-bar");(n||a)&&t.stopPropagation()},D=t=>{t.stopPropagation(),t.preventDefault()},tt=(t,s)=>{const n=t.getDoc(),a=t.getWin();if(s!=null&&s.event){const{event:r}=s,{clientX:c,clientY:d}=r;let l;if(n.caretRangeFromPoint)l=n.caretRangeFromPoint(c,d);else if(n.caretPositionFromPoint){const i=n.caretPositionFromPoint(c,d);l=n.createRange(),l==null||l.setStart(i.offsetNode,i.offset)}if(l){const i=a.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(l),t.selection.setRng(l)}}else t.execCommand("SelectAll")},et=t=>{var u,e;const{el:s,editor:n,componentView:a}=t,r=n.runCommand(m.getStateTheme),c=a.model,d={target:s,inline:!0,skin:(r==null?void 0:r.theme)===O.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},l=((e=(u=t.pluginOpts)==null?void 0:u.loadConfig)==null?void 0:e.call(u,{config:d,editor:n,componentView:a,component:c}))||{};return{...d,...l}},A=(t,s=document)=>new Promise((n,a)=>{const r=Array.isArray(t)?[...t]:[t],{head:c}=s,d=l=>{if(l.length){const i=s.createElement("script");i.src=l.shift(),i.onload=d.bind(null,l),i.onerror=a,c.appendChild(i)}else n()};d(r)}),ot=function(t,s={}){const n={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...s},{cdnScript:a}=n,r=t.Canvas.events,c=!n.skipCustomTheme,d="gs-plg-tinymce-studio-theme",l=async(e,o)=>{const b=e.ownerDocument,x=b.defaultView,g=o==null?void 0:o.view;if(!x||!g){console.warn("Missing required data",{win:x,componentView:g});return}const h=et({el:e,editor:t,componentView:g,pluginOpts:n}),p=(await x.tinymce.init(h))[0];if(!p)return;const G=(await window.tinymce.init({...h,target:document.createElement("div")}))[0];return p.ui.show(),b.body.addEventListener("mousedown",y),document.body.addEventListener("mousedown",y),p.on("Change",()=>C(e)),p.on("blur",()=>p.ui.show()),p.on("OpenWindow",function(){var _;const f=(_=b.querySelector(".tox-dialog"))==null?void 0:_.closest(".tox");f&&(f==null?void 0:f.ownerDocument)!==document&&(document.body.appendChild(f),p.once("CloseWindow",()=>{f&&f.ownerDocument===document&&b.body.appendChild(f)}))}),e.addEventListener("dragstart",D,{capture:!0}),t.runCommand(m.setStateContextMenu,{enabled:!1}),tt(p,o),{rteEditor:p,rteEditorShallow:G}},i=(e,o)=>{e.ownerDocument.body.removeEventListener("mousedown",y),document.body.removeEventListener("mousedown",y),e.removeEventListener("dragstart",D,{capture:!0}),t.runCommand(m.setStateContextMenu,{enabled:!0}),o.rteEditor.destroy(),o.rteEditorShallow.destroy()};t.on(r.frameLoad,async({window:e})=>{const o=e.document;A(a,o)}),t.onReady(()=>{A(a,document),c&&z(d,Y,{target:document.body})}),t.setCustomRte({parseContent:!0,async enable(e,o,b){const x=T(e);if(x)return x.rteEditor;const g=await l(e,b);return g&&Q(e,g),g==null?void 0:g.rteEditor},disable(e){const o=T(e);o&&(Z(e),i(e,o))},getContent(e,o,b){var h;const x=T(e),g=x==null?void 0:x.rteEditor;return g&&!g.isDirty()?b.view.lastContent:g?(h=g.getContent)==null?void 0:h.call(g):e.innerHTML}});const u=V(t,n.enableOnClick);q({editor:t,licenseKey:n.licenseKey,plan:X,pluginName:J,cleanup:()=>{t.RichTextEditor.customRte=void 0,u()}})},nt=K(ot);module.exports=nt;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var v = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(v || {}), m = /* @__PURE__ */ ((t) => (t.toastAdd = "studio:toastAdd", t.toastRemove = "studio:toastRemove", t.dialogOpen = "studio:dialogOpen", t.dialogClose = "studio:dialogClose", t.dialogExportCode = "studio:dialogExportCode", t.sidebarLeftSet = "studio:sidebarLeft:set", t.sidebarLeftGet = "studio:sidebarLeft:get", t.sidebarLeftToggle = "studio:sidebarLeft:toggle", t.sidebarRightSet = "studio:sidebarRight:set", t.sidebarRightGet = "studio:sidebarRight:get", t.sidebarRightToggle = "studio:sidebarRight:toggle", t.sidebarTopSet = "studio:sidebarTop:set", t.sidebarTopGet = "studio:sidebarTop:get", t.sidebarTopToggle = "studio:sidebarTop:toggle", t.sidebarBottomSet = "studio:sidebarBottom:set", t.sidebarBottomGet = "studio:sidebarBottom:get", t.sidebarBottomToggle = "studio:sidebarBottom:toggle", t.symbolAdd = "studio:symbolAdd", t.symbolDetach = "studio:symbolDetach", t.symbolOverride = "studio:symbolOverride", t.symbolPropagateStyles = "studio:propagateStyles", t.getPagesConfig = "studio:getPagesConfig", t.setPagesConfig = "studio:setPagesConfig", t.getPageSettings = "studio:getPageSettings", t.setPageSettings = "studio:setPageSettings", t.clearPage = "studio:clearPage", t.projectFiles = "studio:projectFiles", t.validateCode = "studio:validateCode", t.canvasReload = "studio:canvasReload", t.getBlocksPanel = "studio:getBlocksPanel", t.setBlocksPanel = "studio:setBlocksPanel", t.getStateContextMenu = "studio:getStateContextMenu", t.setStateContextMenu = "studio:setStateContextMenu", t.contextMenuComponent = "studio:contextMenuComponent", t.layoutAdd = "studio:layoutAdd", t.layoutRemove = "studio:layoutRemove", t.layoutToggle = "studio:layoutToggle", t.layoutUpdate = "studio:layoutUpdate", t.layoutGet = "studio:layoutGet", t.layoutConfigGet = "studio:layoutConfigGet", t.layoutConfigSet = "studio:layoutConfigSet", t.layoutComponentAdd = "studio:layoutComponentAdd", t.layoutComponentGet = "studio:layoutComponentGet", t.layoutComponentRemove = "studio:layoutComponentRemove", t.layoutComponentRender = "studio:layoutComponentRender", t.getStateTheme = "studio:getStateTheme", t.setStateTheme = "studio:setStateTheme", t.assetProviderGet = "studio:assetProviderGet", t.assetProviderAdd = "studio:assetProviderAdd", t.assetProviderRemove = "studio:assetProviderRemove", t.fontGet = "studio:fontGet", t.fontAdd = "studio:fontAdd", t.fontRemove = "studio:fontRemove", t.fontManagerOpen = "studio:fontManagerOpen", t.menuFontLoad = "studio:menuFontLoad", t.toggleStateDataSource = "studio:toggleStateDataSource", t.getStateDataSource = "studio:getStateDataSource", t.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", t.dataSourceSetImporter = "studio:dataSourceSetImporter", t.dataSourceSetExporter = "studio:dataSourceSetExporter", t.setDragAbsolute = "studio:setDragAbsolute", t))(m || {}),
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
G,
|
|
5
|
-
O,
|
|
1
|
+
var v = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(v || {}), m = /* @__PURE__ */ ((t) => (t.toastAdd = "studio:toastAdd", t.toastRemove = "studio:toastRemove", t.dialogOpen = "studio:dialogOpen", t.dialogClose = "studio:dialogClose", t.dialogExportCode = "studio:dialogExportCode", t.sidebarLeftSet = "studio:sidebarLeft:set", t.sidebarLeftGet = "studio:sidebarLeft:get", t.sidebarLeftToggle = "studio:sidebarLeft:toggle", t.sidebarRightSet = "studio:sidebarRight:set", t.sidebarRightGet = "studio:sidebarRight:get", t.sidebarRightToggle = "studio:sidebarRight:toggle", t.sidebarTopSet = "studio:sidebarTop:set", t.sidebarTopGet = "studio:sidebarTop:get", t.sidebarTopToggle = "studio:sidebarTop:toggle", t.sidebarBottomSet = "studio:sidebarBottom:set", t.sidebarBottomGet = "studio:sidebarBottom:get", t.sidebarBottomToggle = "studio:sidebarBottom:toggle", t.symbolAdd = "studio:symbolAdd", t.symbolDetach = "studio:symbolDetach", t.symbolOverride = "studio:symbolOverride", t.symbolPropagateStyles = "studio:propagateStyles", t.getPagesConfig = "studio:getPagesConfig", t.setPagesConfig = "studio:setPagesConfig", t.getPageSettings = "studio:getPageSettings", t.setPageSettings = "studio:setPageSettings", t.clearPage = "studio:clearPage", t.projectFiles = "studio:projectFiles", t.validateCode = "studio:validateCode", t.canvasReload = "studio:canvasReload", t.getBlocksPanel = "studio:getBlocksPanel", t.setBlocksPanel = "studio:setBlocksPanel", t.getStateContextMenu = "studio:getStateContextMenu", t.setStateContextMenu = "studio:setStateContextMenu", t.contextMenuComponent = "studio:contextMenuComponent", t.layoutAdd = "studio:layoutAdd", t.layoutRemove = "studio:layoutRemove", t.layoutToggle = "studio:layoutToggle", t.layoutUpdate = "studio:layoutUpdate", t.layoutGet = "studio:layoutGet", t.layoutConfigGet = "studio:layoutConfigGet", t.layoutConfigSet = "studio:layoutConfigSet", t.layoutComponentAdd = "studio:layoutComponentAdd", t.layoutComponentGet = "studio:layoutComponentGet", t.layoutComponentRemove = "studio:layoutComponentRemove", t.layoutComponentRender = "studio:layoutComponentRender", t.getStateTheme = "studio:getStateTheme", t.setStateTheme = "studio:setStateTheme", t.assetProviderGet = "studio:assetProviderGet", t.assetProviderAdd = "studio:assetProviderAdd", t.assetProviderRemove = "studio:assetProviderRemove", t.fontGet = "studio:fontGet", t.fontAdd = "studio:fontAdd", t.fontRemove = "studio:fontRemove", t.fontManagerOpen = "studio:fontManagerOpen", t.menuFontLoad = "studio:menuFontLoad", t.toggleStateDataSource = "studio:toggleStateDataSource", t.getStateDataSource = "studio:getStateDataSource", t.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", t.dataSourceSetImporter = "studio:dataSourceSetImporter", t.dataSourceSetExporter = "studio:dataSourceSetExporter", t.setDragAbsolute = "studio:setDragAbsolute", t))(m || {}), O = /* @__PURE__ */ ((t) => (t.dark = "dark", t.light = "light", t.auto = "auto", t))(O || {});
|
|
2
|
+
const I = "app.grapesjs.com", L = "app-stage.grapesjs.com", M = "app2.grapesjs.com", N = "app-stage2.grapesjs.com", R = [
|
|
3
|
+
I,
|
|
6
4
|
M,
|
|
5
|
+
L,
|
|
6
|
+
N,
|
|
7
7
|
"localhost",
|
|
8
8
|
"127.0.0.1",
|
|
9
9
|
".local-credentialless.webcontainer.io",
|
|
@@ -12,115 +12,120 @@ const L = "app.grapesjs.com", O = "app-stage.grapesjs.com", G = "app2.grapesjs.c
|
|
|
12
12
|
// For stackblitz.com demos
|
|
13
13
|
"-sandpack.codesandbox.io"
|
|
14
14
|
// For Sandpack demos
|
|
15
|
-
],
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
], B = "license:check:start", U = "license:check:end", j = () => typeof window < "u", W = ({
|
|
16
|
+
isDev: t,
|
|
17
|
+
isStage: s,
|
|
18
|
+
isPlatform: n
|
|
19
|
+
}) => `${t ? "" : `https://${s ? L : I}`}/${n ? "platform-api" : "api"}`, $ = () => {
|
|
20
|
+
const t = j() && window.location.hostname;
|
|
21
|
+
return !!t && (R.includes(t) || R.some((s) => t.endsWith(s)));
|
|
18
22
|
};
|
|
19
|
-
async function
|
|
23
|
+
async function F({
|
|
20
24
|
path: t,
|
|
21
|
-
baseApiUrl:
|
|
22
|
-
method:
|
|
23
|
-
headers:
|
|
24
|
-
params:
|
|
25
|
-
body:
|
|
25
|
+
baseApiUrl: s,
|
|
26
|
+
method: n = "GET",
|
|
27
|
+
headers: a = {},
|
|
28
|
+
params: r,
|
|
29
|
+
body: c
|
|
26
30
|
}) {
|
|
27
|
-
const
|
|
28
|
-
method:
|
|
31
|
+
const l = `${s || W({ isDev: !1, isStage: !1 })}${t}`, i = {
|
|
32
|
+
method: n,
|
|
29
33
|
headers: {
|
|
30
34
|
"Content-Type": "application/json",
|
|
31
|
-
...
|
|
35
|
+
...a
|
|
32
36
|
}
|
|
33
37
|
};
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
throw new Error(`HTTP error! status: ${
|
|
38
|
-
return
|
|
38
|
+
c && (i.body = JSON.stringify(c));
|
|
39
|
+
const u = r ? new URLSearchParams(r).toString() : "", e = u ? `?${u}` : "", o = await fetch(`${l}${e}`, i);
|
|
40
|
+
if (!o.ok)
|
|
41
|
+
throw new Error(`HTTP error! status: ${o.status}`);
|
|
42
|
+
return o.json();
|
|
39
43
|
}
|
|
40
|
-
const
|
|
44
|
+
const k = {
|
|
41
45
|
[v.free]: 0,
|
|
42
46
|
[v.startup]: 10,
|
|
43
47
|
[v.business]: 20,
|
|
44
48
|
[v.enterprise]: 30
|
|
45
49
|
};
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
return
|
|
50
|
+
function S(t) {
|
|
51
|
+
const s = t;
|
|
52
|
+
return s.init = (n) => (a) => t(a, n), s;
|
|
49
53
|
}
|
|
50
|
-
const
|
|
51
|
-
async function
|
|
54
|
+
const K = (t) => /* @__PURE__ */ S(t);
|
|
55
|
+
async function q({
|
|
52
56
|
editor: t,
|
|
53
|
-
plan:
|
|
54
|
-
pluginName:
|
|
55
|
-
licenseKey:
|
|
56
|
-
|
|
57
|
+
plan: s,
|
|
58
|
+
pluginName: n,
|
|
59
|
+
licenseKey: a,
|
|
60
|
+
onLicenseCheckResponse: r,
|
|
61
|
+
cleanup: c
|
|
57
62
|
}) {
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
console.warn("Cleanup plugin:",
|
|
61
|
-
},
|
|
62
|
-
var
|
|
63
|
-
const { error:
|
|
64
|
-
if (!(x ||
|
|
65
|
-
|
|
66
|
-
else if (
|
|
67
|
-
const
|
|
68
|
-
|
|
63
|
+
let d = "", l = !1;
|
|
64
|
+
const i = $(), u = (o) => {
|
|
65
|
+
console.warn("Cleanup plugin:", n, "Reason:", o), c();
|
|
66
|
+
}, e = (o = {}) => {
|
|
67
|
+
var w;
|
|
68
|
+
const { error: b, sdkLicense: x } = o, g = (w = o.plan) == null ? void 0 : w.category;
|
|
69
|
+
if (!(x || o.license) || b)
|
|
70
|
+
u(b || "Invalid license");
|
|
71
|
+
else if (g) {
|
|
72
|
+
const p = k[s], P = k[g];
|
|
73
|
+
p > P && u({ pluginRequiredPlan: s, licensePlan: g });
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
t.on(
|
|
72
|
-
|
|
73
|
-
}), t.on(
|
|
74
|
-
|
|
76
|
+
t.on(B, (o) => {
|
|
77
|
+
d = o == null ? void 0 : o.baseApiUrl, l = !0;
|
|
78
|
+
}), t.on(U, (o) => {
|
|
79
|
+
r == null || r(o), e(o);
|
|
75
80
|
}), setTimeout(async () => {
|
|
76
|
-
if (!
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
+
if (!l) {
|
|
82
|
+
if (i) return;
|
|
83
|
+
if (a) {
|
|
84
|
+
const o = await H({ licenseKey: a, pluginName: n, baseApiUrl: d });
|
|
85
|
+
r == null || r(o), o && e(o);
|
|
81
86
|
} else
|
|
82
|
-
|
|
87
|
+
u("The `licenseKey` option not provided");
|
|
83
88
|
}
|
|
84
89
|
}, 2e3);
|
|
85
90
|
}
|
|
86
|
-
async function
|
|
87
|
-
const { licenseKey:
|
|
91
|
+
async function H(t) {
|
|
92
|
+
const { licenseKey: s, pluginName: n, baseApiUrl: a } = t;
|
|
88
93
|
try {
|
|
89
|
-
return (await
|
|
90
|
-
baseApiUrl:
|
|
91
|
-
path: `/sdk/${
|
|
94
|
+
return (await F({
|
|
95
|
+
baseApiUrl: a,
|
|
96
|
+
path: `/sdk/${s || "na"}`,
|
|
92
97
|
method: "POST",
|
|
93
98
|
params: {
|
|
94
99
|
d: window.location.hostname,
|
|
95
|
-
pn:
|
|
100
|
+
pn: n
|
|
96
101
|
}
|
|
97
102
|
})).result || {};
|
|
98
|
-
} catch (
|
|
99
|
-
return console.error("Error during SDK license check:",
|
|
103
|
+
} catch (r) {
|
|
104
|
+
return console.error("Error during SDK license check:", r), !1;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
const
|
|
103
|
-
const { doc:
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
function
|
|
107
|
-
if (!
|
|
107
|
+
const z = (t, s, n) => {
|
|
108
|
+
const { doc: a = document } = n, r = n.target || a.head, c = r.querySelector(`style[${t}]`) || a.createElement("style");
|
|
109
|
+
c.setAttribute(t, "true"), c.innerHTML = s, !r.contains(c) && r.appendChild(c);
|
|
110
|
+
}, C = (t) => t.dispatchEvent(new CustomEvent("input"));
|
|
111
|
+
function V(t, s) {
|
|
112
|
+
if (!s) return () => {
|
|
108
113
|
};
|
|
109
|
-
const
|
|
110
|
-
e.trigger("focus",
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
-
|
|
114
|
+
const n = t.Components.events, a = (e) => t.getSelectedAll().includes(e), r = (e) => e.isInstanceOf("text") && !e.isChildOf("text"), c = (e) => e.isChildOf("text"), d = (e) => t.getEditing() === e, l = (e, o = {}) => {
|
|
115
|
+
e.trigger("focus", o.event);
|
|
116
|
+
}, i = (e, o) => {
|
|
117
|
+
a(e) && r(e) && !d(e) && l(e, o);
|
|
118
|
+
}, u = (e, o) => {
|
|
119
|
+
if (a(e) && !r(e) && c(e)) {
|
|
120
|
+
const b = e.parents().find((x) => x.isInstanceOf("text"));
|
|
121
|
+
b && (l(b, o), setTimeout(() => t.select(b), 0));
|
|
117
122
|
}
|
|
118
123
|
};
|
|
119
|
-
return t.on(
|
|
120
|
-
t.off(
|
|
124
|
+
return t.on(n.select, i), t.on(n.selectBefore, u), () => {
|
|
125
|
+
t.off(n.select, i), t.off(n.selectBefore, u);
|
|
121
126
|
};
|
|
122
127
|
}
|
|
123
|
-
const
|
|
128
|
+
const J = "rteTinyMce", X = v.startup, Y = `
|
|
124
129
|
.tox .tox-toolbar,
|
|
125
130
|
.tox .tox-toolbar__overflow,
|
|
126
131
|
.tox .tox-toolbar__primary,
|
|
@@ -223,38 +228,38 @@ const V = "rteTinyMce", J = v.startup, X = `
|
|
|
223
228
|
background-color: var(--gs-theme-cl-prm-bg1);
|
|
224
229
|
border-color: var(--gs-theme-cl-prm-bg3);
|
|
225
230
|
opacity: 0.75;
|
|
226
|
-
}`,
|
|
227
|
-
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
},
|
|
231
|
-
const
|
|
232
|
-
(
|
|
233
|
-
},
|
|
231
|
+
}`, E = /* @__PURE__ */ new WeakMap(), Q = (t, s) => {
|
|
232
|
+
E.set(t, s);
|
|
233
|
+
}, Z = (t) => {
|
|
234
|
+
E.delete(t);
|
|
235
|
+
}, T = (t) => E.get(t), y = (t) => {
|
|
236
|
+
const s = t.target, n = s.closest(".tox"), a = s.matches(".ephox-snooker-resizer-bar");
|
|
237
|
+
(n || a) && t.stopPropagation();
|
|
238
|
+
}, D = (t) => {
|
|
234
239
|
t.stopPropagation(), t.preventDefault();
|
|
235
|
-
},
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
const { event:
|
|
239
|
-
let
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
else if (
|
|
243
|
-
const
|
|
244
|
-
|
|
240
|
+
}, tt = (t, s) => {
|
|
241
|
+
const n = t.getDoc(), a = t.getWin();
|
|
242
|
+
if (s != null && s.event) {
|
|
243
|
+
const { event: r } = s, { clientX: c, clientY: d } = r;
|
|
244
|
+
let l;
|
|
245
|
+
if (n.caretRangeFromPoint)
|
|
246
|
+
l = n.caretRangeFromPoint(c, d);
|
|
247
|
+
else if (n.caretPositionFromPoint) {
|
|
248
|
+
const i = n.caretPositionFromPoint(c, d);
|
|
249
|
+
l = n.createRange(), l == null || l.setStart(i.offsetNode, i.offset);
|
|
245
250
|
}
|
|
246
|
-
if (
|
|
247
|
-
const
|
|
248
|
-
|
|
251
|
+
if (l) {
|
|
252
|
+
const i = a.getSelection();
|
|
253
|
+
i == null || i.removeAllRanges(), i == null || i.addRange(l), t.selection.setRng(l);
|
|
249
254
|
}
|
|
250
255
|
} else
|
|
251
256
|
t.execCommand("SelectAll");
|
|
252
|
-
},
|
|
253
|
-
var
|
|
254
|
-
const { el:
|
|
255
|
-
target:
|
|
257
|
+
}, et = (t) => {
|
|
258
|
+
var u, e;
|
|
259
|
+
const { el: s, editor: n, componentView: a } = t, r = n.runCommand(m.getStateTheme), c = a.model, d = {
|
|
260
|
+
target: s,
|
|
256
261
|
inline: !0,
|
|
257
|
-
skin: (
|
|
262
|
+
skin: (r == null ? void 0 : r.theme) === O.dark ? "oxide-dark" : "oxide",
|
|
258
263
|
menubar: !1,
|
|
259
264
|
image_advtab: !0,
|
|
260
265
|
paste_data_images: !0,
|
|
@@ -268,86 +273,86 @@ const V = "rteTinyMce", J = v.startup, X = `
|
|
|
268
273
|
plugins: "advlist autolink lists link image media table",
|
|
269
274
|
toolbar_mode: "sliding",
|
|
270
275
|
toolbar: "bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"
|
|
271
|
-
},
|
|
276
|
+
}, l = ((e = (u = t.pluginOpts) == null ? void 0 : u.loadConfig) == null ? void 0 : e.call(u, { config: d, editor: n, componentView: a, component: c })) || {};
|
|
272
277
|
return {
|
|
273
278
|
...d,
|
|
274
|
-
...
|
|
279
|
+
...l
|
|
275
280
|
};
|
|
276
|
-
},
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
+
}, A = (t, s = document) => new Promise((n, a) => {
|
|
282
|
+
const r = Array.isArray(t) ? [...t] : [t], { head: c } = s, d = (l) => {
|
|
283
|
+
if (l.length) {
|
|
284
|
+
const i = s.createElement("script");
|
|
285
|
+
i.src = l.shift(), i.onload = d.bind(null, l), i.onerror = a, c.appendChild(i);
|
|
281
286
|
} else
|
|
282
|
-
|
|
287
|
+
n();
|
|
283
288
|
};
|
|
284
|
-
d(
|
|
285
|
-
}),
|
|
286
|
-
const
|
|
289
|
+
d(r);
|
|
290
|
+
}), ot = function(t, s = {}) {
|
|
291
|
+
const n = {
|
|
287
292
|
cdnScript: "https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",
|
|
288
|
-
...
|
|
289
|
-
}, { cdnScript:
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
console.warn("Missing required data", { win:
|
|
293
|
+
...s
|
|
294
|
+
}, { cdnScript: a } = n, r = t.Canvas.events, c = !n.skipCustomTheme, d = "gs-plg-tinymce-studio-theme", l = async (e, o) => {
|
|
295
|
+
const b = e.ownerDocument, x = b.defaultView, g = o == null ? void 0 : o.view;
|
|
296
|
+
if (!x || !g) {
|
|
297
|
+
console.warn("Missing required data", { win: x, componentView: g });
|
|
293
298
|
return;
|
|
294
299
|
}
|
|
295
|
-
const
|
|
300
|
+
const h = et({
|
|
296
301
|
el: e,
|
|
297
302
|
editor: t,
|
|
298
303
|
componentView: g,
|
|
299
|
-
pluginOpts:
|
|
300
|
-
}), p = (await
|
|
304
|
+
pluginOpts: n
|
|
305
|
+
}), p = (await x.tinymce.init(h))[0];
|
|
301
306
|
if (!p) return;
|
|
302
|
-
const
|
|
303
|
-
...
|
|
307
|
+
const G = (await window.tinymce.init({
|
|
308
|
+
...h,
|
|
304
309
|
target: document.createElement("div")
|
|
305
310
|
}))[0];
|
|
306
|
-
return p.ui.show(),
|
|
307
|
-
var
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
+
return p.ui.show(), b.body.addEventListener("mousedown", y), document.body.addEventListener("mousedown", y), p.on("Change", () => C(e)), p.on("blur", () => p.ui.show()), p.on("OpenWindow", function() {
|
|
312
|
+
var _;
|
|
313
|
+
const f = (_ = b.querySelector(".tox-dialog")) == null ? void 0 : _.closest(".tox");
|
|
314
|
+
f && (f == null ? void 0 : f.ownerDocument) !== document && (document.body.appendChild(f), p.once("CloseWindow", () => {
|
|
315
|
+
f && f.ownerDocument === document && b.body.appendChild(f);
|
|
311
316
|
}));
|
|
312
|
-
}), e.addEventListener("dragstart",
|
|
313
|
-
},
|
|
314
|
-
e.ownerDocument.body.removeEventListener("mousedown", y), document.body.removeEventListener("mousedown", y), e.removeEventListener("dragstart",
|
|
317
|
+
}), e.addEventListener("dragstart", D, { capture: !0 }), t.runCommand(m.setStateContextMenu, { enabled: !1 }), tt(p, o), { rteEditor: p, rteEditorShallow: G };
|
|
318
|
+
}, i = (e, o) => {
|
|
319
|
+
e.ownerDocument.body.removeEventListener("mousedown", y), document.body.removeEventListener("mousedown", y), e.removeEventListener("dragstart", D, { capture: !0 }), t.runCommand(m.setStateContextMenu, { enabled: !0 }), o.rteEditor.destroy(), o.rteEditorShallow.destroy();
|
|
315
320
|
};
|
|
316
|
-
t.on(
|
|
317
|
-
const
|
|
318
|
-
|
|
321
|
+
t.on(r.frameLoad, async ({ window: e }) => {
|
|
322
|
+
const o = e.document;
|
|
323
|
+
A(a, o);
|
|
319
324
|
}), t.onReady(() => {
|
|
320
|
-
|
|
325
|
+
A(a, document), c && z(d, Y, { target: document.body });
|
|
321
326
|
}), t.setCustomRte({
|
|
322
327
|
parseContent: !0,
|
|
323
328
|
// @ts-expect-error - Type 'CustomRteOptions' is missing the following properties from type 'CustomRteOptions': editor, component, el
|
|
324
|
-
async enable(e,
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
const g = await
|
|
328
|
-
return g &&
|
|
329
|
+
async enable(e, o, b) {
|
|
330
|
+
const x = T(e);
|
|
331
|
+
if (x) return x.rteEditor;
|
|
332
|
+
const g = await l(e, b);
|
|
333
|
+
return g && Q(e, g), g == null ? void 0 : g.rteEditor;
|
|
329
334
|
},
|
|
330
335
|
disable(e) {
|
|
331
|
-
const
|
|
332
|
-
|
|
336
|
+
const o = T(e);
|
|
337
|
+
o && (Z(e), i(e, o));
|
|
333
338
|
},
|
|
334
|
-
getContent(e,
|
|
335
|
-
var
|
|
336
|
-
const
|
|
337
|
-
return g && !g.isDirty() ?
|
|
339
|
+
getContent(e, o, b) {
|
|
340
|
+
var h;
|
|
341
|
+
const x = T(e), g = x == null ? void 0 : x.rteEditor;
|
|
342
|
+
return g && !g.isDirty() ? b.view.lastContent : g ? (h = g.getContent) == null ? void 0 : h.call(g) : e.innerHTML;
|
|
338
343
|
}
|
|
339
344
|
});
|
|
340
|
-
const
|
|
341
|
-
|
|
345
|
+
const u = V(t, n.enableOnClick);
|
|
346
|
+
q({
|
|
342
347
|
editor: t,
|
|
343
|
-
licenseKey:
|
|
344
|
-
plan:
|
|
345
|
-
pluginName:
|
|
348
|
+
licenseKey: n.licenseKey,
|
|
349
|
+
plan: X,
|
|
350
|
+
pluginName: J,
|
|
346
351
|
cleanup: () => {
|
|
347
|
-
t.RichTextEditor.customRte = void 0,
|
|
352
|
+
t.RichTextEditor.customRte = void 0, u();
|
|
348
353
|
}
|
|
349
354
|
});
|
|
350
|
-
}, rt =
|
|
355
|
+
}, rt = K(ot);
|
|
351
356
|
export {
|
|
352
357
|
rt as default
|
|
353
358
|
};
|