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