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