@progress/kendo-react-editor 9.4.0-develop.23 → 9.4.0-develop.3
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/Editor.js +1 -1
- package/Editor.mjs +1 -0
- package/NOTICE.txt +51 -40
- package/config/defaultStyles.js +1 -1
- package/config/defaultStyles.mjs +1 -0
- package/config/shortcuts.js +1 -1
- package/config/shortcuts.mjs +9 -8
- package/config/toolsSettings.js +1 -1
- package/config/toolsSettings.mjs +1 -0
- package/dialogs/FindReplace.js +1 -1
- package/dialogs/FindReplace.mjs +1 -0
- package/dialogs/index.js +1 -1
- package/dialogs/index.mjs +1 -0
- package/dialogs/insertImage.js +1 -1
- package/dialogs/insertImage.mjs +1 -0
- package/dialogs/insertLink.js +1 -1
- package/dialogs/insertLink.mjs +11 -10
- package/dialogs/viewHtml.js +1 -1
- package/dialogs/viewHtml.mjs +6 -5
- package/dist/cdn/js/kendo-react-editor.js +1 -8
- package/index.js +1 -2
- package/index.mjs +7 -7
- package/messages/index.js +1 -1
- package/messages/index.mjs +1 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +3 -2
- package/package.json +14 -14
- package/tools/align.js +1 -1
- package/tools/align.mjs +5 -4
- package/tools/applyColor.js +1 -1
- package/tools/applyColor.mjs +6 -5
- package/tools/cleanFormatting.js +1 -1
- package/tools/cleanFormatting.mjs +9 -8
- package/tools/findReplace.js +1 -1
- package/tools/findReplace.mjs +10 -9
- package/tools/fontStyle.js +1 -1
- package/tools/fontStyle.mjs +7 -6
- package/tools/formatBlock.js +1 -1
- package/tools/formatBlock.mjs +11 -10
- package/tools/history.js +1 -1
- package/tools/history.mjs +3 -2
- package/tools/indent.js +1 -1
- package/tools/indent.mjs +1 -0
- package/tools/index.js +1 -1
- package/tools/index.mjs +1 -0
- package/tools/inlineFormat.js +1 -1
- package/tools/inlineFormat.mjs +5 -4
- package/tools/insertImage.js +1 -1
- package/tools/insertImage.mjs +5 -4
- package/tools/insertLink.js +1 -1
- package/tools/insertLink.mjs +14 -13
- package/tools/insertTable/popup.js +1 -1
- package/tools/insertTable/popup.mjs +5 -4
- package/tools/insertTable/popupGrid.js +1 -1
- package/tools/insertTable/popupGrid.mjs +1 -0
- package/tools/insertTable/tool.js +1 -1
- package/tools/insertTable/tool.mjs +1 -0
- package/tools/lists-styled.js +1 -1
- package/tools/lists-styled.mjs +1 -0
- package/tools/lists.js +1 -1
- package/tools/lists.mjs +14 -13
- package/tools/outdent.js +1 -1
- package/tools/outdent.mjs +1 -0
- package/tools/pdf.js +1 -1
- package/tools/pdf.mjs +5 -4
- package/tools/print.js +1 -1
- package/tools/print.mjs +5 -4
- package/tools/proseMirrorTool.js +1 -1
- package/tools/proseMirrorTool.mjs +9 -8
- package/tools/selectAll.js +1 -1
- package/tools/selectAll.mjs +6 -5
- package/tools/table-wizard/cellPropsUtils.js +1 -1
- package/tools/table-wizard/cellPropsUtils.mjs +35 -34
- package/tools/table-wizard/tableCellProperties.js +1 -1
- package/tools/table-wizard/tableCellProperties.mjs +1 -0
- package/tools/table-wizard/tableProperties.js +1 -1
- package/tools/table-wizard/tableProperties.mjs +45 -44
- package/tools/table-wizard/tablePropsUtils.js +1 -1
- package/tools/table-wizard/tablePropsUtils.mjs +100 -99
- package/tools/table-wizard/utils.js +1 -1
- package/tools/table-wizard/utils.mjs +18 -17
- package/tools/tableEdit.js +1 -1
- package/tools/tableEdit.mjs +3 -2
- package/tools/unlink.js +1 -1
- package/tools/unlink.mjs +9 -8
- package/tools/utils.js +1 -1
- package/tools/utils.mjs +1 -0
- package/tools/viewHtml.js +1 -1
- package/tools/viewHtml.mjs +12 -11
- package/utils/browser-detection.js +1 -1
- package/utils/browser-detection.mjs +1 -0
- package/utils/controlled-value.js +1 -1
- package/utils/controlled-value.mjs +3 -2
- package/utils/index.js +1 -1
- package/utils/index.mjs +1 -0
- package/utils/props-key.js +1 -1
- package/utils/props-key.mjs +4 -3
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
+
"use client";
|
|
8
9
|
import * as e from "react";
|
|
9
10
|
import { Button as A } from "@progress/kendo-react-buttons";
|
|
10
11
|
import { NumericTextBox as s, ColorPicker as se, Checkbox as Ne, TextBox as L } from "@progress/kendo-react-inputs";
|
|
@@ -17,20 +18,20 @@ import { valueRenderWithIcon as k, itemRenderWithIcon as v } from "./tableCellPr
|
|
|
17
18
|
import { useLocalization as ge } from "@progress/kendo-react-intl";
|
|
18
19
|
import { keys as t, messages as l } from "../../messages/index.mjs";
|
|
19
20
|
import { applyTableData as ze, tablePositionStyles as He, tableDefaultData as We, initialTableData as Ue } from "./tablePropsUtils.mjs";
|
|
20
|
-
const _e = (
|
|
21
|
-
const { view:
|
|
21
|
+
const _e = (o) => {
|
|
22
|
+
const { view: n, ...r } = o, P = ge(), [N, b] = e.useState(!1), g = !!(n && Te(n.state.selection.$from, (i) => i.type.spec.tableRole === "table")), p = e.useCallback(() => {
|
|
22
23
|
b(!0);
|
|
23
24
|
}, []), m = e.useCallback(() => {
|
|
24
|
-
b(!1),
|
|
25
|
-
}, [
|
|
25
|
+
b(!1), n == null || n.focus();
|
|
26
|
+
}, [n]), f = e.useCallback(
|
|
26
27
|
(i) => {
|
|
27
|
-
if (
|
|
28
|
-
const u = ze(
|
|
29
|
-
u &&
|
|
28
|
+
if (n && i) {
|
|
29
|
+
const u = ze(n.state, i);
|
|
30
|
+
u && n.dispatch(u);
|
|
30
31
|
}
|
|
31
32
|
m();
|
|
32
33
|
},
|
|
33
|
-
[
|
|
34
|
+
[n, m]
|
|
34
35
|
);
|
|
35
36
|
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
36
37
|
A,
|
|
@@ -44,7 +45,7 @@ const _e = (n) => {
|
|
|
44
45
|
...De,
|
|
45
46
|
...r
|
|
46
47
|
}
|
|
47
|
-
), N && /* @__PURE__ */ e.createElement(Fe, { onClose: m, onSave: f, view:
|
|
48
|
+
), N && /* @__PURE__ */ e.createElement(Fe, { onClose: m, onSave: f, view: n }));
|
|
48
49
|
}, E = [
|
|
49
50
|
{
|
|
50
51
|
textKey: t.tablePropertiesAlignLeft,
|
|
@@ -99,7 +100,7 @@ const _e = (n) => {
|
|
|
99
100
|
icon: "table-position-right",
|
|
100
101
|
svgIcon: Re
|
|
101
102
|
}
|
|
102
|
-
].map((
|
|
103
|
+
].map((o) => ({ ...o, style: He[o.value] })), fe = [
|
|
103
104
|
{
|
|
104
105
|
textKey: t.tablePropertiesTop,
|
|
105
106
|
text: l[t.tablePropertiesTop],
|
|
@@ -126,14 +127,14 @@ const _e = (n) => {
|
|
|
126
127
|
text: l[t.tablePropertiesUsingIdAttributes],
|
|
127
128
|
value: "id"
|
|
128
129
|
}
|
|
129
|
-
], Fe = (
|
|
130
|
-
const
|
|
131
|
-
const a =
|
|
130
|
+
], Fe = (o) => {
|
|
131
|
+
const n = e.useMemo(() => {
|
|
132
|
+
const a = o.view && o.view.state;
|
|
132
133
|
return a ? We(a) : Ue;
|
|
133
|
-
}, [
|
|
134
|
+
}, [o.view]), r = ge(), [P, N] = e.useState(0), b = e.useCallback((a) => {
|
|
134
135
|
N(a.selected);
|
|
135
136
|
}, []), g = e.useRef(null), p = e.useRef(null), m = e.useRef(null), f = e.useRef(null), i = e.useRef(null), u = e.useRef(null), S = e.useRef(null), I = e.useRef(null), B = e.useRef(null), K = e.useRef(null), x = e.useRef(null), h = e.useRef(null), V = e.useRef(null), T = e.useRef(null), D = e.useRef(null), z = e.useRef(null), H = e.useRef(null), W = e.useRef(null), U = e.useRef(null), F = e.useRef(null), C = e.useRef(null), w = e.useRef(null), y = e.useRef(null), pe = e.useCallback(() => {
|
|
136
|
-
var R, M, G, $, j, q, J, O, Q, X, Y, Z, _, ee, te, ae, le, re,
|
|
137
|
+
var R, M, G, $, j, q, J, O, Q, X, Y, Z, _, ee, te, ae, le, re, ne, oe;
|
|
137
138
|
const a = {
|
|
138
139
|
rows: ((R = g.current) == null ? void 0 : R.value) || 0,
|
|
139
140
|
columns: ((M = p.current) == null ? void 0 : M.value) || 0,
|
|
@@ -156,24 +157,24 @@ const _e = (n) => {
|
|
|
156
157
|
headerRows: ((ae = U.current) == null ? void 0 : ae.value) || 0,
|
|
157
158
|
headerColumns: ((le = F.current) == null ? void 0 : le.value) || 0,
|
|
158
159
|
captionAlignment: (re = C.current) != null && re.value ? C.current.value.value : null,
|
|
159
|
-
captionPosition: (
|
|
160
|
-
associateHeaders: (
|
|
160
|
+
captionPosition: (ne = w.current) != null && ne.value ? w.current.value.value : null,
|
|
161
|
+
associateHeaders: (oe = y.current) != null && oe.value ? y.current.value.value : "none"
|
|
161
162
|
};
|
|
162
|
-
|
|
163
|
-
}, [
|
|
163
|
+
o.onSave.call(void 0, a);
|
|
164
|
+
}, [o.onSave]), ke = /* @__PURE__ */ e.createElement("div", { className: "k-form k-form-md" }, /* @__PURE__ */ e.createElement("fieldset", { className: "k-form-fieldset" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-layout k-d-grid k-grid-cols-4 k-gap-x-4" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-2" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
164
165
|
t.tablePropertiesRows,
|
|
165
166
|
l[t.tablePropertiesRows]
|
|
166
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: g, defaultValue:
|
|
167
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: g, defaultValue: n.rows, min: 1 }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-2" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
167
168
|
t.tablePropertiesColumns,
|
|
168
169
|
l[t.tablePropertiesColumns]
|
|
169
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: p, defaultValue:
|
|
170
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: p, defaultValue: n.columns, min: 1 }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-1" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
170
171
|
t.tablePropertiesWidth,
|
|
171
172
|
l[t.tablePropertiesWidth]
|
|
172
173
|
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
|
|
173
174
|
s,
|
|
174
175
|
{
|
|
175
176
|
ref: m,
|
|
176
|
-
defaultValue:
|
|
177
|
+
defaultValue: n.width,
|
|
177
178
|
min: 0,
|
|
178
179
|
placeholder: r.toLanguageString(t.sizeAuto, l[t.sizeAuto])
|
|
179
180
|
}
|
|
@@ -181,7 +182,7 @@ const _e = (n) => {
|
|
|
181
182
|
ie,
|
|
182
183
|
{
|
|
183
184
|
ref: I,
|
|
184
|
-
defaultValue:
|
|
185
|
+
defaultValue: n.widthUnit,
|
|
185
186
|
data: me,
|
|
186
187
|
popupSettings: c
|
|
187
188
|
}
|
|
@@ -192,7 +193,7 @@ const _e = (n) => {
|
|
|
192
193
|
s,
|
|
193
194
|
{
|
|
194
195
|
ref: f,
|
|
195
|
-
defaultValue:
|
|
196
|
+
defaultValue: n.height,
|
|
196
197
|
min: 0,
|
|
197
198
|
placeholder: r.toLanguageString(t.sizeAuto, l[t.sizeAuto])
|
|
198
199
|
}
|
|
@@ -200,7 +201,7 @@ const _e = (n) => {
|
|
|
200
201
|
ie,
|
|
201
202
|
{
|
|
202
203
|
ref: B,
|
|
203
|
-
defaultValue:
|
|
204
|
+
defaultValue: n.heightUnit,
|
|
204
205
|
data: me.filter((a) => a !== "%"),
|
|
205
206
|
popupSettings: c
|
|
206
207
|
}
|
|
@@ -211,7 +212,7 @@ const _e = (n) => {
|
|
|
211
212
|
d,
|
|
212
213
|
{
|
|
213
214
|
ref: K,
|
|
214
|
-
defaultValue: de.find((a) => a.value ===
|
|
215
|
+
defaultValue: de.find((a) => a.value === n.position),
|
|
215
216
|
popupSettings: c,
|
|
216
217
|
data: de.map((a) => ({
|
|
217
218
|
...a,
|
|
@@ -229,7 +230,7 @@ const _e = (n) => {
|
|
|
229
230
|
d,
|
|
230
231
|
{
|
|
231
232
|
ref: x,
|
|
232
|
-
defaultValue: E.find((a) => a.value ===
|
|
233
|
+
defaultValue: E.find((a) => a.value === n.textAlign),
|
|
233
234
|
data: E.map((a) => ({ ...a, text: r.toLanguageString(a.textKey, a.text) })),
|
|
234
235
|
textField: "text",
|
|
235
236
|
dataItemKey: "value",
|
|
@@ -244,7 +245,7 @@ const _e = (n) => {
|
|
|
244
245
|
s,
|
|
245
246
|
{
|
|
246
247
|
ref: i,
|
|
247
|
-
defaultValue:
|
|
248
|
+
defaultValue: n.cellSpacing,
|
|
248
249
|
placeholder: r.toLanguageString(t.sizeAuto, l[t.sizeAuto]),
|
|
249
250
|
min: 0
|
|
250
251
|
}
|
|
@@ -255,27 +256,27 @@ const _e = (n) => {
|
|
|
255
256
|
s,
|
|
256
257
|
{
|
|
257
258
|
ref: u,
|
|
258
|
-
defaultValue:
|
|
259
|
+
defaultValue: n.cellPadding,
|
|
259
260
|
placeholder: r.toLanguageString(t.sizeAuto, l[t.sizeAuto]),
|
|
260
261
|
min: 0
|
|
261
262
|
}
|
|
262
263
|
))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-full" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
263
264
|
t.tablePropertiesTableBackground,
|
|
264
265
|
l[t.tablePropertiesTableBackground]
|
|
265
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(se, { ref: V, defaultValue:
|
|
266
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(se, { ref: V, defaultValue: n.backgroundColor }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-1" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
266
267
|
t.tablePropertiesBorderWidth,
|
|
267
268
|
l[t.tablePropertiesBorderWidth]
|
|
268
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: S, defaultValue:
|
|
269
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: S, defaultValue: n.borderWidth, min: 0 }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-1" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
269
270
|
t.tablePropertiesBorderColor,
|
|
270
271
|
l[t.tablePropertiesBorderColor]
|
|
271
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(se, { ref: T, defaultValue:
|
|
272
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(se, { ref: T, defaultValue: n.borderColor }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-2" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
272
273
|
t.tablePropertiesBorderStyle,
|
|
273
274
|
l[t.tablePropertiesBorderStyle]
|
|
274
275
|
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
|
|
275
276
|
d,
|
|
276
277
|
{
|
|
277
278
|
ref: h,
|
|
278
|
-
defaultValue: ue.find((a) => a.value ===
|
|
279
|
+
defaultValue: ue.find((a) => a.value === n.borderStyle),
|
|
279
280
|
popupSettings: c,
|
|
280
281
|
data: ue.map((a) => ({
|
|
281
282
|
...a,
|
|
@@ -293,18 +294,18 @@ const _e = (n) => {
|
|
|
293
294
|
t.tablePropertiesCollapseBorders,
|
|
294
295
|
l[t.tablePropertiesCollapseBorders]
|
|
295
296
|
),
|
|
296
|
-
defaultChecked:
|
|
297
|
+
defaultChecked: n.collapseBorders
|
|
297
298
|
}
|
|
298
|
-
)))))), ve = /* @__PURE__ */ e.createElement("div", { className: "k-form k-form-md" }, /* @__PURE__ */ e.createElement("fieldset", { className: "k-form-fieldset" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-layout k-d-grid" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-field" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(t.tablePropertiesId, l[t.tablePropertiesId])), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(L, { ref: z, defaultValue:
|
|
299
|
+
)))))), ve = /* @__PURE__ */ e.createElement("div", { className: "k-form k-form-md" }, /* @__PURE__ */ e.createElement("fieldset", { className: "k-form-fieldset" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-layout k-d-grid" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-field" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(t.tablePropertiesId, l[t.tablePropertiesId])), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(L, { ref: z, defaultValue: n.id }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
299
300
|
t.tablePropertiesCssClass,
|
|
300
301
|
l[t.tablePropertiesCssClass]
|
|
301
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(L, { ref: H, defaultValue:
|
|
302
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(L, { ref: H, defaultValue: n.className }))), /* @__PURE__ */ e.createElement("fieldset", { className: "k-form-fieldset" }, /* @__PURE__ */ e.createElement("legend", { className: "k-form-legend" }, r.toLanguageString(
|
|
302
303
|
t.tablePropertiesAccessibility,
|
|
303
304
|
l[t.tablePropertiesAccessibility]
|
|
304
305
|
)), /* @__PURE__ */ e.createElement("div", { className: "k-d-grid k-grid-cols-4 k-gap-x-4" }, /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-full" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
305
306
|
t.tablePropertiesCaption,
|
|
306
307
|
l[t.tablePropertiesCaption]
|
|
307
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(L, { ref: W, defaultValue:
|
|
308
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(L, { ref: W, defaultValue: n.caption }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-2" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
308
309
|
t.tablePropertiesCaptionPosition,
|
|
309
310
|
l[t.tablePropertiesCaptionPosition]
|
|
310
311
|
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
|
|
@@ -312,7 +313,7 @@ const _e = (n) => {
|
|
|
312
313
|
{
|
|
313
314
|
ref: w,
|
|
314
315
|
defaultValue: fe.find(
|
|
315
|
-
(a) => a.value ===
|
|
316
|
+
(a) => a.value === n.captionPosition
|
|
316
317
|
),
|
|
317
318
|
data: fe.map((a) => ({
|
|
318
319
|
...a,
|
|
@@ -331,7 +332,7 @@ const _e = (n) => {
|
|
|
331
332
|
d,
|
|
332
333
|
{
|
|
333
334
|
ref: C,
|
|
334
|
-
defaultValue: E.find((a) => a.value ===
|
|
335
|
+
defaultValue: E.find((a) => a.value === n.captionAlignment),
|
|
335
336
|
data: E.map((a) => ({
|
|
336
337
|
...a,
|
|
337
338
|
text: r.toLanguageString(a.textKey, a.text)
|
|
@@ -345,10 +346,10 @@ const _e = (n) => {
|
|
|
345
346
|
))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-1" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
346
347
|
t.tablePropertiesHeaderRows,
|
|
347
348
|
l[t.tablePropertiesHeaderRows]
|
|
348
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: U, defaultValue:
|
|
349
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: U, defaultValue: n.headerRows, min: 0 }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-1" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
349
350
|
t.tablePropertiesHeaderCols,
|
|
350
351
|
l[t.tablePropertiesHeaderCols]
|
|
351
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: F, defaultValue:
|
|
352
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(s, { ref: F, defaultValue: n.headerColumns, min: 0 }))), /* @__PURE__ */ e.createElement("div", { className: "k-form-field k-col-span-2" }, /* @__PURE__ */ e.createElement("label", { className: "k-label k-form-label" }, r.toLanguageString(
|
|
352
353
|
t.tablePropertiesAssociateHeaders,
|
|
353
354
|
l[t.tablePropertiesAssociateHeaders]
|
|
354
355
|
)), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
|
|
@@ -356,7 +357,7 @@ const _e = (n) => {
|
|
|
356
357
|
{
|
|
357
358
|
ref: y,
|
|
358
359
|
defaultValue: be.find(
|
|
359
|
-
(a) => a.value ===
|
|
360
|
+
(a) => a.value === n.associateHeaders
|
|
360
361
|
),
|
|
361
362
|
data: be.map((a) => ({
|
|
362
363
|
...a,
|
|
@@ -386,14 +387,14 @@ const _e = (n) => {
|
|
|
386
387
|
ve
|
|
387
388
|
)), Pe = [
|
|
388
389
|
/* @__PURE__ */ e.createElement(A, { themeColor: "primary", key: "save", onClick: pe }, r.toLanguageString(t.tablePropertiesSave, l[t.tablePropertiesSave])),
|
|
389
|
-
/* @__PURE__ */ e.createElement(A, { onClick:
|
|
390
|
+
/* @__PURE__ */ e.createElement(A, { onClick: o.onClose, key: "cancel" }, r.toLanguageString(t.tablePropertiesCancel, l[t.tablePropertiesCancel]))
|
|
390
391
|
];
|
|
391
392
|
return /* @__PURE__ */ e.createElement(
|
|
392
393
|
Se,
|
|
393
394
|
{
|
|
394
395
|
className: "k-editor-window k-editor-table-wizard-window",
|
|
395
396
|
title: r.toLanguageString(t.tableProperties, l[t.tableProperties]),
|
|
396
|
-
onClose:
|
|
397
|
+
onClose: o.onClose,
|
|
397
398
|
key: "dialog",
|
|
398
399
|
style: { userSelect: "none" },
|
|
399
400
|
width: 480,
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@progress/kendo-editor-common"),k=require("../tableEdit.js"),d=require("./utils.js"),N=require("../utils.js"),E={rows:0,columns:0,width:null,widthUnit:"",height:null,heightUnit:"",position:null,textAlign:"",cellPadding:null,cellSpacing:null,backgroundColor:void 0,borderWidth:null,borderColor:void 0,borderStyle:null,collapseBorders:!1,id:"",className:"",caption:"",captionAlignment:null,captionPosition:null,headerRows:0,headerColumns:0,associateHeaders:"none"},A={left:{"margin-left":"","margin-right":"auto"},center:{"margin-left":"auto","margin-right":"auto"},right:{"margin-left":"auto","margin-right":""},"":{}},M=o=>{const t=[];for(let s=0;s<o.height;s++){const l=s*o.width,e=l+o.width;t.push(o.map.slice(l,e))}return t},$=(o,t)=>{let s=0,l=0;const e=M(t);e.forEach(n=>{let i=!0;n.forEach(r=>{const c=o.nodeAt(r);c&&c.type.name!=="table_header"&&(i=!1)}),i&&s++});for(let n=0;n<t.width;n++){let i=!0;for(let r=0;r<t.height;r++){const c=e[r]&&e[r][n],u=typeof c=="number"&&o.nodeAt(c);u&&u.type.name!=="table_header"&&(i=!1)}i&&l++}return{rows:s,columns:l}},v=o=>{const t=new Set;return o.content.forEach(s=>{s.content.forEach(l=>{t.add(d.parseStyle(l.attrs.style).padding||"")})}),t.size===1?Array.from(t)[0]:""},j=o=>{let t=!0,s=!0;return o.content.forEach(l=>{l.content.forEach(e=>{const n=e.type.name==="table_header",i=e.type.name==="table_cell";n&&!e.attrs.scope&&(t=!1),(n&&!e.attrs.id||i&&!e.attrs.headers)&&(s=!1)})}),t?"scope":s?"id":"none"},F=o=>{var a,h,m;const t=d.selectedCells(o),s=o.selection.$from,l=t.length?N.parentNode(s,f=>f.type.spec.tableRole==="table"):null;if(!l)return E;const e=N.parentNode(s,f=>f.type.name==="table_wrapper");let n="",i={},r={};e&&(r=d.parseStyle(e.node.attrs.style),e.node.content.forEach(f=>{if(f.type.name==="table_caption_external"){const S=w.pmDocToFragment(f);n=w.fragmentToHtml(S),n=n==="<img>"?"":n,i=d.parseStyle(f.attrs.style)}}));const c=d.parseStyle(((a=l.node.attrs)==null?void 0:a.style)||""),u=w.TableMap.get(l.node),p=r["margin-left"]==="auto"&&r["margin-right"]==="auto"?"center":r["margin-right"]==="auto"?"left":r["margin-left"]==="auto"?"right":null,y=$(l.node,u),g=v(l.node);return{...E,columns:u.width,rows:u.height,...d.nodeSize(l.node,"width"),...e&&/%/.test(r.width||"")?d.nodeSize(e.node,"width"):{},...d.nodeSize(l.node,"height"),textAlign:c["text-align"]||"",position:p||null,cellPadding:g?parseFloat(g):null,cellSpacing:c["border-spacing"]?parseFloat(c["border-spacing"]):null,backgroundColor:c["background-color"],borderWidth:c["border-width"]?parseFloat(c["border-width"]):null,borderColor:c["border-color"],borderStyle:c["border-style"]||null,collapseBorders:c["border-collapse"]==="collapse",caption:n||void 0,captionAlignment:i["text-align"]||"",captionPosition:i["caption-side"]||null,headerRows:y.rows,headerColumns:y.columns,associateHeaders:y.rows||y.columns?j(l.node):"none",id:((h=l.node.attrs)==null?void 0:h.id)||"",className:((m=l.node.attrs)==null?void 0:m.class)||""}},x=o=>{const s=o.lastChild.lastChild;return{node:s,pos:o.content.size-s.nodeSize}},_=(o,t,s,l,e)=>{const n=x(s),i=t+n.pos;if(!o.doc.nodeAt(i))return o;const c=o.doc.resolve(i),u=new w.CellSelection(c,c),p=o.tr.setSelection(u);let y=o.apply(p);for(let g=0;g<l;g++)e(y,a=>{y=y.apply(a)});return y},R=(o,t,s,l)=>{let e=o;for(let n=0;n<s;n++){const i=e.doc.nodeAt(t);if(i){const r=x(i),c=t+r.pos,u=e.doc.resolve(c),p=new w.CellSelection(u,u),y=e.tr.setSelection(p);e=e.apply(y),l(e,g=>{e=e.apply(g)})}}return e},O=(o,t,s,l)=>{let e=o,n=e.doc.nodeAt(t);if(!n)return e;let i=w.TableMap.get(n);return i.width===l&&i.height===s||(l>i.width?e=_(e,t,n,l-i.width,w.addColumnAfter):l<i.width&&(e=R(e,t,i.width-l,k.deleteColumnCmd)),n=e.doc.nodeAt(t),!n)||(i=w.TableMap.get(n),s>i.height?e=_(e,t,n,s-i.height,w.addRowAfter):s<i.height&&(e=R(e,t,i.height-s,k.deleteRowCmd))),e},q=(o,t,s)=>{const l=o.doc.nodeAt(s);if(!l)return o;let e={...l.attrs};const n=t.width!==null&&(t.widthUnit!=="%"||!t.caption&&!t.position);e=d.setNodeStyle(e,"width",n?t.width+t.widthUnit:""),e=d.setNodeStyle(e,"height",t.height!==null?t.height+t.heightUnit:""),e=d.setNodeStyle(e,"text-align",t.textAlign||""),e=d.setNodeStyle(e,"background-color",t.backgroundColor||""),e=d.setNodeStyle(e,"border-width",t.borderWidth?t.borderWidth+"px":""),e=d.setNodeStyle(e,"border-style",t.borderStyle||""),e=d.setNodeStyle(e,"border-color",t.borderColor||""),e=d.setNodeStyle(e,"border-spacing",t.cellSpacing!==null?t.cellSpacing+"px":""),t.cellSpacing!==null?e=d.setNodeStyle(e,"border-collapse","unset"):e=d.setNodeStyle(e,"border-collapse",t.collapseBorders?"collapse":"");const i=A[t.position||""]||{};Object.keys(i).forEach(c=>{e=d.setNodeStyle(e,c,i[c])}),e.id=t.id||null,e.class=t.className||null;const r=o.tr.setNodeMarkup(s,null,e);return o=o.apply(r),o},z=(o,t,s,l,e)=>{if(t.type.name!==l.name||Object.keys(e).length>0){const n=o.tr.setNodeMarkup(s,l,{...t.attrs,...e});return o.apply(n)}return o},B=(o,t)=>{/^cell-[0-9]+-[0-9]+$/.test(o.attrs.id||"")&&(t.id=null)},P=(o,t,s)=>{const l=o.doc.nodeAt(s),e=l&&w.TableMap.get(l);if(!l||!e)return o;const n=M(e);let i=o;const{table_header:r,table_cell:c}=o.schema.nodes,u=String(new Date().getTime()),p=[],y=(a,h)=>{const m=`cell-${a}${h}-${u}`;return p[a]||p.push([]),p[a][h]||p[a].push([]),p[a][h]=m,m},g=(a,h,m,f)=>{const S=[];if(f)for(let b=0;b<a;b++)p[b]&&p[b][h]&&S.push(p[b][h]);if(m)for(let b=0;b<h;b++)p[a]&&p[a][b]&&S.push(p[a][b]);return S.join(" ")};return n.forEach((a,h)=>{a.forEach((m,f)=>{const S=l.nodeAt(m);if(S){const b=f<t.headerColumns,T=h<t.headerRows,C={...S.attrs};B(S,C),C.headers=null,C.scope=null,T||b?(t.associateHeaders==="scope"&&(C.scope=T?"col":"row"),t.associateHeaders==="id"&&(C.id=y(h,f),(f>0||h>0)&&(C.headers=g(h,f,b,T)||null)),i=z(i,S,s+m+1,r,C)):(t.associateHeaders==="id"&&(C.headers=g(h,f,t.headerColumns>0,t.headerRows>0)||null),i=z(i,S,s+m+1,c,C))}})}),i},G=(o,t,s,l)=>{let e={...t.attrs};return e=d.setNodeStyle(e,"margin-left",""),e=d.setNodeStyle(e,"margin-right",""),Object.keys(l||{}).forEach(n=>{e=d.setNodeStyle(e,n,(l||{})[n]||"")}),o.apply(o.tr.setNodeMarkup(s,null,e))},D=(o,t)=>w.parseContent("<p>"+o+"</p>",t).content.firstChild.content,H=(o,t)=>{if(!o.caption)return;let s={caption:"",style:"display: table-caption"};o.captionAlignment&&(s=d.setNodeStyle(s,"text-align",o.captionAlignment)),o.captionPosition&&(s=d.setNodeStyle(s,"caption-side",o.captionPosition));const l=D(o.caption,t);return l&&t.nodes.table_caption_external.createAndFill(s,l)||void 0},U=o=>o.firstChild&&o.firstChild.type.name==="table_caption_external",J=(o,t,s,l)=>{let e=o,n;const i=s+2,r=s+1,c=e.schema;if(U(t))if(n=t.firstChild,l.caption){const u=D(l.caption,c);if(e=e.apply(e.tr.replaceWith(i,i+n.content.size,u)),n=e.doc.nodeAt(r),n){let p={...n.attrs};p=d.setNodeStyle(p,"text-align",l.captionAlignment||""),p=d.setNodeStyle(p,"caption-side",l.captionPosition||""),e=e.apply(e.tr.setNodeAttribute(r,"style",p.style))}}else e=e.apply(e.tr.deleteRange(i,i+n.content.size));else n=H(l,c),n&&(e=e.apply(e.tr.replaceWith(r,r,n)));return e},K=(o,t,s,l,e)=>{let n={state:o,pos:s};if(!l&&(t.position||t.caption)){let r={table:"",style:"display: table"};const c=[],u=t.position,p=u&&A[u];p&&Object.keys(p).forEach(h=>{r=d.setNodeStyle(r,h,p[h]||"")}),typeof t.width=="number"&&t.widthUnit==="%"&&(r=d.setNodeStyle(r,"width",t.width+t.widthUnit));const y=H(t,o.schema);y&&c.push(y);const g=o.doc.nodeAt(s);c.push(g);const a=o.schema.nodes.table_wrapper.createAndFill(r,c);if(a){const h=o.tr.replaceWith(s,s+g.content.size,a);o=o.apply(h),n={state:o,pos:s}}}else l&&(t.position||t.caption||!t.caption&&U(l.node))?(o=G(o,l.node,e,t.position&&A[t.position]),o=J(o,l.node,e,t),n={state:o,pos:e}):l&&!(t.position||t.caption)?n={state:o,node:l.node,pos:o.selection.$from.start(l.depth)-1}:n={state:o,pos:s};const i=l&&n.state.doc.nodeAt(e);if(i){let r;typeof t.width=="number"&&t.widthUnit==="%"?r=d.setNodeStyle(i.attrs,"width",t.width+t.widthUnit):t.widthUnit!=="%"&&/%/.test(d.parseStyle(i.attrs.style||"").width||"")&&(r=d.setNodeStyle(i.attrs,"width","")),r&&(n.state=n.state.apply(n.state.tr.setNodeMarkup(e,null,r)))}return n},L=(o,t)=>{const s=o.selection.$from,l=N.parentNode(s,f=>f.type.spec.tableRole==="table");if(!l)return;const e=s.start(l.depth)-1;let n=O(o,e,t.rows,t.columns);if(!n)return;const i=n.tr;d.tableCells(n).forEach(f=>{let S={...f.node.attrs};S=d.setNodeStyle(S,"padding",typeof t.cellPadding=="number"?t.cellPadding+"px":""),i.setNodeMarkup(f.pos,null,S)}),n=n.apply(i),n=q(n,t,e),n=P(n,t,e);const r=N.parentNode(s,f=>f.type.name==="table_wrapper"),c=s.start((r==null?void 0:r.depth)||0)-1,u=K(n,t,e,r,c);n=u.state;const p=u.pos,y=n.doc.nodeAt(u.pos);if(!y)return;const g=p+(r||l).node.content.size,a=o.tr.replaceWith(p,g,y),h=w.Selection.atEnd(y),m=w.TextSelection.create(a.doc,p+h.to+1);return a.setSelection(m),a};exports.applyTableData=L;exports.initialTableData=E;exports.tableDefaultData=F;exports.tablePositionStyles=A;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@progress/kendo-editor-common"),k=require("../tableEdit.js"),d=require("./utils.js"),N=require("../utils.js"),E={rows:0,columns:0,width:null,widthUnit:"",height:null,heightUnit:"",position:null,textAlign:"",cellPadding:null,cellSpacing:null,backgroundColor:void 0,borderWidth:null,borderColor:void 0,borderStyle:null,collapseBorders:!1,id:"",className:"",caption:"",captionAlignment:null,captionPosition:null,headerRows:0,headerColumns:0,associateHeaders:"none"},A={left:{"margin-left":"","margin-right":"auto"},center:{"margin-left":"auto","margin-right":"auto"},right:{"margin-left":"auto","margin-right":""},"":{}},M=o=>{const t=[];for(let s=0;s<o.height;s++){const l=s*o.width,e=l+o.width;t.push(o.map.slice(l,e))}return t},$=(o,t)=>{let s=0,l=0;const e=M(t);e.forEach(n=>{let i=!0;n.forEach(r=>{const c=o.nodeAt(r);c&&c.type.name!=="table_header"&&(i=!1)}),i&&s++});for(let n=0;n<t.width;n++){let i=!0;for(let r=0;r<t.height;r++){const c=e[r]&&e[r][n],u=typeof c=="number"&&o.nodeAt(c);u&&u.type.name!=="table_header"&&(i=!1)}i&&l++}return{rows:s,columns:l}},v=o=>{const t=new Set;return o.content.forEach(s=>{s.content.forEach(l=>{t.add(d.parseStyle(l.attrs.style).padding||"")})}),t.size===1?Array.from(t)[0]:""},j=o=>{let t=!0,s=!0;return o.content.forEach(l=>{l.content.forEach(e=>{const n=e.type.name==="table_header",i=e.type.name==="table_cell";n&&!e.attrs.scope&&(t=!1),(n&&!e.attrs.id||i&&!e.attrs.headers)&&(s=!1)})}),t?"scope":s?"id":"none"},F=o=>{var a,h,m;const t=d.selectedCells(o),s=o.selection.$from,l=t.length?N.parentNode(s,f=>f.type.spec.tableRole==="table"):null;if(!l)return E;const e=N.parentNode(s,f=>f.type.name==="table_wrapper");let n="",i={},r={};e&&(r=d.parseStyle(e.node.attrs.style),e.node.content.forEach(f=>{if(f.type.name==="table_caption_external"){const S=w.pmDocToFragment(f);n=w.fragmentToHtml(S),n=n==="<img>"?"":n,i=d.parseStyle(f.attrs.style)}}));const c=d.parseStyle(((a=l.node.attrs)==null?void 0:a.style)||""),u=w.TableMap.get(l.node),p=r["margin-left"]==="auto"&&r["margin-right"]==="auto"?"center":r["margin-right"]==="auto"?"left":r["margin-left"]==="auto"?"right":null,y=$(l.node,u),g=v(l.node);return{...E,columns:u.width,rows:u.height,...d.nodeSize(l.node,"width"),...e&&/%/.test(r.width||"")?d.nodeSize(e.node,"width"):{},...d.nodeSize(l.node,"height"),textAlign:c["text-align"]||"",position:p||null,cellPadding:g?parseFloat(g):null,cellSpacing:c["border-spacing"]?parseFloat(c["border-spacing"]):null,backgroundColor:c["background-color"],borderWidth:c["border-width"]?parseFloat(c["border-width"]):null,borderColor:c["border-color"],borderStyle:c["border-style"]||null,collapseBorders:c["border-collapse"]==="collapse",caption:n||void 0,captionAlignment:i["text-align"]||"",captionPosition:i["caption-side"]||null,headerRows:y.rows,headerColumns:y.columns,associateHeaders:y.rows||y.columns?j(l.node):"none",id:((h=l.node.attrs)==null?void 0:h.id)||"",className:((m=l.node.attrs)==null?void 0:m.class)||""}},x=o=>{const s=o.lastChild.lastChild;return{node:s,pos:o.content.size-s.nodeSize}},_=(o,t,s,l,e)=>{const n=x(s),i=t+n.pos;if(!o.doc.nodeAt(i))return o;const c=o.doc.resolve(i),u=new w.CellSelection(c,c),p=o.tr.setSelection(u);let y=o.apply(p);for(let g=0;g<l;g++)e(y,a=>{y=y.apply(a)});return y},R=(o,t,s,l)=>{let e=o;for(let n=0;n<s;n++){const i=e.doc.nodeAt(t);if(i){const r=x(i),c=t+r.pos,u=e.doc.resolve(c),p=new w.CellSelection(u,u),y=e.tr.setSelection(p);e=e.apply(y),l(e,g=>{e=e.apply(g)})}}return e},O=(o,t,s,l)=>{let e=o,n=e.doc.nodeAt(t);if(!n)return e;let i=w.TableMap.get(n);return i.width===l&&i.height===s||(l>i.width?e=_(e,t,n,l-i.width,w.addColumnAfter):l<i.width&&(e=R(e,t,i.width-l,k.deleteColumnCmd)),n=e.doc.nodeAt(t),!n)||(i=w.TableMap.get(n),s>i.height?e=_(e,t,n,s-i.height,w.addRowAfter):s<i.height&&(e=R(e,t,i.height-s,k.deleteRowCmd))),e},q=(o,t,s)=>{const l=o.doc.nodeAt(s);if(!l)return o;let e={...l.attrs};const n=t.width!==null&&(t.widthUnit!=="%"||!t.caption&&!t.position);e=d.setNodeStyle(e,"width",n?t.width+t.widthUnit:""),e=d.setNodeStyle(e,"height",t.height!==null?t.height+t.heightUnit:""),e=d.setNodeStyle(e,"text-align",t.textAlign||""),e=d.setNodeStyle(e,"background-color",t.backgroundColor||""),e=d.setNodeStyle(e,"border-width",t.borderWidth?t.borderWidth+"px":""),e=d.setNodeStyle(e,"border-style",t.borderStyle||""),e=d.setNodeStyle(e,"border-color",t.borderColor||""),e=d.setNodeStyle(e,"border-spacing",t.cellSpacing!==null?t.cellSpacing+"px":""),t.cellSpacing!==null?e=d.setNodeStyle(e,"border-collapse","unset"):e=d.setNodeStyle(e,"border-collapse",t.collapseBorders?"collapse":"");const i=A[t.position||""]||{};Object.keys(i).forEach(c=>{e=d.setNodeStyle(e,c,i[c])}),e.id=t.id||null,e.class=t.className||null;const r=o.tr.setNodeMarkup(s,null,e);return o=o.apply(r),o},z=(o,t,s,l,e)=>{if(t.type.name!==l.name||Object.keys(e).length>0){const n=o.tr.setNodeMarkup(s,l,{...t.attrs,...e});return o.apply(n)}return o},B=(o,t)=>{/^cell-[0-9]+-[0-9]+$/.test(o.attrs.id||"")&&(t.id=null)},P=(o,t,s)=>{const l=o.doc.nodeAt(s),e=l&&w.TableMap.get(l);if(!l||!e)return o;const n=M(e);let i=o;const{table_header:r,table_cell:c}=o.schema.nodes,u=String(new Date().getTime()),p=[],y=(a,h)=>{const m=`cell-${a}${h}-${u}`;return p[a]||p.push([]),p[a][h]||p[a].push([]),p[a][h]=m,m},g=(a,h,m,f)=>{const S=[];if(f)for(let b=0;b<a;b++)p[b]&&p[b][h]&&S.push(p[b][h]);if(m)for(let b=0;b<h;b++)p[a]&&p[a][b]&&S.push(p[a][b]);return S.join(" ")};return n.forEach((a,h)=>{a.forEach((m,f)=>{const S=l.nodeAt(m);if(S){const b=f<t.headerColumns,T=h<t.headerRows,C={...S.attrs};B(S,C),C.headers=null,C.scope=null,T||b?(t.associateHeaders==="scope"&&(C.scope=T?"col":"row"),t.associateHeaders==="id"&&(C.id=y(h,f),(f>0||h>0)&&(C.headers=g(h,f,b,T)||null)),i=z(i,S,s+m+1,r,C)):(t.associateHeaders==="id"&&(C.headers=g(h,f,t.headerColumns>0,t.headerRows>0)||null),i=z(i,S,s+m+1,c,C))}})}),i},G=(o,t,s,l)=>{let e={...t.attrs};return e=d.setNodeStyle(e,"margin-left",""),e=d.setNodeStyle(e,"margin-right",""),Object.keys(l||{}).forEach(n=>{e=d.setNodeStyle(e,n,(l||{})[n]||"")}),o.apply(o.tr.setNodeMarkup(s,null,e))},D=(o,t)=>w.parseContent("<p>"+o+"</p>",t).content.firstChild.content,H=(o,t)=>{if(!o.caption)return;let s={caption:"",style:"display: table-caption"};o.captionAlignment&&(s=d.setNodeStyle(s,"text-align",o.captionAlignment)),o.captionPosition&&(s=d.setNodeStyle(s,"caption-side",o.captionPosition));const l=D(o.caption,t);return l&&t.nodes.table_caption_external.createAndFill(s,l)||void 0},U=o=>o.firstChild&&o.firstChild.type.name==="table_caption_external",J=(o,t,s,l)=>{let e=o,n;const i=s+2,r=s+1,c=e.schema;if(U(t))if(n=t.firstChild,l.caption){const u=D(l.caption,c);if(e=e.apply(e.tr.replaceWith(i,i+n.content.size,u)),n=e.doc.nodeAt(r),n){let p={...n.attrs};p=d.setNodeStyle(p,"text-align",l.captionAlignment||""),p=d.setNodeStyle(p,"caption-side",l.captionPosition||""),e=e.apply(e.tr.setNodeAttribute(r,"style",p.style))}}else e=e.apply(e.tr.deleteRange(i,i+n.content.size));else n=H(l,c),n&&(e=e.apply(e.tr.replaceWith(r,r,n)));return e},K=(o,t,s,l,e)=>{let n={state:o,pos:s};if(!l&&(t.position||t.caption)){let r={table:"",style:"display: table"};const c=[],u=t.position,p=u&&A[u];p&&Object.keys(p).forEach(h=>{r=d.setNodeStyle(r,h,p[h]||"")}),typeof t.width=="number"&&t.widthUnit==="%"&&(r=d.setNodeStyle(r,"width",t.width+t.widthUnit));const y=H(t,o.schema);y&&c.push(y);const g=o.doc.nodeAt(s);c.push(g);const a=o.schema.nodes.table_wrapper.createAndFill(r,c);if(a){const h=o.tr.replaceWith(s,s+g.content.size,a);o=o.apply(h),n={state:o,pos:s}}}else l&&(t.position||t.caption||!t.caption&&U(l.node))?(o=G(o,l.node,e,t.position&&A[t.position]),o=J(o,l.node,e,t),n={state:o,pos:e}):l&&!(t.position||t.caption)?n={state:o,node:l.node,pos:o.selection.$from.start(l.depth)-1}:n={state:o,pos:s};const i=l&&n.state.doc.nodeAt(e);if(i){let r;typeof t.width=="number"&&t.widthUnit==="%"?r=d.setNodeStyle(i.attrs,"width",t.width+t.widthUnit):t.widthUnit!=="%"&&/%/.test(d.parseStyle(i.attrs.style||"").width||"")&&(r=d.setNodeStyle(i.attrs,"width","")),r&&(n.state=n.state.apply(n.state.tr.setNodeMarkup(e,null,r)))}return n},L=(o,t)=>{const s=o.selection.$from,l=N.parentNode(s,f=>f.type.spec.tableRole==="table");if(!l)return;const e=s.start(l.depth)-1;let n=O(o,e,t.rows,t.columns);if(!n)return;const i=n.tr;d.tableCells(n).forEach(f=>{let S={...f.node.attrs};S=d.setNodeStyle(S,"padding",typeof t.cellPadding=="number"?t.cellPadding+"px":""),i.setNodeMarkup(f.pos,null,S)}),n=n.apply(i),n=q(n,t,e),n=P(n,t,e);const r=N.parentNode(s,f=>f.type.name==="table_wrapper"),c=s.start((r==null?void 0:r.depth)||0)-1,u=K(n,t,e,r,c);n=u.state;const p=u.pos,y=n.doc.nodeAt(u.pos);if(!y)return;const g=p+(r||l).node.content.size,a=o.tr.replaceWith(p,g,y),h=w.Selection.atEnd(y),m=w.TextSelection.create(a.doc,p+h.to+1);return a.setSelection(m),a};exports.applyTableData=L;exports.initialTableData=E;exports.tableDefaultData=F;exports.tablePositionStyles=A;
|