@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.37
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 +185 -159
- package/dist/accordionComponent/index.umd.js +7 -7
- package/dist/aiChat/clientToolsProcessors.d.ts +1 -2
- package/dist/aiChat/components/utils.d.ts +1 -0
- package/dist/aiChat/components/utilsTw.d.ts +11 -0
- package/dist/aiChat/index.cjs.js +75 -75
- package/dist/aiChat/index.es.js +9122 -8628
- package/dist/aiChat/index.js +75 -75
- package/dist/aiChat/index.umd.js +75 -75
- package/dist/aiChat/projectGeneration.d.ts +17 -0
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +221 -195
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +199 -173
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +149 -123
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +186 -160
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +5 -5
- package/dist/canvasGridMode/index.es.js +263 -237
- package/dist/canvasGridMode/index.umd.js +2 -2
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +168 -142
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +9 -9
- package/dist/dataSourceEjs/index.es.js +271 -245
- package/dist/dataSourceEjs/index.umd.js +9 -9
- package/dist/dataSourceHandlebars/index.cjs.js +8 -8
- package/dist/dataSourceHandlebars/index.es.js +232 -206
- package/dist/dataSourceHandlebars/index.umd.js +8 -8
- package/dist/dialogComponent/index.cjs.js +14 -14
- package/dist/dialogComponent/index.es.js +157 -131
- package/dist/dialogComponent/index.umd.js +14 -14
- package/dist/flexComponent/index.cjs.js +13 -13
- package/dist/flexComponent/index.es.js +497 -471
- package/dist/flexComponent/index.umd.js +13 -13
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +189 -163
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +175 -149
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +207 -181
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +36 -36
- package/dist/index.es.js +917 -891
- package/dist/index.umd.js +36 -36
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +192 -166
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +265 -239
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +121 -95
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +171 -145
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +227 -201
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +457 -431
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +248 -223
- 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 +150 -124
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +143 -117
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +218 -192
- package/dist/swiperComponent/index.umd.js +7 -7
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +275 -249
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +134 -108
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +2 -2
|
@@ -1,41 +1,54 @@
|
|
|
1
1
|
function ce(e, t, o) {
|
|
2
|
-
let l,
|
|
2
|
+
let l, n, s, c, a;
|
|
3
3
|
const r = t;
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
function h() {
|
|
5
|
+
const d = Date.now() - c;
|
|
6
|
+
d < r && d >= 0 ? l = setTimeout(h, r - d) : (l = null, a = e.apply(s, n), s = n = null);
|
|
7
7
|
}
|
|
8
|
-
const
|
|
9
|
-
return s = this,
|
|
8
|
+
const v = function() {
|
|
9
|
+
return s = this, n = arguments, c = Date.now(), l || (l = setTimeout(h, r)), a;
|
|
10
10
|
};
|
|
11
|
-
return
|
|
11
|
+
return v.clear = function() {
|
|
12
12
|
l && (clearTimeout(l), l = null);
|
|
13
|
-
},
|
|
14
|
-
l && (
|
|
15
|
-
},
|
|
13
|
+
}, v.flush = function() {
|
|
14
|
+
l && (a = e.apply(s, n), s = n = null, clearTimeout(l), l = null);
|
|
15
|
+
}, v;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
O,
|
|
19
|
-
ie,
|
|
17
|
+
const F = "app.grapesjs.com", U = "app-stage.grapesjs.com", ie = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", S = [
|
|
20
18
|
F,
|
|
21
|
-
|
|
19
|
+
ie,
|
|
20
|
+
U,
|
|
21
|
+
he,
|
|
22
22
|
"localhost",
|
|
23
23
|
"127.0.0.1",
|
|
24
24
|
".local-credentialless.webcontainer.io",
|
|
25
25
|
// For stackblitz.com demos
|
|
26
26
|
".local.webcontainer.io",
|
|
27
27
|
// For stackblitz.com demos
|
|
28
|
-
"-sandpack.codesandbox.io"
|
|
28
|
+
"-sandpack.codesandbox.io",
|
|
29
29
|
// For Sandpack demos
|
|
30
|
-
|
|
30
|
+
".claudemcpcontent.com",
|
|
31
|
+
// For Claude mcp app
|
|
32
|
+
".web-sandbox.oaiusercontent.com"
|
|
33
|
+
// For OpenAI mcp app
|
|
34
|
+
], de = "license:check:end", ve = () => typeof window < "u", ue = ({
|
|
31
35
|
isDev: e,
|
|
32
36
|
isStage: t,
|
|
33
37
|
isPlatform: o
|
|
34
|
-
}) => `${e ? "" : `https://${t ?
|
|
35
|
-
|
|
38
|
+
}) => `${e ? "" : `https://${t ? U : F}`}/${o ? "platform-api" : "api"}`, ge = () => {
|
|
39
|
+
if (!ve()) return "";
|
|
40
|
+
const { hostname: e } = window.location;
|
|
41
|
+
if (e) return e;
|
|
42
|
+
try {
|
|
43
|
+
return window.parent.location.hostname || "";
|
|
44
|
+
} catch {
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
}, be = () => {
|
|
48
|
+
const e = ge();
|
|
36
49
|
return !!e && (S.includes(e) || S.some((t) => e.endsWith(t)));
|
|
37
50
|
};
|
|
38
|
-
function
|
|
51
|
+
function $(e) {
|
|
39
52
|
return typeof e == "function";
|
|
40
53
|
}
|
|
41
54
|
async function pe({
|
|
@@ -43,10 +56,10 @@ async function pe({
|
|
|
43
56
|
baseApiUrl: t,
|
|
44
57
|
method: o = "GET",
|
|
45
58
|
headers: l = {},
|
|
46
|
-
params:
|
|
59
|
+
params: n,
|
|
47
60
|
body: s
|
|
48
61
|
}) {
|
|
49
|
-
const
|
|
62
|
+
const a = `${t || ue({ isDev: !1, isStage: !1 })}${e}`, r = {
|
|
50
63
|
method: o,
|
|
51
64
|
headers: {
|
|
52
65
|
"Content-Type": "application/json",
|
|
@@ -54,12 +67,12 @@ async function pe({
|
|
|
54
67
|
}
|
|
55
68
|
};
|
|
56
69
|
s && (r.body = JSON.stringify(s));
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
59
|
-
throw new Error(`HTTP error! status: ${
|
|
60
|
-
return
|
|
70
|
+
const h = n ? new URLSearchParams(n).toString() : "", v = h ? `?${h}` : "", d = await fetch(`${a}${v}`, r);
|
|
71
|
+
if (!d.ok)
|
|
72
|
+
throw new Error(`HTTP error! status: ${d.status}`);
|
|
73
|
+
return d.json();
|
|
61
74
|
}
|
|
62
|
-
var C = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(C || {}),
|
|
75
|
+
var C = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(C || {}), x = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", 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.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", 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.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", 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))(x || {});
|
|
63
76
|
const E = {
|
|
64
77
|
[C.free]: 0,
|
|
65
78
|
[C.startup]: 10,
|
|
@@ -76,38 +89,51 @@ async function we({
|
|
|
76
89
|
plan: t,
|
|
77
90
|
pluginName: o,
|
|
78
91
|
licenseKey: l,
|
|
79
|
-
onLicenseCheckResponse:
|
|
92
|
+
onLicenseCheckResponse: n,
|
|
80
93
|
cleanup: s
|
|
81
94
|
}) {
|
|
82
|
-
let c = "",
|
|
83
|
-
const r =
|
|
84
|
-
console.warn("Cleanup plugin:", o, "Reason:",
|
|
85
|
-
},
|
|
95
|
+
let c = "", a;
|
|
96
|
+
const r = (d) => {
|
|
97
|
+
console.warn("Cleanup plugin:", o, "Reason:", d), s();
|
|
98
|
+
}, h = (d = {}) => {
|
|
86
99
|
var y;
|
|
87
|
-
const { error: p, sdkLicense: V } =
|
|
88
|
-
if (!(V ||
|
|
89
|
-
|
|
100
|
+
const { error: p, sdkLicense: V } = d, m = (y = d.plan) == null ? void 0 : y.category;
|
|
101
|
+
if (!(V || d.license) || p)
|
|
102
|
+
r(p || "Invalid license");
|
|
90
103
|
else if (m) {
|
|
91
104
|
const z = E[t], A = E[m];
|
|
92
|
-
z > A &&
|
|
105
|
+
z > A && r({ pluginRequiredPlan: t, licensePlan: m });
|
|
93
106
|
}
|
|
94
107
|
};
|
|
95
|
-
e.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
108
|
+
e.Commands.has(x.settings) && (a = e.runCommand(x.settings), c = (a == null ? void 0 : a.baseUrl) || "");
|
|
109
|
+
const v = (d) => {
|
|
110
|
+
n == null || n(d), d && h(d);
|
|
111
|
+
};
|
|
112
|
+
if (!a) {
|
|
113
|
+
e.onReady(async () => {
|
|
114
|
+
if (!be())
|
|
115
|
+
if (l) {
|
|
116
|
+
const d = await Ce({ licenseKey: l, pluginName: o, baseApiUrl: c });
|
|
117
|
+
v(d);
|
|
118
|
+
} else
|
|
119
|
+
r("The `licenseKey` option not provided");
|
|
120
|
+
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (a.licensePlan || a.licenseError) {
|
|
124
|
+
const d = ye(a);
|
|
125
|
+
v(d);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
e.on(de, (d) => v(d));
|
|
109
129
|
}
|
|
110
|
-
|
|
130
|
+
const ye = (e) => ({
|
|
131
|
+
sdkLicense: e.license,
|
|
132
|
+
license: e.license,
|
|
133
|
+
error: e.licenseError,
|
|
134
|
+
plan: e.licensePlan
|
|
135
|
+
});
|
|
136
|
+
async function Ce(e) {
|
|
111
137
|
const { licenseKey: t, pluginName: o, baseApiUrl: l } = e;
|
|
112
138
|
try {
|
|
113
139
|
return (await pe({
|
|
@@ -119,13 +145,13 @@ async function ye(e) {
|
|
|
119
145
|
pn: o
|
|
120
146
|
}
|
|
121
147
|
})).result || {};
|
|
122
|
-
} catch (
|
|
123
|
-
return console.error("Error during SDK license check:",
|
|
148
|
+
} catch (n) {
|
|
149
|
+
return console.error("Error during SDK license check:", n), !1;
|
|
124
150
|
}
|
|
125
151
|
}
|
|
126
|
-
const
|
|
152
|
+
const He = "tableComponent", Re = C.startup;
|
|
127
153
|
var i = /* @__PURE__ */ ((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 || {});
|
|
128
|
-
const
|
|
154
|
+
const u = {
|
|
129
155
|
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>',
|
|
130
156
|
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>',
|
|
131
157
|
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>',
|
|
@@ -153,10 +179,10 @@ const v = {
|
|
|
153
179
|
tableColumnCopy: '<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',
|
|
154
180
|
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>',
|
|
155
181
|
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>'
|
|
156
|
-
}, f = "table", W = "thead", _ = "tfoot",
|
|
157
|
-
const { editor: o, event: l, opts:
|
|
182
|
+
}, f = "table", W = "thead", _ = "tfoot", M = "tbody", b = "row", g = "cell", D = "clipboardTable", Pe = [f, W, _, M, b, g], B = (e) => e.em.get(D) || [], Ve = (e) => e.every((t) => t.is(g)), T = (e, t) => {
|
|
183
|
+
const { editor: o, event: l, opts: n } = e, s = l.currentTarget || l.target, { x: c, y: a, width: r, height: h } = s.getBoundingClientRect(), v = {
|
|
158
184
|
style: { width: 240, height: 300 },
|
|
159
|
-
placer: { type: "popover", closeOnClickAway: !0, x: c, y:
|
|
185
|
+
placer: { type: "popover", closeOnClickAway: !0, x: c, y: a, w: r, h },
|
|
160
186
|
layout: {
|
|
161
187
|
type: "tabs",
|
|
162
188
|
value: "props",
|
|
@@ -175,42 +201,42 @@ const v = {
|
|
|
175
201
|
},
|
|
176
202
|
...t
|
|
177
203
|
};
|
|
178
|
-
|
|
179
|
-
},
|
|
204
|
+
$(n.openSettings) ? n.openSettings({ ...e, layoutProps: v }) : o.runCommand(x.layoutToggle, v);
|
|
205
|
+
}, ze = (e, {
|
|
180
206
|
rows: t = 1,
|
|
181
207
|
cells: o = 5,
|
|
182
208
|
text: l
|
|
183
209
|
} = {}) => ({
|
|
184
210
|
type: e,
|
|
185
|
-
components: Array.from(Array(t).keys()).map((
|
|
211
|
+
components: Array.from(Array(t).keys()).map((n) => ({
|
|
186
212
|
type: b,
|
|
187
213
|
components: Array.from(Array(o).keys()).map((s) => ({
|
|
188
214
|
type: g,
|
|
189
|
-
components: l ? { type: "text", content:
|
|
215
|
+
components: l ? { type: "text", content: $(l) ? l({ y: n, x: s }) : l } : void 0
|
|
190
216
|
}))
|
|
191
217
|
}))
|
|
192
218
|
}), j = "Table settings", K = (e) => {
|
|
193
219
|
const { component: t } = e;
|
|
194
220
|
return t.is(f) ? t : t.closestType(f);
|
|
195
|
-
},
|
|
221
|
+
}, Ae = (e) => {
|
|
196
222
|
var t;
|
|
197
223
|
(t = K(e)) == null || t.remove(e.opts);
|
|
198
|
-
},
|
|
224
|
+
}, xe = (e) => {
|
|
199
225
|
const t = K(e);
|
|
200
|
-
t && (e.editor.select(t),
|
|
226
|
+
t && (e.editor.select(t), T(e, {
|
|
201
227
|
id: "tableSettings",
|
|
202
228
|
header: { label: j }
|
|
203
229
|
}));
|
|
204
230
|
}, q = (e) => [{
|
|
205
231
|
id: i.table,
|
|
206
|
-
icon:
|
|
232
|
+
icon: u[i.table],
|
|
207
233
|
label: "Table",
|
|
208
234
|
items: [
|
|
209
235
|
{
|
|
210
236
|
id: i.tableSettings,
|
|
211
237
|
label: j,
|
|
212
|
-
icon:
|
|
213
|
-
onClick: ({ event: o }) =>
|
|
238
|
+
icon: u[i.tableSettings],
|
|
239
|
+
onClick: ({ event: o }) => xe({
|
|
214
240
|
...e,
|
|
215
241
|
// @ts-expect-error workaround for the build
|
|
216
242
|
event: o
|
|
@@ -219,107 +245,107 @@ const v = {
|
|
|
219
245
|
{
|
|
220
246
|
id: i.tableDelete,
|
|
221
247
|
label: "Delete table",
|
|
222
|
-
icon:
|
|
223
|
-
onClick: () =>
|
|
248
|
+
icon: u[i.tableDelete],
|
|
249
|
+
onClick: () => Ae(e)
|
|
224
250
|
}
|
|
225
251
|
]
|
|
226
252
|
}], X = ({ editor: e }) => {
|
|
227
|
-
const t =
|
|
228
|
-
return t.length &&
|
|
253
|
+
const t = B(e);
|
|
254
|
+
return t.length && Ve(t);
|
|
229
255
|
}, G = ({ component: e, editor: t, after: o }) => {
|
|
230
256
|
if (!e.is(g)) return;
|
|
231
|
-
const l = e.closestType(f),
|
|
232
|
-
l == null || l.findType(b).forEach((
|
|
233
|
-
const c =
|
|
257
|
+
const l = e.closestType(f), n = e.closestType(b), s = e.index() + (o ? 1 : 0);
|
|
258
|
+
l == null || l.findType(b).forEach((a) => a.append({ type: g }, { at: s }));
|
|
259
|
+
const c = n == null ? void 0 : n.components().at(s);
|
|
234
260
|
c && t.select(c);
|
|
235
261
|
}, Y = ({ component: e, opts: t }) => {
|
|
236
262
|
if (!e.is(g)) return;
|
|
237
263
|
const o = e.closestType(f), l = e.index();
|
|
238
|
-
o == null || o.findType(b).forEach((
|
|
264
|
+
o == null || o.findType(b).forEach((n) => {
|
|
239
265
|
var s;
|
|
240
|
-
return (s =
|
|
266
|
+
return (s = n.components().at(l)) == null ? void 0 : s.remove(t);
|
|
241
267
|
});
|
|
242
268
|
}, J = ({ component: e, editor: t }) => {
|
|
243
269
|
if (!e.is(g)) return;
|
|
244
|
-
const o = e.closestType(f), l = e.index(),
|
|
245
|
-
|
|
246
|
-
},
|
|
270
|
+
const o = e.closestType(f), l = e.index(), n = (o == null ? void 0 : o.findType(b).map((s) => s.components().at(l))) || [];
|
|
271
|
+
n.length && t.em.set(D, n);
|
|
272
|
+
}, N = (e) => {
|
|
247
273
|
const { component: t, editor: o, after: l } = e;
|
|
248
274
|
if (!t.is(g) || !X(e)) return;
|
|
249
|
-
const
|
|
250
|
-
s == null || s.findType(b).forEach((
|
|
251
|
-
const
|
|
252
|
-
|
|
275
|
+
const n = B(o), s = t.closestType(f), c = t.index() + (l ? 1 : 0);
|
|
276
|
+
s == null || s.findType(b).forEach((a, r) => {
|
|
277
|
+
const h = n[r], v = (h == null ? void 0 : h.clone()) || { type: g };
|
|
278
|
+
a.append(v, { at: c });
|
|
253
279
|
});
|
|
254
|
-
},
|
|
280
|
+
}, Be = (e) => {
|
|
255
281
|
const { component: t } = e;
|
|
256
282
|
t.is(g) && (J(e), Y({ ...e, opts: { temporary: !0 } }));
|
|
257
|
-
},
|
|
283
|
+
}, Ie = (e) => {
|
|
258
284
|
const t = X(e);
|
|
259
285
|
return [{
|
|
260
286
|
id: i.tableColumnItems,
|
|
261
|
-
icon:
|
|
287
|
+
icon: u[i.tableColumn],
|
|
262
288
|
label: "Column",
|
|
263
289
|
items: [
|
|
264
290
|
{
|
|
265
291
|
id: i.tableColumnInsertBefore,
|
|
266
292
|
label: "Insert column before",
|
|
267
|
-
icon:
|
|
293
|
+
icon: u[i.tableColumnInsertBefore],
|
|
268
294
|
onClick: () => G(e)
|
|
269
295
|
},
|
|
270
296
|
{
|
|
271
297
|
id: i.tableColumnInsertAfter,
|
|
272
298
|
label: "Insert column after",
|
|
273
|
-
icon:
|
|
299
|
+
icon: u[i.tableColumnInsertAfter],
|
|
274
300
|
onClick: () => G({ ...e, after: !0 })
|
|
275
301
|
},
|
|
276
302
|
{
|
|
277
303
|
id: i.tableColumnDelete,
|
|
278
304
|
label: "Delete column",
|
|
279
|
-
icon:
|
|
305
|
+
icon: u[i.tableColumnDelete],
|
|
280
306
|
onClick: () => Y(e)
|
|
281
307
|
},
|
|
282
308
|
{
|
|
283
309
|
id: i.tableColumnCut,
|
|
284
310
|
label: "Cut column",
|
|
285
|
-
icon:
|
|
286
|
-
onClick: () =>
|
|
311
|
+
icon: u[i.tableColumnCut],
|
|
312
|
+
onClick: () => Be(e)
|
|
287
313
|
},
|
|
288
314
|
{
|
|
289
315
|
id: i.tableColumnCopy,
|
|
290
316
|
label: "Copy column",
|
|
291
|
-
icon:
|
|
317
|
+
icon: u[i.tableColumnCopy],
|
|
292
318
|
onClick: () => J(e)
|
|
293
319
|
},
|
|
294
320
|
{
|
|
295
321
|
id: i.tableColumnPasteBefore,
|
|
296
322
|
label: "Paste column before",
|
|
297
|
-
icon:
|
|
323
|
+
icon: u[i.tableColumnPasteBefore],
|
|
298
324
|
disabled: !t,
|
|
299
|
-
onClick: () =>
|
|
325
|
+
onClick: () => N(e)
|
|
300
326
|
},
|
|
301
327
|
{
|
|
302
328
|
id: i.tableColumnPasteAfter,
|
|
303
329
|
label: "Paste column after",
|
|
304
|
-
icon:
|
|
330
|
+
icon: u[i.tableColumnPasteAfter],
|
|
305
331
|
disabled: !t,
|
|
306
|
-
onClick: () =>
|
|
332
|
+
onClick: () => N({ ...e, after: !0 })
|
|
307
333
|
}
|
|
308
334
|
]
|
|
309
335
|
}];
|
|
310
|
-
}, Q = "Row settings",
|
|
336
|
+
}, Q = "Row settings", Me = (e) => e.every((t) => t.is(b)), P = (e) => {
|
|
311
337
|
const { component: t } = e, o = t.is(g), l = t.is(b);
|
|
312
338
|
if (!(!o && !l))
|
|
313
339
|
return l ? t : t.closestType(b);
|
|
314
|
-
},
|
|
315
|
-
const { component: t, editor: o, after: l } = e,
|
|
316
|
-
if (!
|
|
317
|
-
const s =
|
|
340
|
+
}, Z = (e) => {
|
|
341
|
+
const { component: t, editor: o, after: l } = e, n = P(e);
|
|
342
|
+
if (!n) return;
|
|
343
|
+
const s = n.index() + (l ? 1 : 0), c = n.components().length, a = Array.from(Array(c).keys()).map(() => ({ type: g })), r = n.parent();
|
|
318
344
|
if (r) {
|
|
319
|
-
const
|
|
320
|
-
if (t.is(g) &&
|
|
321
|
-
const
|
|
322
|
-
|
|
345
|
+
const h = r.append({ type: b, components: a }, { at: s })[0];
|
|
346
|
+
if (t.is(g) && h) {
|
|
347
|
+
const v = t.index(), d = h.components().at(v);
|
|
348
|
+
d && o.select(d);
|
|
323
349
|
}
|
|
324
350
|
}
|
|
325
351
|
}, ee = (e) => {
|
|
@@ -328,20 +354,20 @@ const v = {
|
|
|
328
354
|
}, te = (e) => {
|
|
329
355
|
const t = P(e);
|
|
330
356
|
t && e.editor.em.set(D, [t]);
|
|
331
|
-
},
|
|
332
|
-
var
|
|
357
|
+
}, O = (e) => {
|
|
358
|
+
var a;
|
|
333
359
|
const { editor: t, after: o } = e, l = P(e);
|
|
334
360
|
if (!l || !le(e)) return;
|
|
335
|
-
const s =
|
|
336
|
-
s && ((
|
|
337
|
-
},
|
|
361
|
+
const s = B(t)[0], c = l.index() + (o ? 1 : 0);
|
|
362
|
+
s && ((a = l.parent()) == null || a.append(s.clone(), { at: c }));
|
|
363
|
+
}, ke = (e) => {
|
|
338
364
|
P(e) && (te(e), ee({ ...e, opts: { temporary: !0 } }));
|
|
339
365
|
}, le = ({ editor: e }) => {
|
|
340
|
-
const t =
|
|
341
|
-
return t.length &&
|
|
366
|
+
const t = B(e);
|
|
367
|
+
return t.length && Me(t);
|
|
342
368
|
}, De = (e) => {
|
|
343
369
|
const t = P(e);
|
|
344
|
-
t && (e.editor.select(t),
|
|
370
|
+
t && (e.editor.select(t), T(e, {
|
|
345
371
|
id: "tableRowSettings",
|
|
346
372
|
header: { label: Q }
|
|
347
373
|
}));
|
|
@@ -349,31 +375,31 @@ const v = {
|
|
|
349
375
|
const t = le(e);
|
|
350
376
|
return [{
|
|
351
377
|
id: i.tableRowItems,
|
|
352
|
-
icon:
|
|
378
|
+
icon: u[i.tableRowProperties],
|
|
353
379
|
label: "Row",
|
|
354
380
|
items: [
|
|
355
381
|
{
|
|
356
382
|
id: i.tableRowInsertBefore,
|
|
357
383
|
label: "Insert row before",
|
|
358
|
-
icon:
|
|
359
|
-
onClick: () =>
|
|
384
|
+
icon: u[i.tableRowInsertBefore],
|
|
385
|
+
onClick: () => Z(e)
|
|
360
386
|
},
|
|
361
387
|
{
|
|
362
388
|
id: i.tableRowInsertAfter,
|
|
363
389
|
label: "Insert row after",
|
|
364
|
-
icon:
|
|
365
|
-
onClick: () =>
|
|
390
|
+
icon: u[i.tableRowInsertAfter],
|
|
391
|
+
onClick: () => Z({ ...e, after: !0 })
|
|
366
392
|
},
|
|
367
393
|
{
|
|
368
394
|
id: i.tableRowDelete,
|
|
369
395
|
label: "Delete row",
|
|
370
|
-
icon:
|
|
396
|
+
icon: u[i.tableRowDelete],
|
|
371
397
|
onClick: () => ee(e)
|
|
372
398
|
},
|
|
373
399
|
{
|
|
374
400
|
id: i.tableRowProperties,
|
|
375
401
|
label: Q,
|
|
376
|
-
icon:
|
|
402
|
+
icon: u[i.tableRowProperties],
|
|
377
403
|
onClick: ({ event: l }) => De({
|
|
378
404
|
...e,
|
|
379
405
|
// @ts-expect-error workaround for the build
|
|
@@ -383,51 +409,51 @@ const v = {
|
|
|
383
409
|
{
|
|
384
410
|
id: i.tableRowCut,
|
|
385
411
|
label: "Cut row",
|
|
386
|
-
icon:
|
|
387
|
-
onClick: () =>
|
|
412
|
+
icon: u[i.tableRowCut],
|
|
413
|
+
onClick: () => ke(e)
|
|
388
414
|
},
|
|
389
415
|
{
|
|
390
416
|
id: i.tableRowCopy,
|
|
391
417
|
label: "Copy row",
|
|
392
|
-
icon:
|
|
418
|
+
icon: u[i.tableRowCopy],
|
|
393
419
|
onClick: () => te(e)
|
|
394
420
|
},
|
|
395
421
|
{
|
|
396
422
|
id: i.tableRowPasteBefore,
|
|
397
423
|
label: "Paste row before",
|
|
398
|
-
icon:
|
|
424
|
+
icon: u[i.tableRowPasteBefore],
|
|
399
425
|
disabled: !t,
|
|
400
|
-
onClick: () =>
|
|
426
|
+
onClick: () => O(e)
|
|
401
427
|
},
|
|
402
428
|
{
|
|
403
429
|
id: i.tableRowPasteAfter,
|
|
404
430
|
label: "Paste row after",
|
|
405
|
-
icon:
|
|
431
|
+
icon: u[i.tableRowPasteAfter],
|
|
406
432
|
disabled: !t,
|
|
407
|
-
onClick: () =>
|
|
433
|
+
onClick: () => O({ ...e, after: !0 })
|
|
408
434
|
}
|
|
409
435
|
]
|
|
410
436
|
}, ...q(e)];
|
|
411
|
-
},
|
|
437
|
+
}, L = (e) => {
|
|
412
438
|
const t = e.attributes.attributes || {}, o = parseInt(`${t.rowspan || 1}`, 10), l = parseInt(`${t.colspan || 1}`, 10);
|
|
413
439
|
return { rowspan: o, colspan: l };
|
|
414
440
|
};
|
|
415
|
-
function
|
|
441
|
+
function ne(e) {
|
|
416
442
|
const t = [];
|
|
417
443
|
return e.components().forEach((o, l) => {
|
|
418
|
-
o.components().each((
|
|
419
|
-
const { rowspan: c, colspan:
|
|
444
|
+
o.components().each((n, s) => {
|
|
445
|
+
const { rowspan: c, colspan: a } = L(n);
|
|
420
446
|
if (t[l])
|
|
421
447
|
for (; t[l][s]; )
|
|
422
448
|
s++;
|
|
423
449
|
for (let r = l; r < l + c; r++) {
|
|
424
450
|
t[r] || (t[r] = []);
|
|
425
|
-
for (let
|
|
426
|
-
t[r][
|
|
427
|
-
real: r === l &&
|
|
428
|
-
cell:
|
|
451
|
+
for (let h = s; h < s + a; h++)
|
|
452
|
+
t[r][h] = {
|
|
453
|
+
real: r === l && h === s,
|
|
454
|
+
cell: n,
|
|
429
455
|
rowspan: c,
|
|
430
|
-
colspan:
|
|
456
|
+
colspan: a
|
|
431
457
|
};
|
|
432
458
|
}
|
|
433
459
|
});
|
|
@@ -437,86 +463,86 @@ function H(e, t, o) {
|
|
|
437
463
|
var l;
|
|
438
464
|
return (l = e[o]) == null ? void 0 : l[t];
|
|
439
465
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
442
|
-
var
|
|
443
|
-
let s =
|
|
466
|
+
const k = (e) => e.closestType(b);
|
|
467
|
+
function Te(e, { x: t, y: o, rows: l, cols: n }) {
|
|
468
|
+
var a;
|
|
469
|
+
let s = k(e[o][t].cell), c;
|
|
444
470
|
for (let r = 1; r <= l; r++)
|
|
445
|
-
if (s = (
|
|
471
|
+
if (s = (a = s == null ? void 0 : s.parent()) == null ? void 0 : a.components().at(s.index() + 1), s) {
|
|
446
472
|
for (c = t; c >= 0; c--) {
|
|
447
|
-
const { cell:
|
|
448
|
-
if (
|
|
449
|
-
for (let
|
|
450
|
-
const p =
|
|
451
|
-
|
|
473
|
+
const { cell: h } = e[o + r][c], v = k(h);
|
|
474
|
+
if (v === s) {
|
|
475
|
+
for (let d = 1; d <= n; d++) {
|
|
476
|
+
const p = h.index();
|
|
477
|
+
v.append({ type: g }, { at: p + 1 });
|
|
452
478
|
}
|
|
453
479
|
break;
|
|
454
480
|
}
|
|
455
481
|
}
|
|
456
482
|
if (c === -1) {
|
|
457
|
-
const
|
|
458
|
-
for (let
|
|
459
|
-
s.append({ type: g }, { at:
|
|
483
|
+
const v = s.components().at(0).index();
|
|
484
|
+
for (let d = 1; d <= n; d++)
|
|
485
|
+
s.append({ type: g }, { at: v });
|
|
460
486
|
}
|
|
461
487
|
}
|
|
462
488
|
}
|
|
463
489
|
function se(e) {
|
|
464
490
|
for (let t = 0; t < e.length; t++)
|
|
465
491
|
for (let o = 0; o < e[t].length; o++) {
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
-
const { rowspan: s, colspan: c } =
|
|
492
|
+
const n = e[t][o].cell;
|
|
493
|
+
if (n.em.selected.hasComponent(n)) {
|
|
494
|
+
const { rowspan: s, colspan: c } = L(n);
|
|
469
495
|
if (c > 1 || s > 1) {
|
|
470
|
-
|
|
471
|
-
for (let
|
|
472
|
-
const r =
|
|
473
|
-
|
|
496
|
+
n.addAttributes({ colspan: 1, rowspan: 1 });
|
|
497
|
+
for (let a = 0; a < c - 1; a++) {
|
|
498
|
+
const r = n.index();
|
|
499
|
+
k(n).append({ type: g }, { at: r + 1 });
|
|
474
500
|
}
|
|
475
|
-
|
|
501
|
+
Te(e, { x: o, y: t, rows: s - 1, cols: c });
|
|
476
502
|
}
|
|
477
503
|
}
|
|
478
504
|
}
|
|
479
505
|
}
|
|
480
|
-
function
|
|
506
|
+
function Le(e) {
|
|
481
507
|
const t = [];
|
|
482
508
|
e.components().forEach((o) => {
|
|
483
509
|
o.components().length || t.push(o);
|
|
484
510
|
}), t.forEach((o) => o.remove());
|
|
485
511
|
}
|
|
486
|
-
const
|
|
512
|
+
const I = (e, t = {}) => {
|
|
487
513
|
var c;
|
|
488
|
-
const o =
|
|
489
|
-
let
|
|
490
|
-
for (let
|
|
491
|
-
for (let r = 0; r < o[
|
|
492
|
-
const
|
|
493
|
-
if ((c = t.selected) != null && c.includes(
|
|
494
|
-
const
|
|
495
|
-
|
|
514
|
+
const o = ne(e), { em: l } = e;
|
|
515
|
+
let n, s;
|
|
516
|
+
for (let a = 0; a < o.length; a++)
|
|
517
|
+
for (let r = 0; r < o[a].length; r++) {
|
|
518
|
+
const h = o[a][r];
|
|
519
|
+
if ((c = t.selected) != null && c.includes(h.cell) || l.selected.hasComponent(h.cell)) {
|
|
520
|
+
const v = { x: r, y: a };
|
|
521
|
+
n || (n = v), s = v;
|
|
496
522
|
}
|
|
497
523
|
}
|
|
498
524
|
return {
|
|
499
525
|
grid: o,
|
|
500
|
-
startPos:
|
|
526
|
+
startPos: n,
|
|
501
527
|
endPos: s
|
|
502
528
|
};
|
|
503
529
|
};
|
|
504
530
|
function Se(e, t = {}) {
|
|
505
|
-
const o =
|
|
531
|
+
const o = I(e), { startPos: l, endPos: n } = o;
|
|
506
532
|
let { grid: s } = o;
|
|
507
533
|
const { em: c } = e;
|
|
508
|
-
if (!l || !
|
|
534
|
+
if (!l || !n)
|
|
509
535
|
return;
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
512
|
-
se(s), s =
|
|
513
|
-
const V = [], m = H(s,
|
|
536
|
+
const a = l.x, r = l.y, h = n.x, v = n.y, d = H(s, a, r), p = H(s, h, v);
|
|
537
|
+
if (d && p) {
|
|
538
|
+
se(s), s = ne(e);
|
|
539
|
+
const V = [], m = H(s, a, r).cell;
|
|
514
540
|
m.addAttributes({
|
|
515
|
-
colspan:
|
|
516
|
-
rowspan:
|
|
541
|
+
colspan: h - a + 1,
|
|
542
|
+
rowspan: v - r + 1
|
|
517
543
|
});
|
|
518
|
-
for (let w = r; w <=
|
|
519
|
-
for (let y =
|
|
544
|
+
for (let w = r; w <= v; w++)
|
|
545
|
+
for (let y = a; y <= h; y++) {
|
|
520
546
|
const z = H(s, y, w);
|
|
521
547
|
if (!z) continue;
|
|
522
548
|
const { cell: A } = z;
|
|
@@ -524,54 +550,54 @@ function Se(e, t = {}) {
|
|
|
524
550
|
}
|
|
525
551
|
V.forEach((w) => {
|
|
526
552
|
t.mergeContent && m.append(w.components().models), w.remove();
|
|
527
|
-
}), c.setSelected(m),
|
|
553
|
+
}), c.setSelected(m), Le(e);
|
|
528
554
|
}
|
|
529
555
|
}
|
|
530
|
-
const
|
|
556
|
+
const ae = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Ne = (e) => e.closestType(b), R = (e) => {
|
|
531
557
|
var t;
|
|
532
|
-
return (t =
|
|
533
|
-
},
|
|
558
|
+
return (t = Ne(e)) == null ? void 0 : t.parent();
|
|
559
|
+
}, Ze = (e) => {
|
|
534
560
|
const t = e.editor.getSelectedAll(), o = R(t[0]), l = t[0];
|
|
535
561
|
if (!o || !(l != null && l.is(g)) || t.length > 1)
|
|
536
562
|
return !1;
|
|
537
|
-
const { rowspan:
|
|
538
|
-
return !(s < 2 &&
|
|
539
|
-
},
|
|
540
|
-
const o = e.editor.getSelectedAll()[0], l = R(o), { grid:
|
|
541
|
-
se(
|
|
563
|
+
const { rowspan: n, colspan: s } = L(l);
|
|
564
|
+
return !(s < 2 && n < 2);
|
|
565
|
+
}, Oe = (e) => {
|
|
566
|
+
const o = e.editor.getSelectedAll()[0], l = R(o), { grid: n } = I(l);
|
|
567
|
+
se(n);
|
|
542
568
|
}, re = (e) => {
|
|
543
569
|
const t = e.editor.getSelectedAll(), o = R(t[0]);
|
|
544
|
-
if (!o || t.length < 2 || t.some((
|
|
570
|
+
if (!o || t.length < 2 || t.some((a) => !a.is(g) || R(a) !== o))
|
|
545
571
|
return !1;
|
|
546
|
-
const { grid: l, startPos:
|
|
547
|
-
if (!
|
|
548
|
-
for (let
|
|
549
|
-
for (let r =
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
572
|
+
const { grid: l, startPos: n, endPos: s } = I(o), { em: c } = o;
|
|
573
|
+
if (!n || !s) return !1;
|
|
574
|
+
for (let a = n.y; a <= s.y; a++)
|
|
575
|
+
for (let r = n.x; r <= s.x; r++) {
|
|
576
|
+
const h = H(l, r, a);
|
|
577
|
+
if (!h || !c.selected.hasComponent(h.cell))
|
|
552
578
|
return !1;
|
|
553
579
|
}
|
|
554
580
|
return !0;
|
|
555
|
-
},
|
|
581
|
+
}, Fe = (e) => {
|
|
556
582
|
const { editor: t } = e;
|
|
557
583
|
if (!re(e)) return;
|
|
558
584
|
const o = t.getSelectedAll(), l = R(o[0]);
|
|
559
585
|
Se(l, { mergeContent: !0 });
|
|
560
|
-
},
|
|
561
|
-
|
|
586
|
+
}, Ue = (e) => {
|
|
587
|
+
T(e, {
|
|
562
588
|
id: "tableCellSettings",
|
|
563
|
-
header: { label:
|
|
589
|
+
header: { label: ae }
|
|
564
590
|
});
|
|
565
|
-
},
|
|
591
|
+
}, $e = (e) => [{
|
|
566
592
|
id: i.tableCellItems,
|
|
567
|
-
icon:
|
|
593
|
+
icon: u[i.tableCellProperties],
|
|
568
594
|
label: "Cell",
|
|
569
595
|
items: [
|
|
570
596
|
{
|
|
571
597
|
id: i.tableCellProperties,
|
|
572
|
-
label:
|
|
573
|
-
icon:
|
|
574
|
-
onClick: ({ event: o }) =>
|
|
598
|
+
label: ae,
|
|
599
|
+
icon: u[i.tableCellProperties],
|
|
600
|
+
onClick: ({ event: o }) => Ue({
|
|
575
601
|
...e,
|
|
576
602
|
// @ts-expect-error workaround for the build
|
|
577
603
|
event: o
|
|
@@ -580,38 +606,38 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
580
606
|
{
|
|
581
607
|
id: i.tableCellMerge,
|
|
582
608
|
label: Ee,
|
|
583
|
-
icon:
|
|
584
|
-
onClick: () =>
|
|
609
|
+
icon: u[i.tableCellMerge],
|
|
610
|
+
onClick: () => Fe(e),
|
|
585
611
|
disabled: !re(e)
|
|
586
612
|
},
|
|
587
613
|
{
|
|
588
614
|
id: i.tableCellSplit,
|
|
589
615
|
label: Ge,
|
|
590
|
-
icon:
|
|
591
|
-
onClick: () =>
|
|
592
|
-
disabled: !
|
|
616
|
+
icon: u[i.tableCellSplit],
|
|
617
|
+
onClick: () => Oe(e),
|
|
618
|
+
disabled: !Ze(e)
|
|
593
619
|
}
|
|
594
620
|
]
|
|
595
|
-
}, ...
|
|
621
|
+
}, ...Ie(e), ...oe(e)], We = (e) => {
|
|
596
622
|
const t = e[0] && R(e[0]);
|
|
597
623
|
if (!t) return;
|
|
598
|
-
const { grid: o, startPos: l, endPos:
|
|
599
|
-
if (!l || !
|
|
624
|
+
const { grid: o, startPos: l, endPos: n } = I(t, { selected: e });
|
|
625
|
+
if (!l || !n) return;
|
|
600
626
|
const s = [];
|
|
601
|
-
for (let c = l.y; c <=
|
|
602
|
-
for (let
|
|
603
|
-
const r = H(o,
|
|
627
|
+
for (let c = l.y; c <= n.y; c++)
|
|
628
|
+
for (let a = l.x; a <= n.x; a++) {
|
|
629
|
+
const r = H(o, a, c);
|
|
604
630
|
r && s.push(r.cell);
|
|
605
631
|
}
|
|
606
632
|
s.length && t.em.setSelected(s, {
|
|
607
633
|
// @ts-expect-error custom option
|
|
608
634
|
fromCell: !0
|
|
609
635
|
});
|
|
610
|
-
},
|
|
636
|
+
}, _e = function(e, t = {}) {
|
|
611
637
|
const o = {
|
|
612
638
|
block: {},
|
|
613
639
|
...t
|
|
614
|
-
}, { Components: l } = e,
|
|
640
|
+
}, { Components: l } = e, n = {
|
|
615
641
|
copyable: !1,
|
|
616
642
|
emptyState: !0,
|
|
617
643
|
highlightable: !1,
|
|
@@ -632,7 +658,7 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
632
658
|
l.addType(f, {
|
|
633
659
|
block: o.block && {
|
|
634
660
|
label: "Table",
|
|
635
|
-
media:
|
|
661
|
+
media: u.table,
|
|
636
662
|
category: "Extra",
|
|
637
663
|
content: {
|
|
638
664
|
type: f,
|
|
@@ -645,7 +671,7 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
645
671
|
defaults: {
|
|
646
672
|
emptyState: !0,
|
|
647
673
|
highlightable: !1,
|
|
648
|
-
icon:
|
|
674
|
+
icon: u.table,
|
|
649
675
|
stylable: [
|
|
650
676
|
"width",
|
|
651
677
|
"height",
|
|
@@ -679,22 +705,22 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
679
705
|
id: "tableCaption",
|
|
680
706
|
type: "checkbox",
|
|
681
707
|
label: "Caption",
|
|
682
|
-
setValue({ component: c, value:
|
|
683
|
-
const
|
|
684
|
-
|
|
708
|
+
setValue({ component: c, value: a, emitUpdate: r }) {
|
|
709
|
+
const h = c.find("caption")[0];
|
|
710
|
+
a ? !h && c.append({
|
|
685
711
|
type: "text",
|
|
686
712
|
tagName: "caption",
|
|
687
713
|
components: { type: "textnode", content: "Caption" }
|
|
688
|
-
}) :
|
|
714
|
+
}) : h == null || h.remove(), r(), e.refresh({ tools: !0 });
|
|
689
715
|
},
|
|
690
716
|
getValue(c) {
|
|
691
717
|
return !!c.component.find("caption")[0];
|
|
692
718
|
}
|
|
693
719
|
}
|
|
694
720
|
],
|
|
695
|
-
components:
|
|
696
|
-
contextMenu: ({ items: c, editor:
|
|
697
|
-
...q({ editor:
|
|
721
|
+
components: ze(M, { rows: 5 }),
|
|
722
|
+
contextMenu: ({ items: c, editor: a, component: r }) => [
|
|
723
|
+
...q({ editor: a, component: r, opts: o }),
|
|
698
724
|
...c
|
|
699
725
|
]
|
|
700
726
|
}
|
|
@@ -702,34 +728,34 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
702
728
|
}), l.addType(W, {
|
|
703
729
|
model: {
|
|
704
730
|
defaults: {
|
|
705
|
-
icon:
|
|
706
|
-
...
|
|
731
|
+
icon: u.tableHead,
|
|
732
|
+
...n
|
|
707
733
|
}
|
|
708
734
|
}
|
|
709
735
|
}), l.addType(_, {
|
|
710
736
|
model: {
|
|
711
737
|
defaults: {
|
|
712
|
-
icon:
|
|
713
|
-
...
|
|
738
|
+
icon: u.tableFoot,
|
|
739
|
+
...n
|
|
714
740
|
}
|
|
715
741
|
}
|
|
716
|
-
}), l.addType(
|
|
742
|
+
}), l.addType(M, {
|
|
717
743
|
model: {
|
|
718
744
|
defaults: {
|
|
719
|
-
icon:
|
|
720
|
-
...
|
|
745
|
+
icon: u.tableRowProperties,
|
|
746
|
+
...n
|
|
721
747
|
}
|
|
722
748
|
}
|
|
723
749
|
}), l.addType(b, {
|
|
724
750
|
model: {
|
|
725
751
|
defaults: {
|
|
726
|
-
icon:
|
|
752
|
+
icon: u.tableRowProperties,
|
|
727
753
|
emptyState: !0,
|
|
728
754
|
highlightable: !1,
|
|
729
755
|
stylable: ["height", "text-align", "border-width", "border-style", "border-color"],
|
|
730
756
|
traits: [],
|
|
731
|
-
contextMenu: ({ items: c, editor:
|
|
732
|
-
...oe({ editor:
|
|
757
|
+
contextMenu: ({ items: c, editor: a, component: r }) => [
|
|
758
|
+
...oe({ editor: a, component: r, opts: o }),
|
|
733
759
|
...c
|
|
734
760
|
]
|
|
735
761
|
}
|
|
@@ -737,7 +763,7 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
737
763
|
}), l.addType(g, {
|
|
738
764
|
model: {
|
|
739
765
|
defaults: {
|
|
740
|
-
icon:
|
|
766
|
+
icon: u.tableCellProperties,
|
|
741
767
|
emptyState: {
|
|
742
768
|
styleOut: "height: 1px"
|
|
743
769
|
},
|
|
@@ -779,30 +805,30 @@ const ne = "Cell settings", Ee = "Merge cells", Ge = "Split cell", Le = (e) => e
|
|
|
779
805
|
name: "scope"
|
|
780
806
|
}
|
|
781
807
|
],
|
|
782
|
-
contextMenu: ({ items: c, editor:
|
|
783
|
-
|
|
808
|
+
contextMenu: ({ items: c, editor: a, component: r }) => [
|
|
809
|
+
...$e({ editor: a, component: r, opts: o }),
|
|
784
810
|
...c
|
|
785
811
|
]
|
|
786
812
|
}
|
|
787
813
|
}
|
|
788
814
|
});
|
|
789
|
-
const s = ce((c,
|
|
790
|
-
var
|
|
791
|
-
const r = e.getSelectedAll(),
|
|
792
|
-
if (r.length < 2 || !
|
|
793
|
-
const
|
|
794
|
-
|
|
815
|
+
const s = ce((c, a) => {
|
|
816
|
+
var d;
|
|
817
|
+
const r = e.getSelectedAll(), h = !!((d = a == null ? void 0 : a.event) != null && d.shiftKey);
|
|
818
|
+
if (r.length < 2 || !h || a.fromCell) return;
|
|
819
|
+
const v = r.map((p) => p.is(g) ? p : p.closestType(g)).filter(Boolean);
|
|
820
|
+
v.length === r.length && We(v);
|
|
795
821
|
}, 0);
|
|
796
822
|
e.on("component:select", s), we({
|
|
797
823
|
editor: e,
|
|
798
|
-
plan:
|
|
799
|
-
pluginName:
|
|
824
|
+
plan: Re,
|
|
825
|
+
pluginName: He,
|
|
800
826
|
licenseKey: o.licenseKey,
|
|
801
827
|
cleanup: () => {
|
|
802
|
-
e.off("component:select", s), e.Blocks.remove(f),
|
|
828
|
+
e.off("component:select", s), e.Blocks.remove(f), Pe.forEach((c) => l.removeType(c));
|
|
803
829
|
}
|
|
804
830
|
});
|
|
805
|
-
},
|
|
831
|
+
}, je = me(_e);
|
|
806
832
|
export {
|
|
807
|
-
|
|
833
|
+
je as default
|
|
808
834
|
};
|