@grapesjs/studio-sdk-plugins 1.0.21 → 1.0.22
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/animationComponent/components/Animation.d.ts +6 -0
- package/dist/animationComponent/components/AnimationGroup.d.ts +4 -0
- package/dist/animationComponent/index.cjs.d.ts +3 -0
- package/dist/animationComponent/index.cjs.js +507 -0
- package/dist/animationComponent/index.d.ts +3 -0
- package/dist/animationComponent/index.es.d.ts +3 -0
- package/dist/animationComponent/index.es.js +1111 -0
- package/dist/animationComponent/index.umd.js +507 -0
- package/dist/animationComponent/shared.d.ts +3 -0
- package/dist/animationComponent/types.d.ts +28 -0
- package/dist/animationComponent/typesSchema.d.ts +48 -0
- package/dist/animationComponent/utils.d.ts +19 -0
- package/dist/dataSourceEjs/EjsExporter.d.ts +13 -0
- package/dist/dataSourceEjs/EjsImporter.d.ts +29 -0
- package/dist/dataSourceEjs/index.cjs.d.ts +2 -2
- package/dist/dataSourceEjs/index.cjs.js +24 -3
- package/dist/dataSourceEjs/index.d.ts +2 -2
- package/dist/dataSourceEjs/index.es.d.ts +2 -2
- package/dist/dataSourceEjs/index.es.js +697 -114
- package/dist/dataSourceEjs/index.umd.js +24 -3
- package/dist/dataSourceEjs/shared.d.ts +3 -0
- package/dist/dataSourceEjs/types.d.ts +2 -2
- package/dist/dataSourceEjs/typesSchema.d.ts +3 -0
- package/dist/dataSourceHandlebars/HandlebarsExporter.d.ts +16 -0
- package/dist/dataSourceHandlebars/HandlebarsImporter.d.ts +20 -0
- package/dist/dataSourceHandlebars/helperImplementations.d.ts +1 -0
- package/dist/dataSourceHandlebars/index.cjs.js +20 -1
- package/dist/dataSourceHandlebars/index.es.js +401 -99
- package/dist/dataSourceHandlebars/index.umd.js +20 -1
- package/dist/dataSourceHandlebars/shared.d.ts +3 -0
- package/dist/dataSourceHandlebars/types.d.ts +2 -2
- package/dist/dataSourceHandlebars/typesSchema.d.ts +3 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +29 -29
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +64 -64
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +587 -51
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +4809 -3046
- package/dist/index.umd.js +584 -48
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +59 -59
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +136 -131
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +67 -67
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +14 -14
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/utilsDataSources.d.ts +28 -0
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +26 -26
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +2 -1
- package/dist/dataSourceEjs/EjsStrategy.d.ts +0 -15
- package/dist/dataSourceHandlebars/HandlebarsStrategy.d.ts +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(h||{}),m=(t=>(t.toastAdd="studio:toastAdd",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.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||{}),L=(t=>(t.dark="dark",t.light="light",t.auto="auto",t))(L||{});const A="app.grapesjs.com",I="app-stage.grapesjs.com",R=[A,I,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],G="license:check:start",M="license:check:end",B=()=>typeof window<"u",N=({isDev:t,isStage:n})=>`${t?"":`https://${n?I:A}`}/api`,S=()=>{const t=B()&&window.location.hostname;return!!t&&(R.includes(t)||R.some(n=>t.endsWith(n)))};async function U({path:t,baseApiUrl:n,method:o="GET",headers:r={},params:i,body:l}){const c=`${n||N({isDev:!1,isStage:!1})}${t}`,a={method:o,headers:{"Content-Type":"application/json",...r}};l&&(a.body=JSON.stringify(l));const u=i?new URLSearchParams(i).toString():"",e=u?`?${u}`:"",s=await fetch(`${c}${e}`,a);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}const P={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function W(t){const n=t;return n.init=o=>r=>t(r,o),n}const j=t=>W(t);async function F({editor:t,plan:n,pluginName:o,licenseKey:r,cleanup:i}){let l="",g=!1;const c=S(),a=e=>{console.warn("Cleanup plugin:",o,"Reason:",e),i()},u=(e={})=>{var v;const{error:s,sdkLicense:d}=e,b=(v=e.plan)==null?void 0:v.category;if(!(d||e.license)||s)a(s||"Invalid license");else if(b){const E=P[n],x=P[b];E>x&&a({pluginRequiredPlan:n,licensePlan:b})}};t.on(G,e=>{l=e==null?void 0:e.baseApiUrl,g=!0}),t.on(M,e=>{u(e)}),setTimeout(async()=>{if(!g){if(c)return;if(r){const e=await $({licenseKey:r,pluginName:o,baseApiUrl:l});e&&u(e)}else a("The `licenseKey` option not provided")}},2e3)}async function $(t){const{licenseKey:n,pluginName:o,baseApiUrl:r}=t;try{return(await U({baseApiUrl:r,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const C=(t,n,o)=>{const{doc:r=document}=o,i=o.target||r.head,l=i.querySelector(`style[${t}]`)||r.createElement("style");l.setAttribute(t,"true"),l.innerHTML=n,!i.contains(l)&&i.appendChild(l)},K=t=>t.dispatchEvent(new CustomEvent("input"));function q(t,n){if(!n)return()=>{};const o=t.Components.events,r=e=>t.getSelectedAll().includes(e),i=e=>e.isInstanceOf("text")&&!e.isChildOf("text"),l=e=>e.isChildOf("text"),g=e=>t.getEditing()===e,c=(e,s={})=>{e.trigger("focus",s.event)},a=(e,s)=>{r(e)&&i(e)&&!g(e)&&c(e,s)},u=(e,s)=>{if(r(e)&&!i(e)&&l(e)){const d=e.parents().find(b=>b.isInstanceOf("text"));d&&(c(d,s),setTimeout(()=>t.select(d),0))}};return t.on(o.select,a),t.on(o.selectBefore,u),()=>{t.off(o.select,a),t.off(o.selectBefore,u)}}const H="rteTinyMce",z=h.startup,V=`
|
|
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
|
-
}`,T=new WeakMap,J=(t,n)=>{T.set(t,n)},X=t=>{T.delete(t)},w=t=>T.get(t),y=t=>{const n=t.target,o=n.closest(".tox"),r=n.matches(".ephox-snooker-resizer-bar");(o||r)&&t.stopPropagation()},_=t=>{t.stopPropagation(),t.preventDefault()},Y=(t,n)=>{const o=t.getDoc(),r=t.getWin();if(n!=null&&n.event){const{event:
|
|
104
|
+
}`,T=new WeakMap,J=(t,n)=>{T.set(t,n)},X=t=>{T.delete(t)},w=t=>T.get(t),y=t=>{const n=t.target,o=n.closest(".tox"),r=n.matches(".ephox-snooker-resizer-bar");(o||r)&&t.stopPropagation()},_=t=>{t.stopPropagation(),t.preventDefault()},Y=(t,n)=>{const o=t.getDoc(),r=t.getWin();if(n!=null&&n.event){const{event:i}=n,{clientX:l,clientY:g}=i;let c;if(o.caretRangeFromPoint)c=o.caretRangeFromPoint(l,g);else if(o.caretPositionFromPoint){const a=o.caretPositionFromPoint(l,g);c=o.createRange(),c==null||c.setStart(a.offsetNode,a.offset)}if(c){const a=r.getSelection();a==null||a.removeAllRanges(),a==null||a.addRange(c),t.selection.setRng(c)}}else t.execCommand("SelectAll")},Q=t=>{var u,e;const{el:n,editor:o,componentView:r}=t,i=o.runCommand(m.getStateTheme),l=r.model,g={target:n,inline:!0,skin:(i==null?void 0:i.theme)===L.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"},c=((e=(u=t.pluginOpts)==null?void 0:u.loadConfig)==null?void 0:e.call(u,{config:g,editor:o,componentView:r,component:l}))||{};return{...g,...c}},D=(t,n=document)=>new Promise((o,r)=>{const i=Array.isArray(t)?[...t]:[t],{head:l}=n,g=c=>{if(c.length){const a=n.createElement("script");a.src=c.shift(),a.onload=g.bind(null,c),a.onerror=r,l.appendChild(a)}else o()};g(i)}),Z=function(t,n={}){const o={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...n},{cdnScript:r}=o,i=t.Canvas.events,l=!o.skipCustomTheme,g="gs-plg-tinymce-studio-theme",c=async(e,s)=>{const d=e.ownerDocument,b=d.defaultView,f=s==null?void 0:s.view;if(!b||!f){console.warn("Missing required data",{win:b,componentView:f});return}const v=Q({el:e,editor:t,componentView:f,pluginOpts:o}),x=(await b.tinymce.init(v))[0];if(!x)return;const O=(await window.tinymce.init({...v,target:document.createElement("div")}))[0];return x.ui.show(),d.body.addEventListener("mousedown",y),document.body.addEventListener("mousedown",y),x.on("Change",()=>K(e)),x.on("blur",()=>x.ui.show()),x.on("OpenWindow",function(){var k;const p=(k=d.querySelector(".tox-dialog"))==null?void 0:k.closest(".tox");p&&(p==null?void 0:p.ownerDocument)!==document&&(document.body.appendChild(p),x.once("CloseWindow",()=>{p&&p.ownerDocument===document&&d.body.appendChild(p)}))}),e.addEventListener("dragstart",_,{capture:!0}),t.runCommand(m.setStateContextMenu,{enabled:!1}),Y(x,s),{rteEditor:x,rteEditorShallow:O}},a=(e,s)=>{e.ownerDocument.body.removeEventListener("mousedown",y),document.body.removeEventListener("mousedown",y),e.removeEventListener("dragstart",_,{capture:!0}),t.runCommand(m.setStateContextMenu,{enabled:!0}),s.rteEditor.destroy(),s.rteEditorShallow.destroy()};t.on(i.frameLoad,async({window:e})=>{const s=e.document;D(r,s)}),t.onReady(()=>{D(r,document),l&&C(g,V,{target:document.body})}),t.setCustomRte({parseContent:!0,async enable(e,s,d){const b=w(e);if(b)return b.rteEditor;const f=await c(e,d);return f&&J(e,f),f==null?void 0:f.rteEditor},disable(e){const s=w(e);s&&(X(e),a(e,s))},getContent(e){var d,b;const s=w(e);return s?(b=(d=s.rteEditor).getContent)==null?void 0:b.call(d):e.innerHTML}});const u=q(t,o.enableOnClick);F({editor:t,licenseKey:o.licenseKey,plan:z,pluginName:H,cleanup:()=>{t.RichTextEditor.customRte=void 0,u()}})},tt=j(Z);module.exports=tt;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
const A = "app.grapesjs.com",
|
|
1
|
+
var h = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(h || {}), m = /* @__PURE__ */ ((t) => (t.toastAdd = "studio:toastAdd", t.dialogOpen = "studio:dialogOpen", t.dialogClose = "studio:dialogClose", 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.projectFiles = "studio:projectFiles", 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.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 || {}), L = /* @__PURE__ */ ((t) => (t.dark = "dark", t.light = "light", t.auto = "auto", t))(L || {});
|
|
2
|
+
const A = "app.grapesjs.com", I = "app-stage.grapesjs.com", R = [
|
|
3
3
|
A,
|
|
4
|
-
|
|
4
|
+
I,
|
|
5
5
|
"localhost",
|
|
6
6
|
"127.0.0.1",
|
|
7
7
|
".local-credentialless.webcontainer.io",
|
|
@@ -10,65 +10,65 @@ const A = "app.grapesjs.com", O = "app-stage.grapesjs.com", R = [
|
|
|
10
10
|
// For stackblitz.com demos
|
|
11
11
|
"-sandpack.codesandbox.io"
|
|
12
12
|
// For Sandpack demos
|
|
13
|
-
],
|
|
13
|
+
], G = "license:check:start", M = "license:check:end", B = () => typeof window < "u", N = ({ isDev: t, isStage: n }) => `${t ? "" : `https://${n ? I : A}`}/api`, S = () => {
|
|
14
14
|
const t = B() && window.location.hostname;
|
|
15
15
|
return !!t && (R.includes(t) || R.some((n) => t.endsWith(n)));
|
|
16
16
|
};
|
|
17
|
-
async function
|
|
17
|
+
async function U({
|
|
18
18
|
path: t,
|
|
19
19
|
baseApiUrl: n,
|
|
20
20
|
method: o = "GET",
|
|
21
21
|
headers: r = {},
|
|
22
|
-
params:
|
|
22
|
+
params: i,
|
|
23
23
|
body: l
|
|
24
24
|
}) {
|
|
25
|
-
const c = `${n || N({ isDev: !1, isStage: !1 })}${t}`,
|
|
25
|
+
const c = `${n || N({ isDev: !1, isStage: !1 })}${t}`, a = {
|
|
26
26
|
method: o,
|
|
27
27
|
headers: {
|
|
28
28
|
"Content-Type": "application/json",
|
|
29
29
|
...r
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
l && (
|
|
33
|
-
const u =
|
|
32
|
+
l && (a.body = JSON.stringify(l));
|
|
33
|
+
const u = i ? new URLSearchParams(i).toString() : "", e = u ? `?${u}` : "", s = await fetch(`${c}${e}`, a);
|
|
34
34
|
if (!s.ok)
|
|
35
35
|
throw new Error(`HTTP error! status: ${s.status}`);
|
|
36
36
|
return s.json();
|
|
37
37
|
}
|
|
38
38
|
const P = {
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
39
|
+
[h.free]: 0,
|
|
40
|
+
[h.startup]: 10,
|
|
41
|
+
[h.business]: 20,
|
|
42
|
+
[h.enterprise]: 30
|
|
43
43
|
};
|
|
44
|
-
function
|
|
44
|
+
function W(t) {
|
|
45
45
|
const n = t;
|
|
46
46
|
return n.init = (o) => (r) => t(r, o), n;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const j = (t) => /* @__PURE__ */ W(t);
|
|
49
49
|
async function F({
|
|
50
50
|
editor: t,
|
|
51
51
|
plan: n,
|
|
52
52
|
pluginName: o,
|
|
53
53
|
licenseKey: r,
|
|
54
|
-
cleanup:
|
|
54
|
+
cleanup: i
|
|
55
55
|
}) {
|
|
56
56
|
let l = "", g = !1;
|
|
57
|
-
const c =
|
|
58
|
-
console.warn("Cleanup plugin:", o, "Reason:", e),
|
|
57
|
+
const c = S(), a = (e) => {
|
|
58
|
+
console.warn("Cleanup plugin:", o, "Reason:", e), i();
|
|
59
59
|
}, u = (e = {}) => {
|
|
60
60
|
var v;
|
|
61
61
|
const { error: s, sdkLicense: d } = e, b = (v = e.plan) == null ? void 0 : v.category;
|
|
62
62
|
if (!(d || e.license) || s)
|
|
63
|
-
|
|
63
|
+
a(s || "Invalid license");
|
|
64
64
|
else if (b) {
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
const E = P[n], x = P[b];
|
|
66
|
+
E > x && a({ pluginRequiredPlan: n, licensePlan: b });
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
t.on(
|
|
69
|
+
t.on(G, (e) => {
|
|
70
70
|
l = e == null ? void 0 : e.baseApiUrl, g = !0;
|
|
71
|
-
}), t.on(
|
|
71
|
+
}), t.on(M, (e) => {
|
|
72
72
|
u(e);
|
|
73
73
|
}), setTimeout(async () => {
|
|
74
74
|
if (!g) {
|
|
@@ -77,14 +77,14 @@ async function F({
|
|
|
77
77
|
const e = await $({ licenseKey: r, pluginName: o, baseApiUrl: l });
|
|
78
78
|
e && u(e);
|
|
79
79
|
} else
|
|
80
|
-
|
|
80
|
+
a("The `licenseKey` option not provided");
|
|
81
81
|
}
|
|
82
82
|
}, 2e3);
|
|
83
83
|
}
|
|
84
84
|
async function $(t) {
|
|
85
85
|
const { licenseKey: n, pluginName: o, baseApiUrl: r } = t;
|
|
86
86
|
try {
|
|
87
|
-
return (await
|
|
87
|
+
return (await U({
|
|
88
88
|
baseApiUrl: r,
|
|
89
89
|
path: `/sdk/${n || "na"}`,
|
|
90
90
|
method: "POST",
|
|
@@ -93,32 +93,32 @@ async function $(t) {
|
|
|
93
93
|
pn: o
|
|
94
94
|
}
|
|
95
95
|
})).result || {};
|
|
96
|
-
} catch (
|
|
97
|
-
return console.error("Error during SDK license check:",
|
|
96
|
+
} catch (i) {
|
|
97
|
+
return console.error("Error during SDK license check:", i), !1;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
const
|
|
101
|
-
const { doc: r = document } = o,
|
|
102
|
-
l.setAttribute(t, "true"), l.innerHTML = n, !
|
|
103
|
-
},
|
|
104
|
-
function
|
|
100
|
+
const C = (t, n, o) => {
|
|
101
|
+
const { doc: r = document } = o, i = o.target || r.head, l = i.querySelector(`style[${t}]`) || r.createElement("style");
|
|
102
|
+
l.setAttribute(t, "true"), l.innerHTML = n, !i.contains(l) && i.appendChild(l);
|
|
103
|
+
}, K = (t) => t.dispatchEvent(new CustomEvent("input"));
|
|
104
|
+
function q(t, n) {
|
|
105
105
|
if (!n) return () => {
|
|
106
106
|
};
|
|
107
|
-
const o = t.Components.events, r = (e) => t.getSelectedAll().includes(e),
|
|
107
|
+
const o = t.Components.events, r = (e) => t.getSelectedAll().includes(e), i = (e) => e.isInstanceOf("text") && !e.isChildOf("text"), l = (e) => e.isChildOf("text"), g = (e) => t.getEditing() === e, c = (e, s = {}) => {
|
|
108
108
|
e.trigger("focus", s.event);
|
|
109
|
-
},
|
|
110
|
-
r(e) &&
|
|
109
|
+
}, a = (e, s) => {
|
|
110
|
+
r(e) && i(e) && !g(e) && c(e, s);
|
|
111
111
|
}, u = (e, s) => {
|
|
112
|
-
if (r(e) && !
|
|
112
|
+
if (r(e) && !i(e) && l(e)) {
|
|
113
113
|
const d = e.parents().find((b) => b.isInstanceOf("text"));
|
|
114
114
|
d && (c(d, s), setTimeout(() => t.select(d), 0));
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
return t.on(o.select,
|
|
118
|
-
t.off(o.select,
|
|
117
|
+
return t.on(o.select, a), t.on(o.selectBefore, u), () => {
|
|
118
|
+
t.off(o.select, a), t.off(o.selectBefore, u);
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const H = "rteTinyMce", z = h.startup, V = `
|
|
122
122
|
.tox .tox-toolbar,
|
|
123
123
|
.tox .tox-toolbar__overflow,
|
|
124
124
|
.tox .tox-toolbar__primary,
|
|
@@ -233,26 +233,26 @@ const S = "rteTinyMce", z = p.startup, V = `
|
|
|
233
233
|
}, Y = (t, n) => {
|
|
234
234
|
const o = t.getDoc(), r = t.getWin();
|
|
235
235
|
if (n != null && n.event) {
|
|
236
|
-
const { event:
|
|
236
|
+
const { event: i } = n, { clientX: l, clientY: g } = i;
|
|
237
237
|
let c;
|
|
238
238
|
if (o.caretRangeFromPoint)
|
|
239
239
|
c = o.caretRangeFromPoint(l, g);
|
|
240
240
|
else if (o.caretPositionFromPoint) {
|
|
241
|
-
const
|
|
242
|
-
c = o.createRange(), c == null || c.setStart(
|
|
241
|
+
const a = o.caretPositionFromPoint(l, g);
|
|
242
|
+
c = o.createRange(), c == null || c.setStart(a.offsetNode, a.offset);
|
|
243
243
|
}
|
|
244
244
|
if (c) {
|
|
245
|
-
const
|
|
246
|
-
|
|
245
|
+
const a = r.getSelection();
|
|
246
|
+
a == null || a.removeAllRanges(), a == null || a.addRange(c), t.selection.setRng(c);
|
|
247
247
|
}
|
|
248
248
|
} else
|
|
249
249
|
t.execCommand("SelectAll");
|
|
250
250
|
}, Q = (t) => {
|
|
251
251
|
var u, e;
|
|
252
|
-
const { el: n, editor: o, componentView: r } = t,
|
|
252
|
+
const { el: n, editor: o, componentView: r } = t, i = o.runCommand(m.getStateTheme), l = r.model, g = {
|
|
253
253
|
target: n,
|
|
254
254
|
inline: !0,
|
|
255
|
-
skin: (
|
|
255
|
+
skin: (i == null ? void 0 : i.theme) === L.dark ? "oxide-dark" : "oxide",
|
|
256
256
|
menubar: !1,
|
|
257
257
|
image_advtab: !0,
|
|
258
258
|
paste_data_images: !0,
|
|
@@ -271,20 +271,20 @@ const S = "rteTinyMce", z = p.startup, V = `
|
|
|
271
271
|
...g,
|
|
272
272
|
...c
|
|
273
273
|
};
|
|
274
|
-
},
|
|
275
|
-
const
|
|
274
|
+
}, D = (t, n = document) => new Promise((o, r) => {
|
|
275
|
+
const i = Array.isArray(t) ? [...t] : [t], { head: l } = n, g = (c) => {
|
|
276
276
|
if (c.length) {
|
|
277
|
-
const
|
|
278
|
-
|
|
277
|
+
const a = n.createElement("script");
|
|
278
|
+
a.src = c.shift(), a.onload = g.bind(null, c), a.onerror = r, l.appendChild(a);
|
|
279
279
|
} else
|
|
280
280
|
o();
|
|
281
281
|
};
|
|
282
|
-
g(
|
|
282
|
+
g(i);
|
|
283
283
|
}), Z = function(t, n = {}) {
|
|
284
284
|
const o = {
|
|
285
285
|
cdnScript: "https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",
|
|
286
286
|
...n
|
|
287
|
-
}, { cdnScript: r } = o,
|
|
287
|
+
}, { cdnScript: r } = o, i = t.Canvas.events, l = !o.skipCustomTheme, g = "gs-plg-tinymce-studio-theme", c = async (e, s) => {
|
|
288
288
|
const d = e.ownerDocument, b = d.defaultView, f = s == null ? void 0 : s.view;
|
|
289
289
|
if (!b || !f) {
|
|
290
290
|
console.warn("Missing required data", { win: b, componentView: f });
|
|
@@ -297,25 +297,25 @@ const S = "rteTinyMce", z = p.startup, V = `
|
|
|
297
297
|
pluginOpts: o
|
|
298
298
|
}), x = (await b.tinymce.init(v))[0];
|
|
299
299
|
if (!x) return;
|
|
300
|
-
const
|
|
300
|
+
const O = (await window.tinymce.init({
|
|
301
301
|
...v,
|
|
302
302
|
target: document.createElement("div")
|
|
303
303
|
}))[0];
|
|
304
|
-
return x.ui.show(), d.body.addEventListener("mousedown", y), document.body.addEventListener("mousedown", y), x.on("Change", () =>
|
|
305
|
-
var
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
return x.ui.show(), d.body.addEventListener("mousedown", y), document.body.addEventListener("mousedown", y), x.on("Change", () => K(e)), x.on("blur", () => x.ui.show()), x.on("OpenWindow", function() {
|
|
305
|
+
var k;
|
|
306
|
+
const p = (k = d.querySelector(".tox-dialog")) == null ? void 0 : k.closest(".tox");
|
|
307
|
+
p && (p == null ? void 0 : p.ownerDocument) !== document && (document.body.appendChild(p), x.once("CloseWindow", () => {
|
|
308
|
+
p && p.ownerDocument === document && d.body.appendChild(p);
|
|
309
309
|
}));
|
|
310
|
-
}), e.addEventListener("dragstart", _, { capture: !0 }), t.runCommand(m.setStateContextMenu, { enabled: !1 }), Y(x, s), { rteEditor: x, rteEditorShallow:
|
|
311
|
-
},
|
|
310
|
+
}), e.addEventListener("dragstart", _, { capture: !0 }), t.runCommand(m.setStateContextMenu, { enabled: !1 }), Y(x, s), { rteEditor: x, rteEditorShallow: O };
|
|
311
|
+
}, a = (e, s) => {
|
|
312
312
|
e.ownerDocument.body.removeEventListener("mousedown", y), document.body.removeEventListener("mousedown", y), e.removeEventListener("dragstart", _, { capture: !0 }), t.runCommand(m.setStateContextMenu, { enabled: !0 }), s.rteEditor.destroy(), s.rteEditorShallow.destroy();
|
|
313
313
|
};
|
|
314
|
-
t.on(
|
|
314
|
+
t.on(i.frameLoad, async ({ window: e }) => {
|
|
315
315
|
const s = e.document;
|
|
316
|
-
|
|
316
|
+
D(r, s);
|
|
317
317
|
}), t.onReady(() => {
|
|
318
|
-
|
|
318
|
+
D(r, document), l && C(g, V, { target: document.body });
|
|
319
319
|
}), t.setCustomRte({
|
|
320
320
|
parseContent: !0,
|
|
321
321
|
// @ts-expect-error - Type 'CustomRteOptions' is missing the following properties from type 'CustomRteOptions': editor, component, el
|
|
@@ -327,7 +327,7 @@ const S = "rteTinyMce", z = p.startup, V = `
|
|
|
327
327
|
},
|
|
328
328
|
disable(e) {
|
|
329
329
|
const s = w(e);
|
|
330
|
-
s && (X(e),
|
|
330
|
+
s && (X(e), a(e, s));
|
|
331
331
|
},
|
|
332
332
|
getContent(e) {
|
|
333
333
|
var d, b;
|
|
@@ -335,17 +335,17 @@ const S = "rteTinyMce", z = p.startup, V = `
|
|
|
335
335
|
return s ? (b = (d = s.rteEditor).getContent) == null ? void 0 : b.call(d) : e.innerHTML;
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
|
-
const u =
|
|
338
|
+
const u = q(t, o.enableOnClick);
|
|
339
339
|
F({
|
|
340
340
|
editor: t,
|
|
341
341
|
licenseKey: o.licenseKey,
|
|
342
342
|
plan: z,
|
|
343
|
-
pluginName:
|
|
343
|
+
pluginName: H,
|
|
344
344
|
cleanup: () => {
|
|
345
345
|
t.RichTextEditor.customRte = void 0, u();
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
|
-
}, nt =
|
|
348
|
+
}, nt = j(Z);
|
|
349
349
|
export {
|
|
350
350
|
nt as default
|
|
351
351
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(f,h){typeof exports=="object"&&typeof module<"u"?module.exports=h():typeof define=="function"&&define.amd?define(h):(f=typeof globalThis<"u"?globalThis:f||self,f.StudioSdkPlugins_rteTinyMce=h())})(this,function(){"use strict";var f=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(f||{}),h=(t=>(t.toastAdd="studio:toastAdd",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.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.setDragAbsolute="studio:setDragAbsolute",t))(h||{}),k=(t=>(t.dark="dark",t.light="light",t.auto="auto",t))(k||{});const E="app.grapesjs.com",R="app-stage.grapesjs.com",P=[E,R,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],
|
|
1
|
+
(function(f,h){typeof exports=="object"&&typeof module<"u"?module.exports=h():typeof define=="function"&&define.amd?define(h):(f=typeof globalThis<"u"?globalThis:f||self,f.StudioSdkPlugins_rteTinyMce=h())})(this,function(){"use strict";var f=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(f||{}),h=(t=>(t.toastAdd="studio:toastAdd",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.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))(h||{}),k=(t=>(t.dark="dark",t.light="light",t.auto="auto",t))(k||{});const E="app.grapesjs.com",R="app-stage.grapesjs.com",P=[E,R,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",M="license:check:end",G=()=>typeof window<"u",S=({isDev:t,isStage:n})=>`${t?"":`https://${n?R:E}`}/api`,B=()=>{const t=G()&&window.location.hostname;return!!t&&(P.includes(t)||P.some(n=>t.endsWith(n)))};async function N({path:t,baseApiUrl:n,method:o="GET",headers:r={},params:a,body:l}){const c=`${n||S({isDev:!1,isStage:!1})}${t}`,i={method:o,headers:{"Content-Type":"application/json",...r}};l&&(i.body=JSON.stringify(l));const u=a?new URLSearchParams(a).toString():"",e=u?`?${u}`:"",s=await fetch(`${c}${e}`,i);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}const _={[f.free]:0,[f.startup]:10,[f.business]:20,[f.enterprise]:30};function U(t){const n=t;return n.init=o=>r=>t(r,o),n}const W=t=>U(t);async function j({editor:t,plan:n,pluginName:o,licenseKey:r,cleanup:a}){let l="",g=!1;const c=B(),i=e=>{console.warn("Cleanup plugin:",o,"Reason:",e),a()},u=(e={})=>{var y;const{error:s,sdkLicense:d}=e,b=(y=e.plan)==null?void 0:y.category;if(!(d||e.license)||s)i(s||"Invalid license");else if(b){const A=_[n],x=_[b];A>x&&i({pluginRequiredPlan:n,licensePlan:b})}};t.on(O,e=>{l=e==null?void 0:e.baseApiUrl,g=!0}),t.on(M,e=>{u(e)}),setTimeout(async()=>{if(!g){if(c)return;if(r){const e=await F({licenseKey:r,pluginName:o,baseApiUrl:l});e&&u(e)}else i("The `licenseKey` option not provided")}},2e3)}async function F(t){const{licenseKey:n,pluginName:o,baseApiUrl:r}=t;try{return(await N({baseApiUrl:r,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const $=(t,n,o)=>{const{doc:r=document}=o,a=o.target||r.head,l=a.querySelector(`style[${t}]`)||r.createElement("style");l.setAttribute(t,"true"),l.innerHTML=n,!a.contains(l)&&a.appendChild(l)},C=t=>t.dispatchEvent(new CustomEvent("input"));function K(t,n){if(!n)return()=>{};const o=t.Components.events,r=e=>t.getSelectedAll().includes(e),a=e=>e.isInstanceOf("text")&&!e.isChildOf("text"),l=e=>e.isChildOf("text"),g=e=>t.getEditing()===e,c=(e,s={})=>{e.trigger("focus",s.event)},i=(e,s)=>{r(e)&&a(e)&&!g(e)&&c(e,s)},u=(e,s)=>{if(r(e)&&!a(e)&&l(e)){const d=e.parents().find(b=>b.isInstanceOf("text"));d&&(c(d,s),setTimeout(()=>t.select(d),0))}};return t.on(o.select,i),t.on(o.selectBefore,u),()=>{t.off(o.select,i),t.off(o.selectBefore,u)}}const q="rteTinyMce",H=f.startup,z=`
|
|
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
|
-
}`,w=new WeakMap,V=(t,n)=>{w.set(t,n)},J=t=>{w.delete(t)},T=t=>w.get(t),m=t=>{const n=t.target,o=n.closest(".tox"),r=n.matches(".ephox-snooker-resizer-bar");(o||r)&&t.stopPropagation()},
|
|
104
|
+
}`,w=new WeakMap,V=(t,n)=>{w.set(t,n)},J=t=>{w.delete(t)},T=t=>w.get(t),m=t=>{const n=t.target,o=n.closest(".tox"),r=n.matches(".ephox-snooker-resizer-bar");(o||r)&&t.stopPropagation()},D=t=>{t.stopPropagation(),t.preventDefault()},X=(t,n)=>{const o=t.getDoc(),r=t.getWin();if(n!=null&&n.event){const{event:a}=n,{clientX:l,clientY:g}=a;let c;if(o.caretRangeFromPoint)c=o.caretRangeFromPoint(l,g);else if(o.caretPositionFromPoint){const i=o.caretPositionFromPoint(l,g);c=o.createRange(),c==null||c.setStart(i.offsetNode,i.offset)}if(c){const i=r.getSelection();i==null||i.removeAllRanges(),i==null||i.addRange(c),t.selection.setRng(c)}}else t.execCommand("SelectAll")},Y=t=>{var u,e;const{el:n,editor:o,componentView:r}=t,a=o.runCommand(h.getStateTheme),l=r.model,g={target:n,inline:!0,skin:(a==null?void 0:a.theme)===k.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"},c=((e=(u=t.pluginOpts)==null?void 0:u.loadConfig)==null?void 0:e.call(u,{config:g,editor:o,componentView:r,component:l}))||{};return{...g,...c}},L=(t,n=document)=>new Promise((o,r)=>{const a=Array.isArray(t)?[...t]:[t],{head:l}=n,g=c=>{if(c.length){const i=n.createElement("script");i.src=c.shift(),i.onload=g.bind(null,c),i.onerror=r,l.appendChild(i)}else o()};g(a)});return W(function(t,n={}){const o={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...n},{cdnScript:r}=o,a=t.Canvas.events,l=!o.skipCustomTheme,g="gs-plg-tinymce-studio-theme",c=async(e,s)=>{const d=e.ownerDocument,b=d.defaultView,p=s==null?void 0:s.view;if(!b||!p){console.warn("Missing required data",{win:b,componentView:p});return}const y=Y({el:e,editor:t,componentView:p,pluginOpts:o}),x=(await b.tinymce.init(y))[0];if(!x)return;const Q=(await window.tinymce.init({...y,target:document.createElement("div")}))[0];return x.ui.show(),d.body.addEventListener("mousedown",m),document.body.addEventListener("mousedown",m),x.on("Change",()=>C(e)),x.on("blur",()=>x.ui.show()),x.on("OpenWindow",function(){var I;const v=(I=d.querySelector(".tox-dialog"))==null?void 0:I.closest(".tox");v&&(v==null?void 0:v.ownerDocument)!==document&&(document.body.appendChild(v),x.once("CloseWindow",()=>{v&&v.ownerDocument===document&&d.body.appendChild(v)}))}),e.addEventListener("dragstart",D,{capture:!0}),t.runCommand(h.setStateContextMenu,{enabled:!1}),X(x,s),{rteEditor:x,rteEditorShallow:Q}},i=(e,s)=>{e.ownerDocument.body.removeEventListener("mousedown",m),document.body.removeEventListener("mousedown",m),e.removeEventListener("dragstart",D,{capture:!0}),t.runCommand(h.setStateContextMenu,{enabled:!0}),s.rteEditor.destroy(),s.rteEditorShallow.destroy()};t.on(a.frameLoad,async({window:e})=>{const s=e.document;L(r,s)}),t.onReady(()=>{L(r,document),l&&$(g,z,{target:document.body})}),t.setCustomRte({parseContent:!0,async enable(e,s,d){const b=T(e);if(b)return b.rteEditor;const p=await c(e,d);return p&&V(e,p),p==null?void 0:p.rteEditor},disable(e){const s=T(e);s&&(J(e),i(e,s))},getContent(e){var d,b;const s=T(e);return s?(b=(d=s.rteEditor).getContent)==null?void 0:b.call(d):e.innerHTML}});const u=K(t,o.enableOnClick);j({editor:t,licenseKey:o.licenseKey,plan:H,pluginName:q,cleanup:()=>{t.RichTextEditor.customRte=void 0,u()}})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function re(e,t,o){let l,n,s,r,a;const c=t;function h(){const u=Date.now()-r;u<c&&u>=0?l=setTimeout(h,c-u):(l=null,a=e.apply(s,n),s=n=null)}const d=function(){return s=this,n=arguments,r=Date.now(),l||(l=setTimeout(h,c)),a};return d.clear=function(){l&&(clearTimeout(l),l=null)},d.flush=function(){l&&(a=e.apply(s,n),s=n=null,clearTimeout(l),l=null)},d}const F="app.grapesjs.com",O="app-stage.grapesjs.com",L=[F,O,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ie="license:check:start",he="license:check:end",de=()=>typeof window<"u",ve=({isDev:e,isStage:t})=>`${e?"":`https://${t?O:F}`}/api`,ue=()=>{const e=de()&&window.location.hostname;return!!e&&(L.includes(e)||L.some(t=>e.endsWith(t)))};function U(e){return typeof e=="function"}async function be({path:e,baseApiUrl:t,method:o="GET",headers:l={},params:n,body:s}){const a=`${t||ve({isDev:!1,isStage:!1})}${e}`,c={method:o,headers:{"Content-Type":"application/json",...l}};s&&(c.body=JSON.stringify(s));const h=n?new URLSearchParams(n).toString():"",d=h?`?${h}`:"",u=await fetch(`${a}${d}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{}),$=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.projectFiles="studio:projectFiles",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.setDragAbsolute="studio:setDragAbsolute",e))($||{});const S={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function ge(e){const t=e;return t.init=o=>l=>e(l,o),t}const pe=e=>ge(e);async function fe({editor:e,plan:t,pluginName:o,licenseKey:l,cleanup:n}){let s="",r=!1;const a=ue(),c=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var m;const{error:u,sdkLicense:f}=d,w=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||u)c(u||"Invalid license");else if(w){const V=S[t],z=S[w];V>z&&c({pluginRequiredPlan:t,licensePlan:w})}};e.on(ie,d=>{s=d==null?void 0:d.baseApiUrl,r=!0}),e.on(he,d=>{h(d)}),setTimeout(async()=>{if(!r){if(a)return;if(l){const d=await me({licenseKey:l,pluginName:o,baseApiUrl:s});d&&h(d)}else c("The `licenseKey` option not provided")}},2e3)}async function me(e){const{licenseKey:t,pluginName:o,baseApiUrl:l}=e;try{return(await be({baseApiUrl:l,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const we="tableComponent",ye=y.startup;var i=(e=>(e.table="table",e.tableSettings="tableSettings",e.tableDelete="tableDelete",e.tableHead="tableHead",e.tableFoot="tableFoot",e.tableCellItems="tableCellItems",e.tableCellProperties="tableCellProperties",e.tableCellMerge="tableCellMerge",e.tableCellSplit="tableCellSplit",e.tableRowItems="tableRowItems",e.tableRowInsertBefore="tableRowInsertBefore",e.tableRowInsertAfter="tableRowInsertAfter",e.tableRowDelete="tableRowDelete",e.tableRowProperties="tableRowProperties",e.tableRowCut="tableRowCut",e.tableRowCopy="tableRowCopy",e.tableRowPasteBefore="tableRowPasteBefore",e.tableRowPasteAfter="tableRowPasteAfter",e.tableColumn="tableColumn",e.tableColumnItems="tableColumnItems",e.tableColumnInsertBefore="tableColumnInsertBefore",e.tableColumnInsertAfter="tableColumnInsertAfter",e.tableColumnDelete="tableColumnDelete",e.tableColumnCut="tableColumnCut",e.tableColumnCopy="tableColumnCopy",e.tableColumnPasteBefore="tableColumnPasteBefore",e.tableColumnPasteAfter="tableColumnPasteAfter",e))(i||{});const v={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},p="table",W="thead",_="tfoot",x="tbody",g="row",b="cell",k="clipboardTable",Ce=[p,W,_,x,g,b],A=e=>e.em.get(k)||[],He=e=>e.every(t=>t.is(b)),M=(e,t)=>{const{editor:o,event:l,opts:n}=e,s=l.currentTarget||l.target,{x:r,y:a,width:c,height:h}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:a,w:c,h},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...t};U(n.openSettings)?n.openSettings({...e,layoutProps:d}):o.runCommand($.layoutToggle,d)},Re=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(n=>({type:g,components:Array.from(Array(o).keys()).map(s=>({type:b,components:l?{type:"text",content:U(l)?l({y:n,x:s}):l}:void 0}))}))}),K="Table settings",j=e=>{const{component:t}=e;return t.is(p)?t:t.closestType(p)},Pe=e=>{var t;(t=j(e))==null||t.remove(e.opts)},Ve=e=>{const t=j(e);t&&(e.editor.select(t),M(e,{id:"tableSettings",header:{label:K}}))},q=e=>[{id:i.table,icon:v[i.table],label:"Table",items:[{id:i.tableSettings,label:K,icon:v[i.tableSettings],onClick:({event:o})=>Ve({...e,event:o})},{id:i.tableDelete,label:"Delete table",icon:v[i.tableDelete],onClick:()=>Pe(e)}]}],X=({editor:e})=>{const t=A(e);return t.length&&He(t)},E=({component:e,editor:t,after:o})=>{if(!e.is(b))return;const l=e.closestType(p),n=e.closestType(g),s=e.index()+(o?1:0);l==null||l.findType(g).forEach(a=>a.append({type:b},{at:s}));const r=n==null?void 0:n.components().at(s);r&&t.select(r)},Y=({component:e,opts:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index();o==null||o.findType(g).forEach(n=>{var s;return(s=n.components().at(l))==null?void 0:s.remove(t)})},J=({component:e,editor:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index(),n=(o==null?void 0:o.findType(g).map(s=>s.components().at(l)))||[];n.length&&t.em.set(k,n)},G=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(b)||!X(e))return;const n=A(o),s=t.closestType(p),r=t.index()+(l?1:0);s==null||s.findType(g).forEach((a,c)=>{const h=n[c],d=(h==null?void 0:h.clone())||{type:b};a.append(d,{at:r})})},ze=e=>{const{component:t}=e;t.is(b)&&(J(e),Y({...e,opts:{temporary:!0}}))},Ae=e=>{const t=X(e);return[{id:i.tableColumnItems,icon:v[i.tableColumn],label:"Column",items:[{id:i.tableColumnInsertBefore,label:"Insert column before",icon:v[i.tableColumnInsertBefore],onClick:()=>E(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>E({...e,after:!0})},{id:i.tableColumnDelete,label:"Delete column",icon:v[i.tableColumnDelete],onClick:()=>Y(e)},{id:i.tableColumnCut,label:"Cut column",icon:v[i.tableColumnCut],onClick:()=>ze(e)},{id:i.tableColumnCopy,label:"Copy column",icon:v[i.tableColumnCopy],onClick:()=>J(e)},{id:i.tableColumnPasteBefore,label:"Paste column before",icon:v[i.tableColumnPasteBefore],disabled:!t,onClick:()=>G(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>G({...e,after:!0})}]}]},Q="Row settings",Be=e=>e.every(t=>t.is(g)),R=e=>{const{component:t}=e,o=t.is(b),l=t.is(g);if(!(!o&&!l))return l?t:t.closestType(g)},Z=e=>{const{component:t,editor:o,after:l}=e,n=R(e);if(!n)return;const s=n.index()+(l?1:0),r=n.components().length,a=Array.from(Array(r).keys()).map(()=>({type:b})),c=n.parent();if(c){const h=c.append({type:g,components:a},{at:s})[0];if(t.is(b)&&h){const d=t.index(),u=h.components().at(d);u&&o.select(u)}}},ee=e=>{var t;(t=R(e))==null||t.remove(e.opts)},te=e=>{const t=R(e);t&&e.editor.em.set(k,[t])},N=e=>{var a;const{editor:t,after:o}=e,l=R(e);if(!l||!le(e))return;const s=A(t)[0],r=l.index()+(o?1:0);s&&((a=l.parent())==null||a.append(s.clone(),{at:r}))},xe=e=>{R(e)&&(te(e),ee({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=A(e);return t.length&&Be(t)},Ie=e=>{const t=R(e);t&&(e.editor.select(t),M(e,{id:"tableRowSettings",header:{label:Q}}))},oe=e=>{const t=le(e);return[{id:i.tableRowItems,icon:v[i.tableRowProperties],label:"Row",items:[{id:i.tableRowInsertBefore,label:"Insert row before",icon:v[i.tableRowInsertBefore],onClick:()=>Z(e)},{id:i.tableRowInsertAfter,label:"Insert row after",icon:v[i.tableRowInsertAfter],onClick:()=>Z({...e,after:!0})},{id:i.tableRowDelete,label:"Delete row",icon:v[i.tableRowDelete],onClick:()=>ee(e)},{id:i.tableRowProperties,label:Q,icon:v[i.tableRowProperties],onClick:({event:l})=>Ie({...e,event:l})},{id:i.tableRowCut,label:"Cut row",icon:v[i.tableRowCut],onClick:()=>xe(e)},{id:i.tableRowCopy,label:"Copy row",icon:v[i.tableRowCopy],onClick:()=>te(e)},{id:i.tableRowPasteBefore,label:"Paste row before",icon:v[i.tableRowPasteBefore],disabled:!t,onClick:()=>N(e)},{id:i.tableRowPasteAfter,label:"Paste row after",icon:v[i.tableRowPasteAfter],disabled:!t,onClick:()=>N({...e,after:!0})}]},...q(e)]},T=e=>{const t=e.attributes.attributes||{},o=parseInt(`${t.rowspan||1}`,10),l=parseInt(`${t.colspan||1}`,10);return{rowspan:o,colspan:l}};function se(e){const t=[];return e.components().forEach((o,l)=>{o.components().each((n,s)=>{const{rowspan:r,colspan:a}=T(n);if(t[l])for(;t[l][s];)s++;for(let c=l;c<l+r;c++){t[c]||(t[c]=[]);for(let h=s;h<s+a;h++)t[c][h]={real:c===l&&h===s,cell:n,rowspan:r,colspan:a}}})}),t}function C(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const I=e=>e.closestType(g);function ke(e,{x:t,y:o,rows:l,cols:n}){var a;let s=I(e[o][t].cell),r;for(let c=1;c<=l;c++)if(s=(a=s==null?void 0:s.parent())==null?void 0:a.components().at(s.index()+1),s){for(r=t;r>=0;r--){const{cell:h}=e[o+c][r],d=I(h);if(d===s){for(let u=1;u<=n;u++){const f=h.index();d.append({type:b},{at:f+1})}break}}if(r===-1){const d=s.components().at(0).index();for(let u=1;u<=n;u++)s.append({type:b},{at:d})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const n=e[t][o].cell;if(n.em.selected.hasComponent(n)){const{rowspan:s,colspan:r}=T(n);if(r>1||s>1){n.addAttributes({colspan:1,rowspan:1});for(let a=0;a<r-1;a++){const c=n.index();I(n).append({type:b},{at:c+1})}ke(e,{x:o,y:t,rows:s-1,cols:r})}}}}function Me(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const B=(e,t={})=>{var r;const o=se(e),{em:l}=e;let n,s;for(let a=0;a<o.length;a++)for(let c=0;c<o[a].length;c++){const h=o[a][c];if((r=t.selected)!=null&&r.includes(h.cell)||l.selected.hasComponent(h.cell)){const d={x:c,y:a};n||(n=d),s=d}}return{grid:o,startPos:n,endPos:s}};function Te(e,t={}){const o=B(e),{startPos:l,endPos:n}=o;let{grid:s}=o;const{em:r}=e;if(!l||!n)return;const a=l.x,c=l.y,h=n.x,d=n.y,u=C(s,a,c),f=C(s,h,d);if(u&&f){ne(s),s=se(e);const w=[],P=C(s,a,c).cell;P.addAttributes({colspan:h-a+1,rowspan:d-c+1});for(let m=c;m<=d;m++)for(let V=a;V<=h;V++){const z=C(s,V,m);if(!z)continue;const{cell:D}=z;D!==P&&w.push(D)}w.forEach(m=>{t.mergeContent&&P.append(m.components().models),m.remove()}),r.setSelected(P),Me(e)}}const ae="Cell settings",De="Merge cells",Le="Split cell",Se=e=>e.closestType(g),H=e=>{var t;return(t=Se(e))==null?void 0:t.parent()},Ee=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]),l=t[0];if(!o||!(l!=null&&l.is(b))||t.length>1)return!1;const{rowspan:n,colspan:s}=T(l);return!(s<2&&n<2)},Ge=e=>{const o=e.editor.getSelectedAll()[0],l=H(o),{grid:n}=B(l);ne(n)},ce=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]);if(!o||t.length<2||t.some(a=>!a.is(b)||H(a)!==o))return!1;const{grid:l,startPos:n,endPos:s}=B(o),{em:r}=o;if(!n||!s)return!1;for(let a=n.y;a<=s.y;a++)for(let c=n.x;c<=s.x;c++){const h=C(l,c,a);if(!h||!r.selected.hasComponent(h.cell))return!1}return!0},Ze=e=>{const{editor:t}=e;if(!ce(e))return;const o=t.getSelectedAll(),l=H(o[0]);Te(l,{mergeContent:!0})},Ne=e=>{M(e,{id:"tableCellSettings",header:{label:ae}})},Fe=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:v[i.tableCellProperties],onClick:({event:o})=>Ne({...e,event:o})},{id:i.tableCellMerge,label:De,icon:v[i.tableCellMerge],onClick:()=>Ze(e),disabled:!ce(e)},{id:i.tableCellSplit,label:Le,icon:v[i.tableCellSplit],onClick:()=>Ge(e),disabled:!Ee(e)}]},...Ae(e),...oe(e)],Oe=e=>{const t=e[0]&&H(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:n}=B(t,{selected:e});if(!l||!n)return;const s=[];for(let r=l.y;r<=n.y;r++)for(let a=l.x;a<=n.x;a++){const c=C(o,a,r);c&&s.push(c.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})},Ue=function(e,t={}){const o={block:{},...t},{Components:l}=e,n={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};l.addType(p,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:p,style:{width:"100%"}},select:!0,...o.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:v.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:r,value:a,emitUpdate:c}){const h=r.find("caption")[0];a?!h&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),c(),e.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Re(x,{rows:5}),contextMenu:({items:r,editor:a,component:c})=>[...q({editor:a,component:c,opts:o}),...r]}}}),l.addType(W,{model:{defaults:{icon:v.tableHead,...n}}}),l.addType(_,{model:{defaults:{icon:v.tableFoot,...n}}}),l.addType(x,{model:{defaults:{icon:v.tableRowProperties,...n}}}),l.addType(g,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:a,component:c})=>[...oe({editor:a,component:c,opts:o}),...r]}}}),l.addType(b,{model:{defaults:{icon:v.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:r,editor:a,component:c})=>[...Fe({editor:a,component:c,opts:o}),...r]}}});const s=re((r,a)=>{var u;const c=e.getSelectedAll(),h=!!((u=a==null?void 0:a.event)!=null&&u.shiftKey);if(c.length<2||!h||a.fromCell)return;const d=c.map(f=>f.is(b)?f:f.closestType(b)).filter(Boolean);d.length===c.length&&Oe(d)},0);e.on("component:select",s),fe({editor:e,plan:ye,pluginName:we,licenseKey:o.licenseKey,cleanup:()=>{e.off("component:select",s),e.Blocks.remove(p),Ce.forEach(r=>l.removeType(r))}})},$e=pe(Ue);module.exports=$e;
|
|
1
|
+
"use strict";function re(e,t,o){let l,n,s,r,a;const c=t;function h(){const u=Date.now()-r;u<c&&u>=0?l=setTimeout(h,c-u):(l=null,a=e.apply(s,n),s=n=null)}const d=function(){return s=this,n=arguments,r=Date.now(),l||(l=setTimeout(h,c)),a};return d.clear=function(){l&&(clearTimeout(l),l=null)},d.flush=function(){l&&(a=e.apply(s,n),s=n=null,clearTimeout(l),l=null)},d}const F="app.grapesjs.com",O="app-stage.grapesjs.com",T=[F,O,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ie="license:check:start",he="license:check:end",de=()=>typeof window<"u",ve=({isDev:e,isStage:t})=>`${e?"":`https://${t?O:F}`}/api`,ue=()=>{const e=de()&&window.location.hostname;return!!e&&(T.includes(e)||T.some(t=>e.endsWith(t)))};function U(e){return typeof e=="function"}async function be({path:e,baseApiUrl:t,method:o="GET",headers:l={},params:n,body:s}){const a=`${t||ve({isDev:!1,isStage:!1})}${e}`,c={method:o,headers:{"Content-Type":"application/json",...l}};s&&(c.body=JSON.stringify(s));const h=n?new URLSearchParams(n).toString():"",d=h?`?${h}`:"",u=await fetch(`${a}${d}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{}),$=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.projectFiles="studio:projectFiles",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))($||{});const L={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function ge(e){const t=e;return t.init=o=>l=>e(l,o),t}const pe=e=>ge(e);async function fe({editor:e,plan:t,pluginName:o,licenseKey:l,cleanup:n}){let s="",r=!1;const a=ue(),c=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var m;const{error:u,sdkLicense:f}=d,w=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||u)c(u||"Invalid license");else if(w){const V=L[t],z=L[w];V>z&&c({pluginRequiredPlan:t,licensePlan:w})}};e.on(ie,d=>{s=d==null?void 0:d.baseApiUrl,r=!0}),e.on(he,d=>{h(d)}),setTimeout(async()=>{if(!r){if(a)return;if(l){const d=await me({licenseKey:l,pluginName:o,baseApiUrl:s});d&&h(d)}else c("The `licenseKey` option not provided")}},2e3)}async function me(e){const{licenseKey:t,pluginName:o,baseApiUrl:l}=e;try{return(await be({baseApiUrl:l,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const we="tableComponent",ye=y.startup;var i=(e=>(e.table="table",e.tableSettings="tableSettings",e.tableDelete="tableDelete",e.tableHead="tableHead",e.tableFoot="tableFoot",e.tableCellItems="tableCellItems",e.tableCellProperties="tableCellProperties",e.tableCellMerge="tableCellMerge",e.tableCellSplit="tableCellSplit",e.tableRowItems="tableRowItems",e.tableRowInsertBefore="tableRowInsertBefore",e.tableRowInsertAfter="tableRowInsertAfter",e.tableRowDelete="tableRowDelete",e.tableRowProperties="tableRowProperties",e.tableRowCut="tableRowCut",e.tableRowCopy="tableRowCopy",e.tableRowPasteBefore="tableRowPasteBefore",e.tableRowPasteAfter="tableRowPasteAfter",e.tableColumn="tableColumn",e.tableColumnItems="tableColumnItems",e.tableColumnInsertBefore="tableColumnInsertBefore",e.tableColumnInsertAfter="tableColumnInsertAfter",e.tableColumnDelete="tableColumnDelete",e.tableColumnCut="tableColumnCut",e.tableColumnCopy="tableColumnCopy",e.tableColumnPasteBefore="tableColumnPasteBefore",e.tableColumnPasteAfter="tableColumnPasteAfter",e))(i||{});const v={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},p="table",W="thead",_="tfoot",x="tbody",g="row",b="cell",k="clipboardTable",Ce=[p,W,_,x,g,b],A=e=>e.em.get(k)||[],He=e=>e.every(t=>t.is(b)),M=(e,t)=>{const{editor:o,event:l,opts:n}=e,s=l.currentTarget||l.target,{x:r,y:a,width:c,height:h}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:a,w:c,h},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...t};U(n.openSettings)?n.openSettings({...e,layoutProps:d}):o.runCommand($.layoutToggle,d)},Re=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(n=>({type:g,components:Array.from(Array(o).keys()).map(s=>({type:b,components:l?{type:"text",content:U(l)?l({y:n,x:s}):l}:void 0}))}))}),K="Table settings",j=e=>{const{component:t}=e;return t.is(p)?t:t.closestType(p)},Pe=e=>{var t;(t=j(e))==null||t.remove(e.opts)},Ve=e=>{const t=j(e);t&&(e.editor.select(t),M(e,{id:"tableSettings",header:{label:K}}))},q=e=>[{id:i.table,icon:v[i.table],label:"Table",items:[{id:i.tableSettings,label:K,icon:v[i.tableSettings],onClick:({event:o})=>Ve({...e,event:o})},{id:i.tableDelete,label:"Delete table",icon:v[i.tableDelete],onClick:()=>Pe(e)}]}],X=({editor:e})=>{const t=A(e);return t.length&&He(t)},E=({component:e,editor:t,after:o})=>{if(!e.is(b))return;const l=e.closestType(p),n=e.closestType(g),s=e.index()+(o?1:0);l==null||l.findType(g).forEach(a=>a.append({type:b},{at:s}));const r=n==null?void 0:n.components().at(s);r&&t.select(r)},Y=({component:e,opts:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index();o==null||o.findType(g).forEach(n=>{var s;return(s=n.components().at(l))==null?void 0:s.remove(t)})},J=({component:e,editor:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index(),n=(o==null?void 0:o.findType(g).map(s=>s.components().at(l)))||[];n.length&&t.em.set(k,n)},G=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(b)||!X(e))return;const n=A(o),s=t.closestType(p),r=t.index()+(l?1:0);s==null||s.findType(g).forEach((a,c)=>{const h=n[c],d=(h==null?void 0:h.clone())||{type:b};a.append(d,{at:r})})},ze=e=>{const{component:t}=e;t.is(b)&&(J(e),Y({...e,opts:{temporary:!0}}))},Ae=e=>{const t=X(e);return[{id:i.tableColumnItems,icon:v[i.tableColumn],label:"Column",items:[{id:i.tableColumnInsertBefore,label:"Insert column before",icon:v[i.tableColumnInsertBefore],onClick:()=>E(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>E({...e,after:!0})},{id:i.tableColumnDelete,label:"Delete column",icon:v[i.tableColumnDelete],onClick:()=>Y(e)},{id:i.tableColumnCut,label:"Cut column",icon:v[i.tableColumnCut],onClick:()=>ze(e)},{id:i.tableColumnCopy,label:"Copy column",icon:v[i.tableColumnCopy],onClick:()=>J(e)},{id:i.tableColumnPasteBefore,label:"Paste column before",icon:v[i.tableColumnPasteBefore],disabled:!t,onClick:()=>G(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>G({...e,after:!0})}]}]},Q="Row settings",Be=e=>e.every(t=>t.is(g)),R=e=>{const{component:t}=e,o=t.is(b),l=t.is(g);if(!(!o&&!l))return l?t:t.closestType(g)},Z=e=>{const{component:t,editor:o,after:l}=e,n=R(e);if(!n)return;const s=n.index()+(l?1:0),r=n.components().length,a=Array.from(Array(r).keys()).map(()=>({type:b})),c=n.parent();if(c){const h=c.append({type:g,components:a},{at:s})[0];if(t.is(b)&&h){const d=t.index(),u=h.components().at(d);u&&o.select(u)}}},ee=e=>{var t;(t=R(e))==null||t.remove(e.opts)},te=e=>{const t=R(e);t&&e.editor.em.set(k,[t])},N=e=>{var a;const{editor:t,after:o}=e,l=R(e);if(!l||!le(e))return;const s=A(t)[0],r=l.index()+(o?1:0);s&&((a=l.parent())==null||a.append(s.clone(),{at:r}))},xe=e=>{R(e)&&(te(e),ee({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=A(e);return t.length&&Be(t)},Ie=e=>{const t=R(e);t&&(e.editor.select(t),M(e,{id:"tableRowSettings",header:{label:Q}}))},oe=e=>{const t=le(e);return[{id:i.tableRowItems,icon:v[i.tableRowProperties],label:"Row",items:[{id:i.tableRowInsertBefore,label:"Insert row before",icon:v[i.tableRowInsertBefore],onClick:()=>Z(e)},{id:i.tableRowInsertAfter,label:"Insert row after",icon:v[i.tableRowInsertAfter],onClick:()=>Z({...e,after:!0})},{id:i.tableRowDelete,label:"Delete row",icon:v[i.tableRowDelete],onClick:()=>ee(e)},{id:i.tableRowProperties,label:Q,icon:v[i.tableRowProperties],onClick:({event:l})=>Ie({...e,event:l})},{id:i.tableRowCut,label:"Cut row",icon:v[i.tableRowCut],onClick:()=>xe(e)},{id:i.tableRowCopy,label:"Copy row",icon:v[i.tableRowCopy],onClick:()=>te(e)},{id:i.tableRowPasteBefore,label:"Paste row before",icon:v[i.tableRowPasteBefore],disabled:!t,onClick:()=>N(e)},{id:i.tableRowPasteAfter,label:"Paste row after",icon:v[i.tableRowPasteAfter],disabled:!t,onClick:()=>N({...e,after:!0})}]},...q(e)]},S=e=>{const t=e.attributes.attributes||{},o=parseInt(`${t.rowspan||1}`,10),l=parseInt(`${t.colspan||1}`,10);return{rowspan:o,colspan:l}};function se(e){const t=[];return e.components().forEach((o,l)=>{o.components().each((n,s)=>{const{rowspan:r,colspan:a}=S(n);if(t[l])for(;t[l][s];)s++;for(let c=l;c<l+r;c++){t[c]||(t[c]=[]);for(let h=s;h<s+a;h++)t[c][h]={real:c===l&&h===s,cell:n,rowspan:r,colspan:a}}})}),t}function C(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const I=e=>e.closestType(g);function ke(e,{x:t,y:o,rows:l,cols:n}){var a;let s=I(e[o][t].cell),r;for(let c=1;c<=l;c++)if(s=(a=s==null?void 0:s.parent())==null?void 0:a.components().at(s.index()+1),s){for(r=t;r>=0;r--){const{cell:h}=e[o+c][r],d=I(h);if(d===s){for(let u=1;u<=n;u++){const f=h.index();d.append({type:b},{at:f+1})}break}}if(r===-1){const d=s.components().at(0).index();for(let u=1;u<=n;u++)s.append({type:b},{at:d})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const n=e[t][o].cell;if(n.em.selected.hasComponent(n)){const{rowspan:s,colspan:r}=S(n);if(r>1||s>1){n.addAttributes({colspan:1,rowspan:1});for(let a=0;a<r-1;a++){const c=n.index();I(n).append({type:b},{at:c+1})}ke(e,{x:o,y:t,rows:s-1,cols:r})}}}}function Me(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const B=(e,t={})=>{var r;const o=se(e),{em:l}=e;let n,s;for(let a=0;a<o.length;a++)for(let c=0;c<o[a].length;c++){const h=o[a][c];if((r=t.selected)!=null&&r.includes(h.cell)||l.selected.hasComponent(h.cell)){const d={x:c,y:a};n||(n=d),s=d}}return{grid:o,startPos:n,endPos:s}};function Se(e,t={}){const o=B(e),{startPos:l,endPos:n}=o;let{grid:s}=o;const{em:r}=e;if(!l||!n)return;const a=l.x,c=l.y,h=n.x,d=n.y,u=C(s,a,c),f=C(s,h,d);if(u&&f){ne(s),s=se(e);const w=[],P=C(s,a,c).cell;P.addAttributes({colspan:h-a+1,rowspan:d-c+1});for(let m=c;m<=d;m++)for(let V=a;V<=h;V++){const z=C(s,V,m);if(!z)continue;const{cell:D}=z;D!==P&&w.push(D)}w.forEach(m=>{t.mergeContent&&P.append(m.components().models),m.remove()}),r.setSelected(P),Me(e)}}const ae="Cell settings",De="Merge cells",Te="Split cell",Le=e=>e.closestType(g),H=e=>{var t;return(t=Le(e))==null?void 0:t.parent()},Ee=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]),l=t[0];if(!o||!(l!=null&&l.is(b))||t.length>1)return!1;const{rowspan:n,colspan:s}=S(l);return!(s<2&&n<2)},Ge=e=>{const o=e.editor.getSelectedAll()[0],l=H(o),{grid:n}=B(l);ne(n)},ce=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]);if(!o||t.length<2||t.some(a=>!a.is(b)||H(a)!==o))return!1;const{grid:l,startPos:n,endPos:s}=B(o),{em:r}=o;if(!n||!s)return!1;for(let a=n.y;a<=s.y;a++)for(let c=n.x;c<=s.x;c++){const h=C(l,c,a);if(!h||!r.selected.hasComponent(h.cell))return!1}return!0},Ze=e=>{const{editor:t}=e;if(!ce(e))return;const o=t.getSelectedAll(),l=H(o[0]);Se(l,{mergeContent:!0})},Ne=e=>{M(e,{id:"tableCellSettings",header:{label:ae}})},Fe=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:v[i.tableCellProperties],onClick:({event:o})=>Ne({...e,event:o})},{id:i.tableCellMerge,label:De,icon:v[i.tableCellMerge],onClick:()=>Ze(e),disabled:!ce(e)},{id:i.tableCellSplit,label:Te,icon:v[i.tableCellSplit],onClick:()=>Ge(e),disabled:!Ee(e)}]},...Ae(e),...oe(e)],Oe=e=>{const t=e[0]&&H(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:n}=B(t,{selected:e});if(!l||!n)return;const s=[];for(let r=l.y;r<=n.y;r++)for(let a=l.x;a<=n.x;a++){const c=C(o,a,r);c&&s.push(c.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})},Ue=function(e,t={}){const o={block:{},...t},{Components:l}=e,n={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};l.addType(p,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:p,style:{width:"100%"}},select:!0,...o.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:v.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:r,value:a,emitUpdate:c}){const h=r.find("caption")[0];a?!h&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),c(),e.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Re(x,{rows:5}),contextMenu:({items:r,editor:a,component:c})=>[...q({editor:a,component:c,opts:o}),...r]}}}),l.addType(W,{model:{defaults:{icon:v.tableHead,...n}}}),l.addType(_,{model:{defaults:{icon:v.tableFoot,...n}}}),l.addType(x,{model:{defaults:{icon:v.tableRowProperties,...n}}}),l.addType(g,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:a,component:c})=>[...oe({editor:a,component:c,opts:o}),...r]}}}),l.addType(b,{model:{defaults:{icon:v.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:r,editor:a,component:c})=>[...Fe({editor:a,component:c,opts:o}),...r]}}});const s=re((r,a)=>{var u;const c=e.getSelectedAll(),h=!!((u=a==null?void 0:a.event)!=null&&u.shiftKey);if(c.length<2||!h||a.fromCell)return;const d=c.map(f=>f.is(b)?f:f.closestType(b)).filter(Boolean);d.length===c.length&&Oe(d)},0);e.on("component:select",s),fe({editor:e,plan:ye,pluginName:we,licenseKey:o.licenseKey,cleanup:()=>{e.off("component:select",s),e.Blocks.remove(p),Ce.forEach(r=>l.removeType(r))}})},$e=pe(Ue);module.exports=$e;
|