@clevertask/scribe 0.1.26 → 0.1.28
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/README.md +9 -1
- package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +174 -134
- package/dist/components/Menu/TableHeightSettings.d.ts +11 -0
- package/dist/components/Menu/TableHeightSettings.d.ts.map +1 -0
- package/dist/components/Menu/TableHeightSettings.js +156 -0
- package/dist/components/Menu/TableLayoutOptions.d.ts +24 -0
- package/dist/components/Menu/TableLayoutOptions.d.ts.map +1 -0
- package/dist/components/Menu/TableLayoutOptions.js +126 -0
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts +13 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +165 -2
- package/dist/components/Scribe/extension/slashCommand/items.js +1 -1
- package/dist/components/Scribe/extension/table-layout.d.ts +31 -0
- package/dist/components/Scribe/extension/table-layout.d.ts.map +1 -0
- package/dist/components/Scribe/extension/table-layout.js +2 -0
- package/dist/components/Scribe/extension/table-sticky-header.d.ts +7 -0
- package/dist/components/Scribe/extension/table-sticky-header.d.ts.map +1 -0
- package/dist/components/Scribe/extension/table-sticky-header.js +106 -0
- package/dist/components/Scribe/index.js +2 -2
- package/dist/document-node-capabilities.d.ts.map +1 -1
- package/dist/document-node-capabilities.js +80 -68
- package/dist/{extension-BFPlsViw.js → extension-BU2USLV1.js} +1 -1
- package/dist/{html-to-markdown-BpR-7GtJ.js → html-to-markdown-DF93it73.js} +1 -1
- package/dist/main.css +47 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/{schema-extensions-BryyErmk.js → schema-extensions-DyCk1Goa.js} +10 -9
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{resizable-table-JZOaj_L3.js → table-layout-BoDS50DR.js} +140 -110
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { I as e, _ as t, a as n, l as r, m as i, n as a } from "./dist-xjmWZ-oh.js";
|
|
2
2
|
import { TextSelection as o } from "@tiptap/pm/state";
|
|
3
|
-
import { CellSelection as s, addColumnAfter as c, addColumnBefore as l, addRowAfter as u, addRowBefore as d, columnResizing as f,
|
|
3
|
+
import { CellSelection as s, addColumnAfter as c, addColumnBefore as l, addRowAfter as u, addRowBefore as d, columnResizing as f, deleteColumn as ee, deleteRow as p, deleteTable as m, fixTables as te, goToNextCell as h, mergeCells as g, setCellAttr as _, splitCell as v, tableEditing as y, toggleHeader as b, toggleHeaderCell as x } from "@tiptap/pm/tables";
|
|
4
4
|
//#region node_modules/.pnpm/@tiptap+extension-table@3.31.3_@tiptap+core@3.31.3_@tiptap+pm@3.31.3__@tiptap+pm@3.31.3/node_modules/@tiptap/extension-table/dist/index.js
|
|
5
|
-
function
|
|
5
|
+
function S(e) {
|
|
6
6
|
return e === "left" || e === "right" || e === "center" ? e : null;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function ne(e) {
|
|
9
9
|
let t = (e.style.textAlign || "").trim().toLowerCase(), n = (e.getAttribute("align") || "").trim().toLowerCase();
|
|
10
|
-
return
|
|
10
|
+
return S(t || n);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function C(e) {
|
|
13
|
+
return S(e?.align);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function w() {
|
|
16
16
|
return {
|
|
17
17
|
default: null,
|
|
18
|
-
parseHTML: (e) =>
|
|
18
|
+
parseHTML: (e) => ne(e),
|
|
19
19
|
renderHTML: (e) => e.align ? { style: `text-align: ${e.align}` } : {}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function T(e) {
|
|
23
23
|
let t = e.parentElement, n = e.closest("table");
|
|
24
24
|
if (!t || !n) return null;
|
|
25
25
|
let r = Array.from(t.children).indexOf(e), i = n.querySelectorAll("colgroup > col")[r]?.getAttribute("width");
|
|
26
26
|
return i ? [parseInt(i, 10)] : null;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function E(e) {
|
|
29
29
|
let t = e.getAttribute("colwidth");
|
|
30
|
-
return t ? t.split(",").map((e) => parseInt(e, 10)) :
|
|
30
|
+
return t ? t.split(",").map((e) => parseInt(e, 10)) : T(e);
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
return e.children.length > 0 ? !1 : (e.textContent ?? "").replace(
|
|
32
|
+
var D = /[ \t\r\n\f]+/g;
|
|
33
|
+
function O(e) {
|
|
34
|
+
return e.children.length > 0 ? !1 : (e.textContent ?? "").replace(D, "") === "";
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function k(e) {
|
|
37
37
|
let t = e.createAndFill();
|
|
38
38
|
if (!t) throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);
|
|
39
39
|
return t.content;
|
|
40
40
|
}
|
|
41
|
-
var
|
|
41
|
+
var re = n.create({
|
|
42
42
|
name: "tableCell",
|
|
43
43
|
addOptions() {
|
|
44
44
|
return { HTMLAttributes: {} };
|
|
@@ -50,9 +50,9 @@ var N = n.create({
|
|
|
50
50
|
rowspan: { default: 1 },
|
|
51
51
|
colwidth: {
|
|
52
52
|
default: null,
|
|
53
|
-
parseHTML:
|
|
53
|
+
parseHTML: E
|
|
54
54
|
},
|
|
55
|
-
align:
|
|
55
|
+
align: w()
|
|
56
56
|
};
|
|
57
57
|
},
|
|
58
58
|
tableRole: "cell",
|
|
@@ -60,8 +60,8 @@ var N = n.create({
|
|
|
60
60
|
parseHTML() {
|
|
61
61
|
return [{
|
|
62
62
|
tag: "td",
|
|
63
|
-
getAttrs: (e) =>
|
|
64
|
-
getContent: (e, t) =>
|
|
63
|
+
getAttrs: (e) => O(e) ? {} : !1,
|
|
64
|
+
getContent: (e, t) => k(t.nodes[this.name])
|
|
65
65
|
}, { tag: "td" }];
|
|
66
66
|
},
|
|
67
67
|
renderHTML({ HTMLAttributes: t }) {
|
|
@@ -71,7 +71,7 @@ var N = n.create({
|
|
|
71
71
|
0
|
|
72
72
|
];
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), ie = n.create({
|
|
75
75
|
name: "tableHeader",
|
|
76
76
|
addOptions() {
|
|
77
77
|
return { HTMLAttributes: {} };
|
|
@@ -83,9 +83,9 @@ var N = n.create({
|
|
|
83
83
|
rowspan: { default: 1 },
|
|
84
84
|
colwidth: {
|
|
85
85
|
default: null,
|
|
86
|
-
parseHTML:
|
|
86
|
+
parseHTML: E
|
|
87
87
|
},
|
|
88
|
-
align:
|
|
88
|
+
align: w()
|
|
89
89
|
};
|
|
90
90
|
},
|
|
91
91
|
tableRole: "header_cell",
|
|
@@ -93,8 +93,8 @@ var N = n.create({
|
|
|
93
93
|
parseHTML() {
|
|
94
94
|
return [{
|
|
95
95
|
tag: "th",
|
|
96
|
-
getAttrs: (e) =>
|
|
97
|
-
getContent: (e, t) =>
|
|
96
|
+
getAttrs: (e) => O(e) ? {} : !1,
|
|
97
|
+
getContent: (e, t) => k(t.nodes[this.name])
|
|
98
98
|
}, { tag: "th" }];
|
|
99
99
|
},
|
|
100
100
|
renderHTML({ HTMLAttributes: t }) {
|
|
@@ -104,7 +104,7 @@ var N = n.create({
|
|
|
104
104
|
0
|
|
105
105
|
];
|
|
106
106
|
}
|
|
107
|
-
}),
|
|
107
|
+
}), A = n.create({
|
|
108
108
|
name: "tableRow",
|
|
109
109
|
addOptions() {
|
|
110
110
|
return { HTMLAttributes: {} };
|
|
@@ -122,10 +122,10 @@ var N = n.create({
|
|
|
122
122
|
];
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
-
function
|
|
125
|
+
function j(e, t) {
|
|
126
126
|
return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function M(e, t, n, r, i, a) {
|
|
129
129
|
let o = 0, s = !0, c = t.firstChild, l = e.firstChild;
|
|
130
130
|
if (l !== null) for (let e = 0, n = 0; e < l.childCount; e += 1) {
|
|
131
131
|
let { colspan: u, colwidth: d } = l.child(e).attrs;
|
|
@@ -133,12 +133,12 @@ function L(e, t, n, r, i, a) {
|
|
|
133
133
|
let l = i === n ? a : d && d[e], u = l ? `${l}px` : "";
|
|
134
134
|
if (o += l || r, l || (s = !1), c) {
|
|
135
135
|
if (c.style.width !== u) {
|
|
136
|
-
let [e, t] =
|
|
136
|
+
let [e, t] = j(r, l);
|
|
137
137
|
c.style.setProperty(e, t);
|
|
138
138
|
}
|
|
139
139
|
c = c.nextSibling;
|
|
140
140
|
} else {
|
|
141
|
-
let e = document.createElement("col"), [n, i] =
|
|
141
|
+
let e = document.createElement("col"), [n, i] = j(r, l);
|
|
142
142
|
e.style.setProperty(n, i), t.appendChild(e);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -151,21 +151,21 @@ function L(e, t, n, r, i, a) {
|
|
|
151
151
|
let d = e.attrs.style && typeof e.attrs.style == "string" && /\bwidth\s*:/i.test(e.attrs.style);
|
|
152
152
|
s && !d ? (n.style.width = `${o}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${o}px`);
|
|
153
153
|
}
|
|
154
|
-
var
|
|
154
|
+
var N = class {
|
|
155
155
|
constructor(e, t, n, r = {}) {
|
|
156
156
|
this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table"));
|
|
157
157
|
for (let [e, t] of Object.entries(r)) t != null && (e === "style" ? this.table.style.cssText = String(t) : this.table.setAttribute(e, String(t)));
|
|
158
|
-
e.attrs.style && (this.table.style.cssText = e.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
158
|
+
e.attrs.style && (this.table.style.cssText = e.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), M(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
159
159
|
}
|
|
160
160
|
update(e) {
|
|
161
|
-
return e.type === this.node.type && (this.node = e,
|
|
161
|
+
return e.type === this.node.type && (this.node = e, M(e, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
162
162
|
}
|
|
163
163
|
ignoreMutation(e) {
|
|
164
164
|
let t = e.target, n = this.dom.contains(t), r = this.contentDOM.contains(t);
|
|
165
165
|
return !(!n || r || e.type !== "attributes" && e.type !== "childList" && e.type !== "characterData");
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
-
function
|
|
168
|
+
function P(e, t, n, r) {
|
|
169
169
|
let i = 0, a = !0, o = [], s = e.firstChild;
|
|
170
170
|
if (!s) return {};
|
|
171
171
|
for (let e = 0, c = 0; e < s.childCount; e += 1) {
|
|
@@ -173,7 +173,7 @@ function z(e, t, n, r) {
|
|
|
173
173
|
for (let e = 0; e < l; e += 1, c += 1) {
|
|
174
174
|
let s = n === c ? r : u && u[e];
|
|
175
175
|
i += s || t, s || (a = !1);
|
|
176
|
-
let [l, d] =
|
|
176
|
+
let [l, d] = j(t, s);
|
|
177
177
|
o.push(["col", { style: `${l}: ${d}` }]);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -188,10 +188,10 @@ function z(e, t, n, r) {
|
|
|
188
188
|
tableMinWidth: l
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function F(e, t) {
|
|
192
192
|
return t ? e.createChecked(null, t) : e.createAndFill();
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function I(e) {
|
|
195
195
|
if (e.cached.tableNodeTypes) return e.cached.tableNodeTypes;
|
|
196
196
|
let t = {};
|
|
197
197
|
return Object.keys(e.nodes).forEach((n) => {
|
|
@@ -199,12 +199,12 @@ function V(e) {
|
|
|
199
199
|
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
200
200
|
}), e.cached.tableNodeTypes = t, t;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
let a =
|
|
202
|
+
function L(e, t, n, r, i) {
|
|
203
|
+
let a = I(e), o = [], s = [];
|
|
204
204
|
for (let e = 0; e < n; e += 1) {
|
|
205
|
-
let e =
|
|
205
|
+
let e = F(a.cell, i);
|
|
206
206
|
if (e && s.push(e), r) {
|
|
207
|
-
let e =
|
|
207
|
+
let e = F(a.header_cell, i);
|
|
208
208
|
e && o.push(e);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -212,19 +212,19 @@ function H(e, t, n, r, i) {
|
|
|
212
212
|
for (let e = 0; e < t; e += 1) c.push(a.row.createChecked(null, r && e === 0 ? o : s));
|
|
213
213
|
return a.table.createChecked(null, c);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function R(e) {
|
|
216
216
|
return e instanceof s;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
var z = ({ editor: e }) => {
|
|
219
219
|
let { selection: t } = e.state;
|
|
220
|
-
if (!
|
|
220
|
+
if (!R(t)) return !1;
|
|
221
221
|
let n = 0;
|
|
222
222
|
return i(t.ranges[0].$from, (e) => e.type.name === "table")?.node.descendants((e) => {
|
|
223
223
|
if (e.type.name === "table") return !1;
|
|
224
224
|
["tableCell", "tableHeader"].includes(e.type.name) && (n += 1);
|
|
225
225
|
}), n === t.ranges.length && (e.commands.deleteTable(), !0);
|
|
226
226
|
};
|
|
227
|
-
function
|
|
227
|
+
function B(e, t) {
|
|
228
228
|
let n = e.mapping.map(t);
|
|
229
229
|
if (i(e.selection.$from, (e) => e.type.name === "table")?.pos === n) return;
|
|
230
230
|
let r = e.doc.nodeAt(n);
|
|
@@ -232,7 +232,7 @@ function G(e, t) {
|
|
|
232
232
|
let a = n + r.nodeSize - 1;
|
|
233
233
|
e.setSelection(o.near(e.doc.resolve(a), -1));
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function V(e) {
|
|
236
236
|
let t = "", n = 0;
|
|
237
237
|
for (; n < e.length;) {
|
|
238
238
|
if (e[n] === "\\" && n + 1 < e.length) {
|
|
@@ -264,13 +264,13 @@ function K(e) {
|
|
|
264
264
|
}
|
|
265
265
|
return t;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
return e.split("\n").map((e) => !e.includes("|") || !e.includes("`") ? e :
|
|
267
|
+
function H(e) {
|
|
268
|
+
return e.split("\n").map((e) => !e.includes("|") || !e.includes("`") ? e : V(e)).join("\n");
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function U(e) {
|
|
271
271
|
return (e || "").replace(/\s+/g, " ").trim();
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function W(e, t, n = {}) {
|
|
274
274
|
let r = n.cellLineSeparator ?? "";
|
|
275
275
|
if (!e || !e.content || e.content.length === 0) return "";
|
|
276
276
|
let i = [];
|
|
@@ -279,7 +279,7 @@ function Y(e, t, n = {}) {
|
|
|
279
279
|
e.content && e.content.forEach((e) => {
|
|
280
280
|
let i = "";
|
|
281
281
|
i = e.content && Array.isArray(e.content) && e.content.length > 1 ? e.content.map((e) => t.renderChildren(e)).join(r) : e.content ? t.renderChildren(e.content) : "";
|
|
282
|
-
let a =
|
|
282
|
+
let a = U(i.split(r).join("\n").replace(/[ \t]*\r?\n[ \t]*/g, "<br>")), o = e.type === "tableHeader", s = C(e.attrs);
|
|
283
283
|
n.push({
|
|
284
284
|
text: a,
|
|
285
285
|
isHeader: o,
|
|
@@ -308,7 +308,7 @@ function Y(e, t, n = {}) {
|
|
|
308
308
|
d += `| ${Array.from({ length: a }).fill(0).map((t, n) => s(e[n] && e[n].text || "", o[n])).join(" | ")} |\n`;
|
|
309
309
|
}), d;
|
|
310
310
|
}
|
|
311
|
-
var
|
|
311
|
+
var G = n.create({
|
|
312
312
|
name: "table",
|
|
313
313
|
addOptions() {
|
|
314
314
|
return {
|
|
@@ -317,7 +317,7 @@ var X = n.create({
|
|
|
317
317
|
renderWrapper: !1,
|
|
318
318
|
handleWidth: 5,
|
|
319
319
|
cellMinWidth: 25,
|
|
320
|
-
View:
|
|
320
|
+
View: N,
|
|
321
321
|
lastColumnResizable: !0,
|
|
322
322
|
allowTableNodeSelection: !1
|
|
323
323
|
};
|
|
@@ -330,7 +330,7 @@ var X = n.create({
|
|
|
330
330
|
return [{ tag: "table" }];
|
|
331
331
|
},
|
|
332
332
|
renderHTML({ node: t, HTMLAttributes: n }) {
|
|
333
|
-
let { colgroup: r, tableWidth: i, tableMinWidth: a } =
|
|
333
|
+
let { colgroup: r, tableWidth: i, tableMinWidth: a } = P(t, this.options.cellMinWidth), o = n.style;
|
|
334
334
|
function s() {
|
|
335
335
|
return o || (i ? `width: ${i}` : `min-width: ${a}`);
|
|
336
336
|
}
|
|
@@ -351,7 +351,7 @@ var X = n.create({
|
|
|
351
351
|
if (e.header) {
|
|
352
352
|
let i = [];
|
|
353
353
|
e.header.forEach((e, n) => {
|
|
354
|
-
let a =
|
|
354
|
+
let a = S(r[n] ?? e.align), o = a ? { align: a } : {};
|
|
355
355
|
i.push(t.createNode("tableHeader", o, [{
|
|
356
356
|
type: "paragraph",
|
|
357
357
|
content: t.parseInline(e.tokens)
|
|
@@ -361,7 +361,7 @@ var X = n.create({
|
|
|
361
361
|
return e.rows && e.rows.forEach((e) => {
|
|
362
362
|
let i = [];
|
|
363
363
|
e.forEach((e, n) => {
|
|
364
|
-
let a =
|
|
364
|
+
let a = S(r[n] ?? e.align), o = a ? { align: a } : {};
|
|
365
365
|
i.push(t.createNode("tableCell", o, [{
|
|
366
366
|
type: "paragraph",
|
|
367
367
|
content: t.parseInline(e.tokens)
|
|
@@ -369,7 +369,7 @@ var X = n.create({
|
|
|
369
369
|
}), n.push(t.createNode("tableRow", {}, i));
|
|
370
370
|
}), t.createNode("table", void 0, n);
|
|
371
371
|
},
|
|
372
|
-
renderMarkdown: (e, t) =>
|
|
372
|
+
renderMarkdown: (e, t) => W(e, t),
|
|
373
373
|
markdownTokenizer: {
|
|
374
374
|
name: "table",
|
|
375
375
|
level: "block",
|
|
@@ -384,7 +384,7 @@ var X = n.create({
|
|
|
384
384
|
if (a.length < 2) return;
|
|
385
385
|
let o = a[1];
|
|
386
386
|
if (!/^[ \t|:]*-[ \t|:-]*$/.test(o) || !o.includes("|")) return;
|
|
387
|
-
let s =
|
|
387
|
+
let s = H(i);
|
|
388
388
|
if (s === i) return;
|
|
389
389
|
let c = n.blockTokens(s)[0];
|
|
390
390
|
if (c?.type !== "table" || !c.raw) return;
|
|
@@ -398,7 +398,7 @@ var X = n.create({
|
|
|
398
398
|
addCommands() {
|
|
399
399
|
return {
|
|
400
400
|
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
401
|
-
let s =
|
|
401
|
+
let s = L(a.schema, e, t, n);
|
|
402
402
|
if (i) {
|
|
403
403
|
let e = r.selection.from + 1;
|
|
404
404
|
r.replaceSelectionWith(s).scrollIntoView().setSelection(o.near(r.doc.resolve(e)));
|
|
@@ -409,29 +409,29 @@ var X = n.create({
|
|
|
409
409
|
addColumnAfter: () => ({ state: e, dispatch: t }) => c(e, t),
|
|
410
410
|
deleteColumn: () => ({ state: e, dispatch: t }) => {
|
|
411
411
|
let n = i(e.selection.$from, (e) => e.type.name === "table");
|
|
412
|
-
return
|
|
413
|
-
n &&
|
|
412
|
+
return ee(e, t && ((e) => {
|
|
413
|
+
n && B(e, n.pos), t(e);
|
|
414
414
|
}));
|
|
415
415
|
},
|
|
416
416
|
addRowBefore: () => ({ state: e, dispatch: t }) => d(e, t),
|
|
417
417
|
addRowAfter: () => ({ state: e, dispatch: t }) => u(e, t),
|
|
418
418
|
deleteRow: () => ({ state: e, dispatch: t }) => {
|
|
419
419
|
let n = i(e.selection.$from, (e) => e.type.name === "table");
|
|
420
|
-
return
|
|
421
|
-
n &&
|
|
420
|
+
return p(e, t && ((e) => {
|
|
421
|
+
n && B(e, n.pos), t(e);
|
|
422
422
|
}));
|
|
423
423
|
},
|
|
424
|
-
deleteTable: () => ({ state: e, dispatch: t }) =>
|
|
425
|
-
mergeCells: () => ({ state: e, dispatch: t }) =>
|
|
426
|
-
splitCell: () => ({ state: e, dispatch: t }) =>
|
|
427
|
-
toggleHeaderColumn: () => ({ state: e, dispatch: t }) =>
|
|
428
|
-
toggleHeaderRow: () => ({ state: e, dispatch: t }) =>
|
|
429
|
-
toggleHeaderCell: () => ({ state: e, dispatch: t }) =>
|
|
430
|
-
mergeOrSplit: () => ({ state: e, dispatch: t }) =>
|
|
431
|
-
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) =>
|
|
432
|
-
goToNextCell: () => ({ state: e, dispatch: t }) =>
|
|
433
|
-
goToPreviousCell: () => ({ state: e, dispatch: t }) =>
|
|
434
|
-
fixTables: () => ({ state: e, dispatch: t }) => (t &&
|
|
424
|
+
deleteTable: () => ({ state: e, dispatch: t }) => m(e, t),
|
|
425
|
+
mergeCells: () => ({ state: e, dispatch: t }) => g(e, t),
|
|
426
|
+
splitCell: () => ({ state: e, dispatch: t }) => v(e, t),
|
|
427
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => b("column")(e, t),
|
|
428
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => b("row")(e, t),
|
|
429
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => x(e, t),
|
|
430
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => g(e, t) ? !0 : v(e, t),
|
|
431
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => _(e, t)(n, r),
|
|
432
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => h(1)(e, t),
|
|
433
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => h(-1)(e, t),
|
|
434
|
+
fixTables: () => ({ state: e, dispatch: t }) => (t && te(e), !0),
|
|
435
435
|
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
436
436
|
if (n) {
|
|
437
437
|
let n = s.create(t.doc, e.anchorCell, e.headCell);
|
|
@@ -445,10 +445,10 @@ var X = n.create({
|
|
|
445
445
|
return {
|
|
446
446
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
447
447
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
448
|
-
Backspace:
|
|
449
|
-
"Mod-Backspace":
|
|
450
|
-
Delete:
|
|
451
|
-
"Mod-Delete":
|
|
448
|
+
Backspace: z,
|
|
449
|
+
"Mod-Backspace": z,
|
|
450
|
+
Delete: z,
|
|
451
|
+
"Mod-Delete": z
|
|
452
452
|
};
|
|
453
453
|
},
|
|
454
454
|
addProseMirrorPlugins() {
|
|
@@ -458,7 +458,7 @@ var X = n.create({
|
|
|
458
458
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
459
459
|
View: this.options.View,
|
|
460
460
|
lastColumnResizable: this.options.lastColumnResizable
|
|
461
|
-
})] : [],
|
|
461
|
+
})] : [], y({ allowTableNodeSelection: this.options.allowTableNodeSelection })];
|
|
462
462
|
},
|
|
463
463
|
addNodeView() {
|
|
464
464
|
let t = this.options.resizable && this.editor.isEditable, n = this.options.View;
|
|
@@ -475,40 +475,70 @@ var X = n.create({
|
|
|
475
475
|
};
|
|
476
476
|
return { tableRole: r(t(e, "tableRole", n)) };
|
|
477
477
|
}
|
|
478
|
-
}),
|
|
478
|
+
}), K = a.create({
|
|
479
479
|
name: "tableKit",
|
|
480
480
|
addExtensions() {
|
|
481
481
|
let e = [];
|
|
482
|
-
return this.options.table !== !1 && e.push(
|
|
482
|
+
return this.options.table !== !1 && e.push(G.configure(this.options.table)), this.options.tableCell !== !1 && e.push(re.configure(this.options.tableCell)), this.options.tableHeader !== !1 && e.push(ie.configure(this.options.tableHeader)), this.options.tableRow !== !1 && e.push(A.configure(this.options.tableRow)), e;
|
|
483
483
|
}
|
|
484
|
-
}),
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
484
|
+
}), q = [
|
|
485
|
+
"auto",
|
|
486
|
+
"fit",
|
|
487
|
+
"scroll"
|
|
488
|
+
], J = 128, ae = 120, oe = 2e3, se = 360, Y = (e) => {
|
|
489
|
+
let t = typeof e == "string" && /^\d+$/.test(e) ? Number(e) : e;
|
|
490
|
+
return typeof t == "number" && Number.isInteger(t) && t >= 120 && t <= 2e3 ? t : null;
|
|
491
|
+
}, X = (e) => e === "fit" || e === "scroll" ? e : "auto", Z = (e) => {
|
|
492
|
+
let t = e.firstChild;
|
|
493
|
+
if (!t || t.childCount === 0) return !1;
|
|
494
|
+
let n = !0;
|
|
495
|
+
return t.forEach((e) => {
|
|
496
|
+
e.type.spec.tableRole !== "header_cell" && (n = !1);
|
|
497
|
+
}), n;
|
|
498
|
+
}, Q = (e) => e.attrs.stickyHeaderRow === !0 && Z(e), $ = (e) => {
|
|
499
|
+
let t = Y(e.attrs.maxHeight);
|
|
500
|
+
return {
|
|
501
|
+
"data-table-layout": X(e.attrs.tableLayout),
|
|
502
|
+
"data-table-limit-height": e.attrs.limitHeight === !0 ? "true" : "false",
|
|
503
|
+
"data-table-sticky-header-row": e.attrs.stickyHeaderRow === !0 ? "true" : "false",
|
|
504
|
+
"data-table-sticky-header-active": Q(e) ? "true" : "false",
|
|
505
|
+
...t === null ? {} : { "data-table-max-height": String(t) }
|
|
506
|
+
};
|
|
507
|
+
}, ce = (e, t) => {
|
|
508
|
+
let n = 0, r = [];
|
|
509
|
+
return e.firstChild?.forEach((e) => {
|
|
510
|
+
for (let i = 0; i < e.attrs.colspan; i++) {
|
|
511
|
+
let a = e.attrs.colwidth?.[i], o = a ? Math.max(a, t) : 128;
|
|
512
|
+
n += o, r.push(["col", { style: `${a ? "width" : "min-width"}: ${o}px` }]);
|
|
513
|
+
}
|
|
514
|
+
}), {
|
|
515
|
+
width: n,
|
|
516
|
+
colgroup: [
|
|
517
|
+
"colgroup",
|
|
518
|
+
{},
|
|
519
|
+
...r
|
|
520
|
+
]
|
|
521
|
+
};
|
|
522
|
+
}, le = class extends N {
|
|
523
|
+
constructor(e, t, n) {
|
|
524
|
+
super(e, t, n), this.applyLayout();
|
|
511
525
|
}
|
|
512
|
-
|
|
526
|
+
update(e) {
|
|
527
|
+
return super.update(e) ? (this.applyLayout(), !0) : !1;
|
|
528
|
+
}
|
|
529
|
+
applyLayout() {
|
|
530
|
+
let e = X(this.node.attrs.tableLayout), t = Y(this.node.attrs.maxHeight);
|
|
531
|
+
t === null ? (this.dom.removeAttribute("data-table-max-height"), this.table.removeAttribute("data-table-max-height"), this.dom.style.removeProperty("--scribe-table-custom-max-height")) : this.dom.style.setProperty("--scribe-table-custom-max-height", `${t}px`);
|
|
532
|
+
for (let [e, t] of Object.entries($(this.node))) this.dom.setAttribute(e, t), this.table.setAttribute(e, t);
|
|
533
|
+
(!Q(this.node) || this.node.attrs.limitHeight === !0) && this.dom.style.removeProperty("--scribe-table-sticky-header-top");
|
|
534
|
+
let n = 0, r = 0;
|
|
535
|
+
this.node.firstChild?.forEach((t) => {
|
|
536
|
+
for (let i = 0; i < t.attrs.colspan; i++, n++) {
|
|
537
|
+
let a = t.attrs.colwidth?.[i], o = e === "scroll" ? 128 : this.cellMinWidth, s = this.colgroup.children[n];
|
|
538
|
+
s && (s.style.width = a ? `${Math.max(a, this.cellMinWidth)}px` : "", s.style.minWidth = a ? "" : `${o}px`, r += a ? Math.max(a, this.cellMinWidth) : o);
|
|
539
|
+
}
|
|
540
|
+
}), e === "scroll" && (this.table.style.width = `${r}px`, this.table.style.minWidth = `${r}px`);
|
|
541
|
+
}
|
|
542
|
+
};
|
|
513
543
|
//#endregion
|
|
514
|
-
export { $ as n,
|
|
544
|
+
export { J as a, Y as c, Q as d, $ as f, q as i, ce as l, K as m, oe as n, le as o, G as p, ae as r, X as s, se as t, Z as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-to-markdown.d.ts","sourceRoot":"","sources":["../../lib/utils/html-to-markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html-to-markdown.d.ts","sourceRoot":"","sources":["../../lib/utils/html-to-markdown.ts"],"names":[],"mappings":"AA4XA,eAAO,MAAM,OAAO,SAAU,MAAM,WA6CnC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../html-to-markdown-
|
|
1
|
+
import { t as e } from "../html-to-markdown-DF93it73.js";
|
|
2
2
|
export { e as html2md };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "../dist-xjmWZ-oh.js";
|
|
2
|
-
import { t } from "../html-to-markdown-
|
|
2
|
+
import { t } from "../html-to-markdown-DF93it73.js";
|
|
3
3
|
import { t as n } from "../markdown-to-html-BoK5O_j-.js";
|
|
4
4
|
import { isInViewport as r } from "./is-in-viewport.js";
|
|
5
5
|
import { convertLegacyMathDelimiters as i } from "./convert-legacy-math-delimiters.js";
|
|
6
|
-
import { t as a } from "../extension-
|
|
6
|
+
import { t as a } from "../extension-BU2USLV1.js";
|
|
7
7
|
//#region lib/utils/create-scribe-editor.ts
|
|
8
8
|
function o({ content: n = "", editable: r = !1, enableUndoRedo: i, externalLinkPreview: o, onContentChange: s }) {
|
|
9
9
|
return new e({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clevertask/scribe",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Radix-based Tiptap rich text editor with a Notion-style block interface for viewing and creating content. Perfect for diverse needs like notes, documents, AI chat, Markdown parsing, and comments.",
|
|
6
6
|
"keywords": [
|