@grapesjs/studio-sdk-plugins 1.0.36 → 1.0.38-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 +4 -4
- package/dist/accordionComponent/index.es.js +83 -70
- package/dist/accordionComponent/index.umd.js +5 -5
- 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 +85 -85
- package/dist/aiChat/index.es.js +11151 -10258
- package/dist/aiChat/index.js +85 -85
- package/dist/aiChat/index.umd.js +86 -86
- package/dist/aiChat/locales/en.d.ts +11 -0
- package/dist/aiChat/projectGeneration.d.ts +17 -0
- package/dist/aiChat/server/index.cjs.js +1 -1
- package/dist/aiChat/server/index.es.js +1 -1
- package/dist/aiChat/server/index.js +1 -1
- package/dist/aiChat/server/index.umd.js +1 -1
- package/dist/aiChat/types.d.ts +1 -1
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +57 -44
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +63 -50
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +60 -47
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +3 -3
- package/dist/canvasFullSize/index.es.js +49 -36
- package/dist/canvasFullSize/index.umd.js +5 -5
- package/dist/canvasGridMode/index.cjs.js +2 -2
- package/dist/canvasGridMode/index.es.js +251 -233
- package/dist/canvasGridMode/index.umd.js +4 -4
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +42 -29
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +3 -3
- package/dist/dataSourceEjs/index.es.js +51 -38
- package/dist/dataSourceEjs/index.umd.js +3 -3
- package/dist/dataSourceHandlebars/index.cjs.js +2 -2
- package/dist/dataSourceHandlebars/index.es.js +152 -139
- package/dist/dataSourceHandlebars/index.umd.js +4 -4
- package/dist/dialogComponent/index.cjs.js +9 -9
- package/dist/dialogComponent/index.es.js +73 -60
- package/dist/dialogComponent/index.umd.js +3 -3
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +83 -70
- package/dist/flexComponent/index.umd.js +6 -6
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +67 -54
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +92 -79
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +52 -39
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +42 -42
- package/dist/index.es.js +1167 -1149
- package/dist/index.umd.js +42 -42
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +82 -69
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +98 -85
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +71 -58
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +49 -36
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/presetPrintable/index.cjs.js +5 -5
- package/dist/presetPrintable/index.es.js +126 -113
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +97 -84
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +149 -137
- 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 +92 -79
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +3 -3
- package/dist/shapeDividerComponent/index.es.js +38 -25
- package/dist/shapeDividerComponent/index.umd.js +3 -3
- package/dist/swiperComponent/index.cjs.js +5 -5
- package/dist/swiperComponent/index.es.js +106 -93
- package/dist/swiperComponent/index.umd.js +5 -5
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +167 -154
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +35 -22
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +2 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
function ce(e, t, o) {
|
|
2
|
-
let l,
|
|
2
|
+
let l, n, s, c, a;
|
|
3
3
|
const r = t;
|
|
4
4
|
function h() {
|
|
5
5
|
const d = Date.now() - c;
|
|
6
|
-
d < r && d >= 0 ? l = setTimeout(h, r - d) : (l = null, a = e.apply(
|
|
6
|
+
d < r && d >= 0 ? l = setTimeout(h, r - d) : (l = null, a = e.apply(s, n), s = n = null);
|
|
7
7
|
}
|
|
8
8
|
const v = function() {
|
|
9
|
-
return
|
|
9
|
+
return s = this, n = arguments, c = Date.now(), l || (l = setTimeout(h, r)), a;
|
|
10
10
|
};
|
|
11
11
|
return v.clear = function() {
|
|
12
12
|
l && (clearTimeout(l), l = null);
|
|
13
13
|
}, v.flush = function() {
|
|
14
|
-
l && (a = e.apply(
|
|
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", ie = "app2.grapesjs.com", he = "app-stage2.grapesjs.com",
|
|
17
|
+
const F = "app.grapesjs.com", U = "app-stage.grapesjs.com", ie = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", E = [
|
|
18
18
|
F,
|
|
19
19
|
ie,
|
|
20
20
|
U,
|
|
@@ -25,26 +25,39 @@ const F = "app.grapesjs.com", U = "app-stage.grapesjs.com", ie = "app2.grapesjs.
|
|
|
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
|
+
".claudemcpcontent.com",
|
|
31
|
+
// For Claude mcp app
|
|
32
|
+
".web-sandbox.oaiusercontent.com"
|
|
33
|
+
// For OpenAI mcp app
|
|
30
34
|
], de = "license:check:end", ve = () => typeof window < "u", ue = ({
|
|
31
35
|
isDev: e,
|
|
32
36
|
isStage: t,
|
|
33
37
|
isPlatform: o
|
|
34
38
|
}) => `${e ? "" : `https://${t ? U : F}`}/${o ? "platform-api" : "api"}`, ge = () => {
|
|
35
|
-
|
|
36
|
-
|
|
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();
|
|
49
|
+
return !!e && (E.includes(e) || E.some((t) => e.endsWith(t)));
|
|
37
50
|
};
|
|
38
51
|
function $(e) {
|
|
39
52
|
return typeof e == "function";
|
|
40
53
|
}
|
|
41
|
-
async function
|
|
54
|
+
async function pe({
|
|
42
55
|
path: e,
|
|
43
56
|
baseApiUrl: t,
|
|
44
57
|
method: o = "GET",
|
|
45
58
|
headers: l = {},
|
|
46
|
-
params:
|
|
47
|
-
body:
|
|
59
|
+
params: n,
|
|
60
|
+
body: s
|
|
48
61
|
}) {
|
|
49
62
|
const a = `${t || ue({ isDev: !1, isStage: !1 })}${e}`, r = {
|
|
50
63
|
method: o,
|
|
@@ -53,54 +66,54 @@ async function be({
|
|
|
53
66
|
...l
|
|
54
67
|
}
|
|
55
68
|
};
|
|
56
|
-
|
|
57
|
-
const h =
|
|
69
|
+
s && (r.body = JSON.stringify(s));
|
|
70
|
+
const h = n ? new URLSearchParams(n).toString() : "", v = h ? `?${h}` : "", d = await fetch(`${a}${v}`, r);
|
|
58
71
|
if (!d.ok)
|
|
59
72
|
throw new Error(`HTTP error! status: ${d.status}`);
|
|
60
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 || {}), 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
|
-
const
|
|
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.openEditCode = "studio:openEditCode", 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 || {});
|
|
76
|
+
const S = {
|
|
64
77
|
[C.free]: 0,
|
|
65
78
|
[C.startup]: 10,
|
|
66
79
|
[C.business]: 20,
|
|
67
80
|
[C.enterprise]: 30
|
|
68
81
|
};
|
|
69
|
-
function
|
|
82
|
+
function fe(e) {
|
|
70
83
|
const t = e;
|
|
71
84
|
return t.init = (o) => (l) => e(l, o), t;
|
|
72
85
|
}
|
|
73
|
-
const
|
|
74
|
-
async function
|
|
86
|
+
const me = (e) => /* @__PURE__ */ fe(e);
|
|
87
|
+
async function we({
|
|
75
88
|
editor: e,
|
|
76
89
|
plan: t,
|
|
77
90
|
pluginName: o,
|
|
78
91
|
licenseKey: l,
|
|
79
|
-
onLicenseCheckResponse:
|
|
80
|
-
cleanup:
|
|
92
|
+
onLicenseCheckResponse: n,
|
|
93
|
+
cleanup: s
|
|
81
94
|
}) {
|
|
82
95
|
let c = "", a;
|
|
83
96
|
const r = (d) => {
|
|
84
|
-
console.warn("Cleanup plugin:", o, "Reason:", d),
|
|
97
|
+
console.warn("Cleanup plugin:", o, "Reason:", d), s();
|
|
85
98
|
}, h = (d = {}) => {
|
|
86
99
|
var y;
|
|
87
100
|
const { error: p, sdkLicense: V } = d, m = (y = d.plan) == null ? void 0 : y.category;
|
|
88
101
|
if (!(V || d.license) || p)
|
|
89
102
|
r(p || "Invalid license");
|
|
90
103
|
else if (m) {
|
|
91
|
-
const z =
|
|
104
|
+
const z = S[t], A = S[m];
|
|
92
105
|
z > A && r({ pluginRequiredPlan: t, licensePlan: m });
|
|
93
106
|
}
|
|
94
107
|
};
|
|
95
108
|
e.Commands.has(x.settings) && (a = e.runCommand(x.settings), c = (a == null ? void 0 : a.baseUrl) || "");
|
|
96
109
|
const v = (d) => {
|
|
97
|
-
|
|
110
|
+
n == null || n(d), d && h(d);
|
|
98
111
|
};
|
|
99
112
|
if (!a) {
|
|
100
113
|
e.onReady(async () => {
|
|
101
|
-
if (!
|
|
114
|
+
if (!be())
|
|
102
115
|
if (l) {
|
|
103
|
-
const d = await
|
|
116
|
+
const d = await Ce({ licenseKey: l, pluginName: o, baseApiUrl: c });
|
|
104
117
|
v(d);
|
|
105
118
|
} else
|
|
106
119
|
r("The `licenseKey` option not provided");
|
|
@@ -108,22 +121,22 @@ async function me({
|
|
|
108
121
|
return;
|
|
109
122
|
}
|
|
110
123
|
if (a.licensePlan || a.licenseError) {
|
|
111
|
-
const d =
|
|
124
|
+
const d = ye(a);
|
|
112
125
|
v(d);
|
|
113
126
|
return;
|
|
114
127
|
}
|
|
115
128
|
e.on(de, (d) => v(d));
|
|
116
129
|
}
|
|
117
|
-
const
|
|
130
|
+
const ye = (e) => ({
|
|
118
131
|
sdkLicense: e.license,
|
|
119
132
|
license: e.license,
|
|
120
133
|
error: e.licenseError,
|
|
121
134
|
plan: e.licensePlan
|
|
122
135
|
});
|
|
123
|
-
async function
|
|
136
|
+
async function Ce(e) {
|
|
124
137
|
const { licenseKey: t, pluginName: o, baseApiUrl: l } = e;
|
|
125
138
|
try {
|
|
126
|
-
return (await
|
|
139
|
+
return (await pe({
|
|
127
140
|
baseApiUrl: l,
|
|
128
141
|
path: `/sdk/${t || "na"}`,
|
|
129
142
|
method: "POST",
|
|
@@ -132,11 +145,11 @@ async function ye(e) {
|
|
|
132
145
|
pn: o
|
|
133
146
|
}
|
|
134
147
|
})).result || {};
|
|
135
|
-
} catch (
|
|
136
|
-
return console.error("Error during SDK license check:",
|
|
148
|
+
} catch (n) {
|
|
149
|
+
return console.error("Error during SDK license check:", n), !1;
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
|
-
const
|
|
152
|
+
const He = "tableComponent", Re = C.startup;
|
|
140
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 || {});
|
|
141
154
|
const u = {
|
|
142
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>',
|
|
@@ -166,8 +179,8 @@ const u = {
|
|
|
166
179
|
tableColumnCopy: '<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',
|
|
167
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>',
|
|
168
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>'
|
|
169
|
-
}, f = "table", W = "thead", _ = "tfoot", M = "tbody", b = "row", g = "cell", D = "clipboardTable",
|
|
170
|
-
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 = {
|
|
171
184
|
style: { width: 240, height: 300 },
|
|
172
185
|
placer: { type: "popover", closeOnClickAway: !0, x: c, y: a, w: r, h },
|
|
173
186
|
layout: {
|
|
@@ -188,27 +201,27 @@ const u = {
|
|
|
188
201
|
},
|
|
189
202
|
...t
|
|
190
203
|
};
|
|
191
|
-
$(
|
|
192
|
-
},
|
|
204
|
+
$(n.openSettings) ? n.openSettings({ ...e, layoutProps: v }) : o.runCommand(x.layoutToggle, v);
|
|
205
|
+
}, ze = (e, {
|
|
193
206
|
rows: t = 1,
|
|
194
207
|
cells: o = 5,
|
|
195
208
|
text: l
|
|
196
209
|
} = {}) => ({
|
|
197
210
|
type: e,
|
|
198
|
-
components: Array.from(Array(t).keys()).map((
|
|
211
|
+
components: Array.from(Array(t).keys()).map((n) => ({
|
|
199
212
|
type: b,
|
|
200
|
-
components: Array.from(Array(o).keys()).map((
|
|
213
|
+
components: Array.from(Array(o).keys()).map((s) => ({
|
|
201
214
|
type: g,
|
|
202
|
-
components: l ? { type: "text", content: $(l) ? l({ y:
|
|
215
|
+
components: l ? { type: "text", content: $(l) ? l({ y: n, x: s }) : l } : void 0
|
|
203
216
|
}))
|
|
204
217
|
}))
|
|
205
218
|
}), j = "Table settings", K = (e) => {
|
|
206
219
|
const { component: t } = e;
|
|
207
220
|
return t.is(f) ? t : t.closestType(f);
|
|
208
|
-
},
|
|
221
|
+
}, Ae = (e) => {
|
|
209
222
|
var t;
|
|
210
223
|
(t = K(e)) == null || t.remove(e.opts);
|
|
211
|
-
},
|
|
224
|
+
}, xe = (e) => {
|
|
212
225
|
const t = K(e);
|
|
213
226
|
t && (e.editor.select(t), T(e, {
|
|
214
227
|
id: "tableSettings",
|
|
@@ -223,7 +236,7 @@ const u = {
|
|
|
223
236
|
id: i.tableSettings,
|
|
224
237
|
label: j,
|
|
225
238
|
icon: u[i.tableSettings],
|
|
226
|
-
onClick: ({ event: o }) =>
|
|
239
|
+
onClick: ({ event: o }) => xe({
|
|
227
240
|
...e,
|
|
228
241
|
// @ts-expect-error workaround for the build
|
|
229
242
|
event: o
|
|
@@ -233,41 +246,41 @@ const u = {
|
|
|
233
246
|
id: i.tableDelete,
|
|
234
247
|
label: "Delete table",
|
|
235
248
|
icon: u[i.tableDelete],
|
|
236
|
-
onClick: () =>
|
|
249
|
+
onClick: () => Ae(e)
|
|
237
250
|
}
|
|
238
251
|
]
|
|
239
252
|
}], X = ({ editor: e }) => {
|
|
240
253
|
const t = B(e);
|
|
241
|
-
return t.length &&
|
|
254
|
+
return t.length && Ve(t);
|
|
242
255
|
}, G = ({ component: e, editor: t, after: o }) => {
|
|
243
256
|
if (!e.is(g)) return;
|
|
244
|
-
const l = e.closestType(f),
|
|
245
|
-
l == null || l.findType(b).forEach((a) => a.append({ type: g }, { at:
|
|
246
|
-
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);
|
|
247
260
|
c && t.select(c);
|
|
248
261
|
}, Y = ({ component: e, opts: t }) => {
|
|
249
262
|
if (!e.is(g)) return;
|
|
250
263
|
const o = e.closestType(f), l = e.index();
|
|
251
|
-
o == null || o.findType(b).forEach((
|
|
252
|
-
var
|
|
253
|
-
return (
|
|
264
|
+
o == null || o.findType(b).forEach((n) => {
|
|
265
|
+
var s;
|
|
266
|
+
return (s = n.components().at(l)) == null ? void 0 : s.remove(t);
|
|
254
267
|
});
|
|
255
268
|
}, J = ({ component: e, editor: t }) => {
|
|
256
269
|
if (!e.is(g)) return;
|
|
257
|
-
const o = e.closestType(f), l = e.index(),
|
|
258
|
-
|
|
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);
|
|
259
272
|
}, N = (e) => {
|
|
260
273
|
const { component: t, editor: o, after: l } = e;
|
|
261
274
|
if (!t.is(g) || !X(e)) return;
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
const h =
|
|
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 };
|
|
265
278
|
a.append(v, { at: c });
|
|
266
279
|
});
|
|
267
|
-
},
|
|
280
|
+
}, Be = (e) => {
|
|
268
281
|
const { component: t } = e;
|
|
269
282
|
t.is(g) && (J(e), Y({ ...e, opts: { temporary: !0 } }));
|
|
270
|
-
},
|
|
283
|
+
}, Ie = (e) => {
|
|
271
284
|
const t = X(e);
|
|
272
285
|
return [{
|
|
273
286
|
id: i.tableColumnItems,
|
|
@@ -296,7 +309,7 @@ const u = {
|
|
|
296
309
|
id: i.tableColumnCut,
|
|
297
310
|
label: "Cut column",
|
|
298
311
|
icon: u[i.tableColumnCut],
|
|
299
|
-
onClick: () =>
|
|
312
|
+
onClick: () => Be(e)
|
|
300
313
|
},
|
|
301
314
|
{
|
|
302
315
|
id: i.tableColumnCopy,
|
|
@@ -320,16 +333,16 @@ const u = {
|
|
|
320
333
|
}
|
|
321
334
|
]
|
|
322
335
|
}];
|
|
323
|
-
}, Q = "Row settings",
|
|
336
|
+
}, Q = "Row settings", Me = (e) => e.every((t) => t.is(b)), P = (e) => {
|
|
324
337
|
const { component: t } = e, o = t.is(g), l = t.is(b);
|
|
325
338
|
if (!(!o && !l))
|
|
326
339
|
return l ? t : t.closestType(b);
|
|
327
340
|
}, Z = (e) => {
|
|
328
|
-
const { component: t, editor: o, after: l } = e,
|
|
329
|
-
if (!
|
|
330
|
-
const
|
|
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();
|
|
331
344
|
if (r) {
|
|
332
|
-
const h = r.append({ type: b, components: a }, { at:
|
|
345
|
+
const h = r.append({ type: b, components: a }, { at: s })[0];
|
|
333
346
|
if (t.is(g) && h) {
|
|
334
347
|
const v = t.index(), d = h.components().at(v);
|
|
335
348
|
d && o.select(d);
|
|
@@ -345,14 +358,14 @@ const u = {
|
|
|
345
358
|
var a;
|
|
346
359
|
const { editor: t, after: o } = e, l = P(e);
|
|
347
360
|
if (!l || !le(e)) return;
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
},
|
|
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) => {
|
|
351
364
|
P(e) && (te(e), ee({ ...e, opts: { temporary: !0 } }));
|
|
352
365
|
}, le = ({ editor: e }) => {
|
|
353
366
|
const t = B(e);
|
|
354
|
-
return t.length &&
|
|
355
|
-
},
|
|
367
|
+
return t.length && Me(t);
|
|
368
|
+
}, De = (e) => {
|
|
356
369
|
const t = P(e);
|
|
357
370
|
t && (e.editor.select(t), T(e, {
|
|
358
371
|
id: "tableRowSettings",
|
|
@@ -387,7 +400,7 @@ const u = {
|
|
|
387
400
|
id: i.tableRowProperties,
|
|
388
401
|
label: Q,
|
|
389
402
|
icon: u[i.tableRowProperties],
|
|
390
|
-
onClick: ({ event: l }) =>
|
|
403
|
+
onClick: ({ event: l }) => De({
|
|
391
404
|
...e,
|
|
392
405
|
// @ts-expect-error workaround for the build
|
|
393
406
|
event: l
|
|
@@ -397,7 +410,7 @@ const u = {
|
|
|
397
410
|
id: i.tableRowCut,
|
|
398
411
|
label: "Cut row",
|
|
399
412
|
icon: u[i.tableRowCut],
|
|
400
|
-
onClick: () =>
|
|
413
|
+
onClick: () => ke(e)
|
|
401
414
|
},
|
|
402
415
|
{
|
|
403
416
|
id: i.tableRowCopy,
|
|
@@ -425,20 +438,20 @@ const u = {
|
|
|
425
438
|
const t = e.attributes.attributes || {}, o = parseInt(`${t.rowspan || 1}`, 10), l = parseInt(`${t.colspan || 1}`, 10);
|
|
426
439
|
return { rowspan: o, colspan: l };
|
|
427
440
|
};
|
|
428
|
-
function
|
|
441
|
+
function ne(e) {
|
|
429
442
|
const t = [];
|
|
430
443
|
return e.components().forEach((o, l) => {
|
|
431
|
-
o.components().each((
|
|
432
|
-
const { rowspan: c, colspan: a } = L(
|
|
444
|
+
o.components().each((n, s) => {
|
|
445
|
+
const { rowspan: c, colspan: a } = L(n);
|
|
433
446
|
if (t[l])
|
|
434
|
-
for (; t[l][
|
|
435
|
-
|
|
447
|
+
for (; t[l][s]; )
|
|
448
|
+
s++;
|
|
436
449
|
for (let r = l; r < l + c; r++) {
|
|
437
450
|
t[r] || (t[r] = []);
|
|
438
|
-
for (let h =
|
|
451
|
+
for (let h = s; h < s + a; h++)
|
|
439
452
|
t[r][h] = {
|
|
440
|
-
real: r === l && h ===
|
|
441
|
-
cell:
|
|
453
|
+
real: r === l && h === s,
|
|
454
|
+
cell: n,
|
|
442
455
|
rowspan: c,
|
|
443
456
|
colspan: a
|
|
444
457
|
};
|
|
@@ -451,15 +464,15 @@ function H(e, t, o) {
|
|
|
451
464
|
return (l = e[o]) == null ? void 0 : l[t];
|
|
452
465
|
}
|
|
453
466
|
const k = (e) => e.closestType(b);
|
|
454
|
-
function
|
|
467
|
+
function Te(e, { x: t, y: o, rows: l, cols: n }) {
|
|
455
468
|
var a;
|
|
456
|
-
let
|
|
469
|
+
let s = k(e[o][t].cell), c;
|
|
457
470
|
for (let r = 1; r <= l; r++)
|
|
458
|
-
if (
|
|
471
|
+
if (s = (a = s == null ? void 0 : s.parent()) == null ? void 0 : a.components().at(s.index() + 1), s) {
|
|
459
472
|
for (c = t; c >= 0; c--) {
|
|
460
473
|
const { cell: h } = e[o + r][c], v = k(h);
|
|
461
|
-
if (v ===
|
|
462
|
-
for (let d = 1; d <=
|
|
474
|
+
if (v === s) {
|
|
475
|
+
for (let d = 1; d <= n; d++) {
|
|
463
476
|
const p = h.index();
|
|
464
477
|
v.append({ type: g }, { at: p + 1 });
|
|
465
478
|
}
|
|
@@ -467,30 +480,30 @@ function De(e, { x: t, y: o, rows: l, cols: s }) {
|
|
|
467
480
|
}
|
|
468
481
|
}
|
|
469
482
|
if (c === -1) {
|
|
470
|
-
const v =
|
|
471
|
-
for (let d = 1; d <=
|
|
472
|
-
|
|
483
|
+
const v = s.components().at(0).index();
|
|
484
|
+
for (let d = 1; d <= n; d++)
|
|
485
|
+
s.append({ type: g }, { at: v });
|
|
473
486
|
}
|
|
474
487
|
}
|
|
475
488
|
}
|
|
476
|
-
function
|
|
489
|
+
function se(e) {
|
|
477
490
|
for (let t = 0; t < e.length; t++)
|
|
478
491
|
for (let o = 0; o < e[t].length; o++) {
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
481
|
-
const { rowspan:
|
|
482
|
-
if (c > 1 ||
|
|
483
|
-
|
|
492
|
+
const n = e[t][o].cell;
|
|
493
|
+
if (n.em.selected.hasComponent(n)) {
|
|
494
|
+
const { rowspan: s, colspan: c } = L(n);
|
|
495
|
+
if (c > 1 || s > 1) {
|
|
496
|
+
n.addAttributes({ colspan: 1, rowspan: 1 });
|
|
484
497
|
for (let a = 0; a < c - 1; a++) {
|
|
485
|
-
const r =
|
|
486
|
-
k(
|
|
498
|
+
const r = n.index();
|
|
499
|
+
k(n).append({ type: g }, { at: r + 1 });
|
|
487
500
|
}
|
|
488
|
-
|
|
501
|
+
Te(e, { x: o, y: t, rows: s - 1, cols: c });
|
|
489
502
|
}
|
|
490
503
|
}
|
|
491
504
|
}
|
|
492
505
|
}
|
|
493
|
-
function
|
|
506
|
+
function Le(e) {
|
|
494
507
|
const t = [];
|
|
495
508
|
e.components().forEach((o) => {
|
|
496
509
|
o.components().length || t.push(o);
|
|
@@ -498,84 +511,84 @@ function Te(e) {
|
|
|
498
511
|
}
|
|
499
512
|
const I = (e, t = {}) => {
|
|
500
513
|
var c;
|
|
501
|
-
const o =
|
|
502
|
-
let
|
|
514
|
+
const o = ne(e), { em: l } = e;
|
|
515
|
+
let n, s;
|
|
503
516
|
for (let a = 0; a < o.length; a++)
|
|
504
517
|
for (let r = 0; r < o[a].length; r++) {
|
|
505
518
|
const h = o[a][r];
|
|
506
519
|
if ((c = t.selected) != null && c.includes(h.cell) || l.selected.hasComponent(h.cell)) {
|
|
507
520
|
const v = { x: r, y: a };
|
|
508
|
-
|
|
521
|
+
n || (n = v), s = v;
|
|
509
522
|
}
|
|
510
523
|
}
|
|
511
524
|
return {
|
|
512
525
|
grid: o,
|
|
513
|
-
startPos:
|
|
514
|
-
endPos:
|
|
526
|
+
startPos: n,
|
|
527
|
+
endPos: s
|
|
515
528
|
};
|
|
516
529
|
};
|
|
517
|
-
function
|
|
518
|
-
const o = I(e), { startPos: l, endPos:
|
|
519
|
-
let { grid:
|
|
530
|
+
function Ee(e, t = {}) {
|
|
531
|
+
const o = I(e), { startPos: l, endPos: n } = o;
|
|
532
|
+
let { grid: s } = o;
|
|
520
533
|
const { em: c } = e;
|
|
521
|
-
if (!l || !
|
|
534
|
+
if (!l || !n)
|
|
522
535
|
return;
|
|
523
|
-
const a = l.x, r = l.y, h =
|
|
536
|
+
const a = l.x, r = l.y, h = n.x, v = n.y, d = H(s, a, r), p = H(s, h, v);
|
|
524
537
|
if (d && p) {
|
|
525
|
-
|
|
526
|
-
const V = [], m = H(
|
|
538
|
+
se(s), s = ne(e);
|
|
539
|
+
const V = [], m = H(s, a, r).cell;
|
|
527
540
|
m.addAttributes({
|
|
528
541
|
colspan: h - a + 1,
|
|
529
542
|
rowspan: v - r + 1
|
|
530
543
|
});
|
|
531
544
|
for (let w = r; w <= v; w++)
|
|
532
545
|
for (let y = a; y <= h; y++) {
|
|
533
|
-
const z = H(
|
|
546
|
+
const z = H(s, y, w);
|
|
534
547
|
if (!z) continue;
|
|
535
548
|
const { cell: A } = z;
|
|
536
549
|
A !== m && V.push(A);
|
|
537
550
|
}
|
|
538
551
|
V.forEach((w) => {
|
|
539
552
|
t.mergeContent && m.append(w.components().models), w.remove();
|
|
540
|
-
}), c.setSelected(m),
|
|
553
|
+
}), c.setSelected(m), Le(e);
|
|
541
554
|
}
|
|
542
555
|
}
|
|
543
|
-
const ae = "Cell settings", Se = "Merge cells",
|
|
556
|
+
const ae = "Cell settings", Se = "Merge cells", Ge = "Split cell", Ne = (e) => e.closestType(b), R = (e) => {
|
|
544
557
|
var t;
|
|
545
|
-
return (t =
|
|
546
|
-
},
|
|
558
|
+
return (t = Ne(e)) == null ? void 0 : t.parent();
|
|
559
|
+
}, Ze = (e) => {
|
|
547
560
|
const t = e.editor.getSelectedAll(), o = R(t[0]), l = t[0];
|
|
548
561
|
if (!o || !(l != null && l.is(g)) || t.length > 1)
|
|
549
562
|
return !1;
|
|
550
|
-
const { rowspan:
|
|
551
|
-
return !(
|
|
552
|
-
},
|
|
553
|
-
const o = e.editor.getSelectedAll()[0], l = R(o), { grid:
|
|
554
|
-
|
|
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);
|
|
555
568
|
}, re = (e) => {
|
|
556
569
|
const t = e.editor.getSelectedAll(), o = R(t[0]);
|
|
557
570
|
if (!o || t.length < 2 || t.some((a) => !a.is(g) || R(a) !== o))
|
|
558
571
|
return !1;
|
|
559
|
-
const { grid: l, startPos:
|
|
560
|
-
if (!
|
|
561
|
-
for (let a =
|
|
562
|
-
for (let r =
|
|
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++) {
|
|
563
576
|
const h = H(l, r, a);
|
|
564
577
|
if (!h || !c.selected.hasComponent(h.cell))
|
|
565
578
|
return !1;
|
|
566
579
|
}
|
|
567
580
|
return !0;
|
|
568
|
-
},
|
|
581
|
+
}, Fe = (e) => {
|
|
569
582
|
const { editor: t } = e;
|
|
570
583
|
if (!re(e)) return;
|
|
571
584
|
const o = t.getSelectedAll(), l = R(o[0]);
|
|
572
|
-
|
|
573
|
-
},
|
|
585
|
+
Ee(l, { mergeContent: !0 });
|
|
586
|
+
}, Ue = (e) => {
|
|
574
587
|
T(e, {
|
|
575
588
|
id: "tableCellSettings",
|
|
576
589
|
header: { label: ae }
|
|
577
590
|
});
|
|
578
|
-
},
|
|
591
|
+
}, $e = (e) => [{
|
|
579
592
|
id: i.tableCellItems,
|
|
580
593
|
icon: u[i.tableCellProperties],
|
|
581
594
|
label: "Cell",
|
|
@@ -584,7 +597,7 @@ const ae = "Cell settings", Se = "Merge cells", Ee = "Split cell", Ge = (e) => e
|
|
|
584
597
|
id: i.tableCellProperties,
|
|
585
598
|
label: ae,
|
|
586
599
|
icon: u[i.tableCellProperties],
|
|
587
|
-
onClick: ({ event: o }) =>
|
|
600
|
+
onClick: ({ event: o }) => Ue({
|
|
588
601
|
...e,
|
|
589
602
|
// @ts-expect-error workaround for the build
|
|
590
603
|
event: o
|
|
@@ -594,37 +607,37 @@ const ae = "Cell settings", Se = "Merge cells", Ee = "Split cell", Ge = (e) => e
|
|
|
594
607
|
id: i.tableCellMerge,
|
|
595
608
|
label: Se,
|
|
596
609
|
icon: u[i.tableCellMerge],
|
|
597
|
-
onClick: () =>
|
|
610
|
+
onClick: () => Fe(e),
|
|
598
611
|
disabled: !re(e)
|
|
599
612
|
},
|
|
600
613
|
{
|
|
601
614
|
id: i.tableCellSplit,
|
|
602
|
-
label:
|
|
615
|
+
label: Ge,
|
|
603
616
|
icon: u[i.tableCellSplit],
|
|
604
|
-
onClick: () =>
|
|
605
|
-
disabled: !
|
|
617
|
+
onClick: () => Oe(e),
|
|
618
|
+
disabled: !Ze(e)
|
|
606
619
|
}
|
|
607
620
|
]
|
|
608
|
-
}, ...
|
|
621
|
+
}, ...Ie(e), ...oe(e)], We = (e) => {
|
|
609
622
|
const t = e[0] && R(e[0]);
|
|
610
623
|
if (!t) return;
|
|
611
|
-
const { grid: o, startPos: l, endPos:
|
|
612
|
-
if (!l || !
|
|
613
|
-
const
|
|
614
|
-
for (let c = l.y; c <=
|
|
615
|
-
for (let a = l.x; a <=
|
|
624
|
+
const { grid: o, startPos: l, endPos: n } = I(t, { selected: e });
|
|
625
|
+
if (!l || !n) return;
|
|
626
|
+
const s = [];
|
|
627
|
+
for (let c = l.y; c <= n.y; c++)
|
|
628
|
+
for (let a = l.x; a <= n.x; a++) {
|
|
616
629
|
const r = H(o, a, c);
|
|
617
|
-
r &&
|
|
630
|
+
r && s.push(r.cell);
|
|
618
631
|
}
|
|
619
|
-
|
|
632
|
+
s.length && t.em.setSelected(s, {
|
|
620
633
|
// @ts-expect-error custom option
|
|
621
634
|
fromCell: !0
|
|
622
635
|
});
|
|
623
|
-
},
|
|
636
|
+
}, _e = function(e, t = {}) {
|
|
624
637
|
const o = {
|
|
625
638
|
block: {},
|
|
626
639
|
...t
|
|
627
|
-
}, { Components: l } = e,
|
|
640
|
+
}, { Components: l } = e, n = {
|
|
628
641
|
copyable: !1,
|
|
629
642
|
emptyState: !0,
|
|
630
643
|
highlightable: !1,
|
|
@@ -705,7 +718,7 @@ const ae = "Cell settings", Se = "Merge cells", Ee = "Split cell", Ge = (e) => e
|
|
|
705
718
|
}
|
|
706
719
|
}
|
|
707
720
|
],
|
|
708
|
-
components:
|
|
721
|
+
components: ze(M, { rows: 5 }),
|
|
709
722
|
contextMenu: ({ items: c, editor: a, component: r }) => [
|
|
710
723
|
...q({ editor: a, component: r, opts: o }),
|
|
711
724
|
...c
|
|
@@ -716,21 +729,21 @@ const ae = "Cell settings", Se = "Merge cells", Ee = "Split cell", Ge = (e) => e
|
|
|
716
729
|
model: {
|
|
717
730
|
defaults: {
|
|
718
731
|
icon: u.tableHead,
|
|
719
|
-
...
|
|
732
|
+
...n
|
|
720
733
|
}
|
|
721
734
|
}
|
|
722
735
|
}), l.addType(_, {
|
|
723
736
|
model: {
|
|
724
737
|
defaults: {
|
|
725
738
|
icon: u.tableFoot,
|
|
726
|
-
...
|
|
739
|
+
...n
|
|
727
740
|
}
|
|
728
741
|
}
|
|
729
742
|
}), l.addType(M, {
|
|
730
743
|
model: {
|
|
731
744
|
defaults: {
|
|
732
745
|
icon: u.tableRowProperties,
|
|
733
|
-
...
|
|
746
|
+
...n
|
|
734
747
|
}
|
|
735
748
|
}
|
|
736
749
|
}), l.addType(b, {
|
|
@@ -793,29 +806,29 @@ const ae = "Cell settings", Se = "Merge cells", Ee = "Split cell", Ge = (e) => e
|
|
|
793
806
|
}
|
|
794
807
|
],
|
|
795
808
|
contextMenu: ({ items: c, editor: a, component: r }) => [
|
|
796
|
-
|
|
809
|
+
...$e({ editor: a, component: r, opts: o }),
|
|
797
810
|
...c
|
|
798
811
|
]
|
|
799
812
|
}
|
|
800
813
|
}
|
|
801
814
|
});
|
|
802
|
-
const
|
|
815
|
+
const s = ce((c, a) => {
|
|
803
816
|
var d;
|
|
804
817
|
const r = e.getSelectedAll(), h = !!((d = a == null ? void 0 : a.event) != null && d.shiftKey);
|
|
805
818
|
if (r.length < 2 || !h || a.fromCell) return;
|
|
806
819
|
const v = r.map((p) => p.is(g) ? p : p.closestType(g)).filter(Boolean);
|
|
807
|
-
v.length === r.length &&
|
|
820
|
+
v.length === r.length && We(v);
|
|
808
821
|
}, 0);
|
|
809
|
-
e.on("component:select",
|
|
822
|
+
e.on("component:select", s), we({
|
|
810
823
|
editor: e,
|
|
811
|
-
plan:
|
|
812
|
-
pluginName:
|
|
824
|
+
plan: Re,
|
|
825
|
+
pluginName: He,
|
|
813
826
|
licenseKey: o.licenseKey,
|
|
814
827
|
cleanup: () => {
|
|
815
|
-
e.off("component:select",
|
|
828
|
+
e.off("component:select", s), e.Blocks.remove(f), Pe.forEach((c) => l.removeType(c));
|
|
816
829
|
}
|
|
817
830
|
});
|
|
818
|
-
},
|
|
831
|
+
}, je = me(_e);
|
|
819
832
|
export {
|
|
820
|
-
|
|
833
|
+
je as default
|
|
821
834
|
};
|