@clevertask/scribe 0.1.24 → 0.1.26
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 +48 -0
- package/dist/{BarMenu-DW95OBe1.js → BarMenu-BGWT4Oyk.js} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.js +2 -2
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts +2 -0
- package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +35 -33
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-_L8dTDsy.js → dist-BiognBi4.js} +3 -2
- package/dist/{dist-Cer8ra_P.js → dist-Dk0fXvrc.js} +1 -1
- package/dist/{dist-ClNucvAM.js → dist-xjmWZ-oh.js} +785 -785
- package/dist/{extension-B7i7CZ1Y.js → extension-BFPlsViw.js} +1 -1
- package/dist/{extension-link-BQrkQZHi.js → extension-link-DmM_EJTn.js} +1 -1
- package/dist/{html-to-markdown-CKpceHDk.js → html-to-markdown-BpR-7GtJ.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-zj2j0HLf.js → markdown-to-html-BoK5O_j-.js} +183 -143
- package/dist/{menus-BhM4ctz2.js → menus-BDXjZsFU.js} +2 -2
- package/dist/{purify.es-CpMrJENN.js → purify.es-q6CUdJQi.js} +251 -190
- package/dist/{resizable-table-DgMCiXeO.js → resizable-table-JZOaj_L3.js} +88 -78
- package/dist/{schema-extensions-ggKYCkRf.js → schema-extensions-BryyErmk.js} +6 -6
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +5 -4
- package/dist/table-transforms.d.ts +58 -0
- package/dist/table-transforms.d.ts.map +1 -0
- package/dist/table-transforms.js +166 -0
- package/dist/{tippy.esm-8vSV0zL7.js → tippy.esm-MjWnmeEn.js} +0 -3
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +11 -11
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { I as e, _ as t, a as n, l as r, m as i, n as a } from "./dist-
|
|
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, columnResizingPluginKey as p, deleteColumn as m, deleteRow as h, deleteTable as g, fixTables as _, goToNextCell as v, mergeCells as y, setCellAttr as
|
|
3
|
+
import { CellSelection as s, addColumnAfter as c, addColumnBefore as l, addRowAfter as u, addRowBefore as d, columnResizing as f, columnResizingPluginKey as p, deleteColumn as m, deleteRow as h, deleteTable as g, fixTables as _, goToNextCell as v, mergeCells as y, setCellAttr as ee, splitCell as b, tableEditing as x, toggleHeader as S, toggleHeaderCell as C } 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 w(e) {
|
|
6
6
|
return e === "left" || e === "right" || e === "center" ? e : null;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function T(e) {
|
|
9
9
|
let t = (e.style.textAlign || "").trim().toLowerCase(), n = (e.getAttribute("align") || "").trim().toLowerCase();
|
|
10
|
-
return
|
|
10
|
+
return w(t || n);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function E(e) {
|
|
13
|
+
return w(e?.align);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function D() {
|
|
16
16
|
return {
|
|
17
17
|
default: null,
|
|
18
|
-
parseHTML: (e) =>
|
|
18
|
+
parseHTML: (e) => T(e),
|
|
19
19
|
renderHTML: (e) => e.align ? { style: `text-align: ${e.align}` } : {}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function O(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 k(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)) : O(e);
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
return e.children.length > 0 ? !1 : (e.textContent ?? "").replace(
|
|
32
|
+
var A = /[ \t\r\n\f]+/g;
|
|
33
|
+
function j(e) {
|
|
34
|
+
return e.children.length > 0 ? !1 : (e.textContent ?? "").replace(A, "") === "";
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function M(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 N = n.create({
|
|
42
42
|
name: "tableCell",
|
|
43
43
|
addOptions() {
|
|
44
44
|
return { HTMLAttributes: {} };
|
|
@@ -50,9 +50,9 @@ var P = n.create({
|
|
|
50
50
|
rowspan: { default: 1 },
|
|
51
51
|
colwidth: {
|
|
52
52
|
default: null,
|
|
53
|
-
parseHTML:
|
|
53
|
+
parseHTML: k
|
|
54
54
|
},
|
|
55
|
-
align:
|
|
55
|
+
align: D()
|
|
56
56
|
};
|
|
57
57
|
},
|
|
58
58
|
tableRole: "cell",
|
|
@@ -60,8 +60,8 @@ var P = n.create({
|
|
|
60
60
|
parseHTML() {
|
|
61
61
|
return [{
|
|
62
62
|
tag: "td",
|
|
63
|
-
getAttrs: (e) =>
|
|
64
|
-
getContent: (e, t) =>
|
|
63
|
+
getAttrs: (e) => j(e) ? {} : !1,
|
|
64
|
+
getContent: (e, t) => M(t.nodes[this.name])
|
|
65
65
|
}, { tag: "td" }];
|
|
66
66
|
},
|
|
67
67
|
renderHTML({ HTMLAttributes: t }) {
|
|
@@ -71,7 +71,7 @@ var P = n.create({
|
|
|
71
71
|
0
|
|
72
72
|
];
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), P = n.create({
|
|
75
75
|
name: "tableHeader",
|
|
76
76
|
addOptions() {
|
|
77
77
|
return { HTMLAttributes: {} };
|
|
@@ -83,9 +83,9 @@ var P = n.create({
|
|
|
83
83
|
rowspan: { default: 1 },
|
|
84
84
|
colwidth: {
|
|
85
85
|
default: null,
|
|
86
|
-
parseHTML:
|
|
86
|
+
parseHTML: k
|
|
87
87
|
},
|
|
88
|
-
align:
|
|
88
|
+
align: D()
|
|
89
89
|
};
|
|
90
90
|
},
|
|
91
91
|
tableRole: "header_cell",
|
|
@@ -93,8 +93,8 @@ var P = n.create({
|
|
|
93
93
|
parseHTML() {
|
|
94
94
|
return [{
|
|
95
95
|
tag: "th",
|
|
96
|
-
getAttrs: (e) =>
|
|
97
|
-
getContent: (e, t) =>
|
|
96
|
+
getAttrs: (e) => j(e) ? {} : !1,
|
|
97
|
+
getContent: (e, t) => M(t.nodes[this.name])
|
|
98
98
|
}, { tag: "th" }];
|
|
99
99
|
},
|
|
100
100
|
renderHTML({ HTMLAttributes: t }) {
|
|
@@ -104,7 +104,7 @@ var P = n.create({
|
|
|
104
104
|
0
|
|
105
105
|
];
|
|
106
106
|
}
|
|
107
|
-
}),
|
|
107
|
+
}), F = n.create({
|
|
108
108
|
name: "tableRow",
|
|
109
109
|
addOptions() {
|
|
110
110
|
return { HTMLAttributes: {} };
|
|
@@ -122,10 +122,10 @@ var P = n.create({
|
|
|
122
122
|
];
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
-
function
|
|
125
|
+
function I(e, t) {
|
|
126
126
|
return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function L(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 R(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] = I(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] = I(r, l);
|
|
142
142
|
e.style.setProperty(n, i), t.appendChild(e);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -151,21 +151,21 @@ function R(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 R = 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")), L(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, L(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 z(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 B(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] = I(t, s);
|
|
177
177
|
o.push(["col", { style: `${l}: ${d}` }]);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -188,10 +188,10 @@ function B(e, t, n, r) {
|
|
|
188
188
|
tableMinWidth: l
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function B(e, t) {
|
|
192
192
|
return t ? e.createChecked(null, t) : e.createAndFill();
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function V(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 H(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 H(e, t, n, r, i) {
|
|
203
|
+
let a = V(e), o = [], s = [];
|
|
204
204
|
for (let e = 0; e < n; e += 1) {
|
|
205
|
-
let e =
|
|
205
|
+
let e = B(a.cell, i);
|
|
206
206
|
if (e && s.push(e), r) {
|
|
207
|
-
let e =
|
|
207
|
+
let e = B(a.header_cell, i);
|
|
208
208
|
e && o.push(e);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
@@ -212,19 +212,19 @@ function U(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 U(e) {
|
|
216
216
|
return e instanceof s;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
var W = ({ editor: e }) => {
|
|
219
219
|
let { selection: t } = e.state;
|
|
220
|
-
if (!
|
|
220
|
+
if (!U(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 G(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 K(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 K(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 q(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 q(e) {
|
|
268
|
+
return e.split("\n").map((e) => !e.includes("|") || !e.includes("`") ? e : K(e)).join("\n");
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function J(e) {
|
|
271
271
|
return (e || "").replace(/\s+/g, " ").trim();
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Y(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 X(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 = J(i.split(r).join("\n").replace(/[ \t]*\r?\n[ \t]*/g, "<br>")), o = e.type === "tableHeader", s = E(e.attrs);
|
|
283
283
|
n.push({
|
|
284
284
|
text: a,
|
|
285
285
|
isHeader: o,
|
|
@@ -308,7 +308,7 @@ function X(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 X = n.create({
|
|
312
312
|
name: "table",
|
|
313
313
|
addOptions() {
|
|
314
314
|
return {
|
|
@@ -317,7 +317,7 @@ var Z = n.create({
|
|
|
317
317
|
renderWrapper: !1,
|
|
318
318
|
handleWidth: 5,
|
|
319
319
|
cellMinWidth: 25,
|
|
320
|
-
View:
|
|
320
|
+
View: R,
|
|
321
321
|
lastColumnResizable: !0,
|
|
322
322
|
allowTableNodeSelection: !1
|
|
323
323
|
};
|
|
@@ -330,7 +330,7 @@ var Z = 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 } = z(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 Z = n.create({
|
|
|
351
351
|
if (e.header) {
|
|
352
352
|
let i = [];
|
|
353
353
|
e.header.forEach((e, n) => {
|
|
354
|
-
let a =
|
|
354
|
+
let a = w(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 Z = 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 = w(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 Z = 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) => Y(e, t),
|
|
373
373
|
markdownTokenizer: {
|
|
374
374
|
name: "table",
|
|
375
375
|
level: "block",
|
|
@@ -384,7 +384,7 @@ var Z = 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 = q(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 Z = 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 = H(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)));
|
|
@@ -410,7 +410,7 @@ var Z = n.create({
|
|
|
410
410
|
deleteColumn: () => ({ state: e, dispatch: t }) => {
|
|
411
411
|
let n = i(e.selection.$from, (e) => e.type.name === "table");
|
|
412
412
|
return m(e, t && ((e) => {
|
|
413
|
-
n &&
|
|
413
|
+
n && G(e, n.pos), t(e);
|
|
414
414
|
}));
|
|
415
415
|
},
|
|
416
416
|
addRowBefore: () => ({ state: e, dispatch: t }) => d(e, t),
|
|
@@ -418,17 +418,17 @@ var Z = n.create({
|
|
|
418
418
|
deleteRow: () => ({ state: e, dispatch: t }) => {
|
|
419
419
|
let n = i(e.selection.$from, (e) => e.type.name === "table");
|
|
420
420
|
return h(e, t && ((e) => {
|
|
421
|
-
n &&
|
|
421
|
+
n && G(e, n.pos), t(e);
|
|
422
422
|
}));
|
|
423
423
|
},
|
|
424
424
|
deleteTable: () => ({ state: e, dispatch: t }) => g(e, t),
|
|
425
425
|
mergeCells: () => ({ state: e, dispatch: t }) => y(e, 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 }) => y(e, t) ? !0 :
|
|
431
|
-
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) =>
|
|
426
|
+
splitCell: () => ({ state: e, dispatch: t }) => b(e, t),
|
|
427
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => S("column")(e, t),
|
|
428
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => S("row")(e, t),
|
|
429
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => C(e, t),
|
|
430
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => y(e, t) ? !0 : b(e, t),
|
|
431
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => ee(e, t)(n, r),
|
|
432
432
|
goToNextCell: () => ({ state: e, dispatch: t }) => v(1)(e, t),
|
|
433
433
|
goToPreviousCell: () => ({ state: e, dispatch: t }) => v(-1)(e, t),
|
|
434
434
|
fixTables: () => ({ state: e, dispatch: t }) => (t && _(e), !0),
|
|
@@ -445,10 +445,10 @@ var Z = 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: W,
|
|
449
|
+
"Mod-Backspace": W,
|
|
450
|
+
Delete: W,
|
|
451
|
+
"Mod-Delete": W
|
|
452
452
|
};
|
|
453
453
|
},
|
|
454
454
|
addProseMirrorPlugins() {
|
|
@@ -458,7 +458,7 @@ var Z = n.create({
|
|
|
458
458
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
459
459
|
View: this.options.View,
|
|
460
460
|
lastColumnResizable: this.options.lastColumnResizable
|
|
461
|
-
})] : [],
|
|
461
|
+
})] : [], x({ allowTableNodeSelection: this.options.allowTableNodeSelection })];
|
|
462
462
|
},
|
|
463
463
|
addNodeView() {
|
|
464
464
|
let t = this.options.resizable && this.editor.isEditable, n = this.options.View;
|
|
@@ -475,13 +475,23 @@ var Z = n.create({
|
|
|
475
475
|
};
|
|
476
476
|
return { tableRole: r(t(e, "tableRole", n)) };
|
|
477
477
|
}
|
|
478
|
-
}),
|
|
478
|
+
}), Z = 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(X.configure(this.options.table)), this.options.tableCell !== !1 && e.push(N.configure(this.options.tableCell)), this.options.tableHeader !== !1 && e.push(P.configure(this.options.tableHeader)), this.options.tableRow !== !1 && e.push(F.configure(this.options.tableRow)), e;
|
|
483
483
|
}
|
|
484
|
-
}),
|
|
484
|
+
}), Q = (e) => {
|
|
485
|
+
for (let t = e.depth; t > 0; --t) if (e.node(t).type.spec.tableRole === "table") return !0;
|
|
486
|
+
return !1;
|
|
487
|
+
}, $ = (e) => Q(e.$from) || Q(e.$to), te = X.extend({
|
|
488
|
+
addCommands() {
|
|
489
|
+
let e = this.parent?.();
|
|
490
|
+
return {
|
|
491
|
+
...e,
|
|
492
|
+
insertTable: (t = {}) => (n) => $(n.state.selection) ? !1 : e?.insertTable?.(t)(n) ?? !1
|
|
493
|
+
};
|
|
494
|
+
},
|
|
485
495
|
onUpdate() {
|
|
486
496
|
if (this.editor.isEditable) return;
|
|
487
497
|
let e = p.getState(this.editor.state);
|
|
@@ -494,11 +504,11 @@ var Z = n.create({
|
|
|
494
504
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
495
505
|
View: this.options.View,
|
|
496
506
|
lastColumnResizable: this.options.lastColumnResizable
|
|
497
|
-
}),
|
|
507
|
+
}), x({ allowTableNodeSelection: this.options.allowTableNodeSelection })];
|
|
498
508
|
},
|
|
499
509
|
addNodeView() {
|
|
500
510
|
return null;
|
|
501
511
|
}
|
|
502
512
|
}).configure({ resizable: !0 });
|
|
503
513
|
//#endregion
|
|
504
|
-
export {
|
|
514
|
+
export { $ as n, Z as r, te as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, D as r, F as i, H as a, I as o, L as s, M as c, O as l, P as u, R as d, S as f, U as p, V as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, i as S, j as C, k as ee, l as te, n as w, p as ne, r as re, s as ie, u as ae, w as oe, x as se } from "./dist-
|
|
2
|
-
import { t as ce } from "./dist-
|
|
3
|
-
import {
|
|
4
|
-
import { n as de, t as fe } from "./extension-link-
|
|
1
|
+
import { A as e, B as t, C as n, D as r, F as i, H as a, I as o, L as s, M as c, O as l, P as u, R as d, S as f, U as p, V as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, i as S, j as C, k as ee, l as te, n as w, p as ne, r as re, s as ie, u as ae, w as oe, x as se } from "./dist-xjmWZ-oh.js";
|
|
2
|
+
import { t as ce } from "./dist-Dk0fXvrc.js";
|
|
3
|
+
import { r as le, t as ue } from "./resizable-table-JZOaj_L3.js";
|
|
4
|
+
import { n as de, t as fe } from "./extension-link-DmM_EJTn.js";
|
|
5
5
|
import { Callout as pe } from "./components/Scribe/extension/callout.js";
|
|
6
6
|
import { ExternalLinkPreviewSchema as me } from "./components/Scribe/extension/external-link-preview/schema.js";
|
|
7
7
|
import { NodeSelection as he, Plugin as ge, PluginKey as _e, Selection as ve, TextSelection as ye } from "@tiptap/pm/state";
|
|
@@ -49099,7 +49099,7 @@ function ja(e, t, n) {
|
|
|
49099
49099
|
}
|
|
49100
49100
|
e.consume();
|
|
49101
49101
|
} else if (C === "\\end") {
|
|
49102
|
-
b(), m.length === 1 && S.type === "styling" && S.body.length === 1 && S.body[0].type === "ordgroup" && S.body[0].body.length === 0 && (h.length > 1 || !u) && !Array.isArray(v?.[v.length - 1]) && h.pop(), _.length < h.length + 1 && _.push([]);
|
|
49102
|
+
b(), m.length === 1 && S.type === "styling" && S.body.length === 1 && S.body[0].type === "ordgroup" && S.body[0].body.length === 0 && (h.length > 1 || !u) && !Array.isArray(v?.[v.length - 1]) && !(c && v?.[v.length - 1] === !0) && h.pop(), _.length < h.length + 1 && _.push([]);
|
|
49103
49103
|
break;
|
|
49104
49104
|
} else if (C === "\\\\") {
|
|
49105
49105
|
e.consume();
|
|
@@ -52801,7 +52801,7 @@ var Ko = function(e, t) {
|
|
|
52801
52801
|
return Jo(t, e, n);
|
|
52802
52802
|
}
|
|
52803
52803
|
}, Xo = {
|
|
52804
|
-
version: "0.18.
|
|
52804
|
+
version: "0.18.9",
|
|
52805
52805
|
render: Go,
|
|
52806
52806
|
renderToString: Ko,
|
|
52807
52807
|
ParseError: T,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./schema-extensions-
|
|
1
|
+
import { t as e } from "./schema-extensions-BryyErmk.js";
|
|
2
2
|
export { e as createScribeSchemaExtensionSet };
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Extensions } from "@tiptap/core";
|
|
2
|
+
export * from "./table-transforms.js";
|
|
2
3
|
export { createScribeDocumentNodeCapabilityManifest, defineScribeDocumentNodeCapability, SCRIBE_DOCUMENT_NODE_CAPABILITY_ROLES, SCRIBE_DOCUMENT_NODE_CONTENT_KINDS, } from "./document-node-capabilities.js";
|
|
3
4
|
export type { ScribeDocumentNodeAttributeShape, ScribeDocumentNodeCapability, ScribeDocumentNodeCapabilityManifest, ScribeDocumentNodeCapabilityRole, ScribeDocumentNodeContentKind, ScribeDocumentNodePotentialOperation, } from "./document-node-capabilities.js";
|
|
4
5
|
export type ScribeSchemaExtensionOptions = {
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EACL,0CAA0C,EAC1C,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,GACnC,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,gCAAgC,EAChC,4BAA4B,EAC5B,oCAAoC,EACpC,gCAAgC,EAChC,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,iCAAiC,CAAC;AAEzC,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,aAC9B,4BAA4B,KACpC,UAAoE,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EACL,0CAA0C,EAC1C,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,GACnC,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,gCAAgC,EAChC,4BAA4B,EAC5B,oCAAoC,EACpC,gCAAgC,EAChC,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,iCAAiC,CAAC;AAEzC,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,aAC9B,4BAA4B,KACpC,UAAoE,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ScribeTableTransformError as e, applyScribeTableTransform as t } from "./table-transforms.js";
|
|
2
|
+
import { t as n } from "./schema-extensions-BryyErmk.js";
|
|
3
|
+
import { SCRIBE_DOCUMENT_NODE_CAPABILITY_ROLES as r, SCRIBE_DOCUMENT_NODE_CONTENT_KINDS as i, createScribeDocumentNodeCapabilityManifest as a, defineScribeDocumentNodeCapability as o } from "./document-node-capabilities.js";
|
|
3
4
|
//#region lib/schema.ts
|
|
4
|
-
var
|
|
5
|
+
var s = (e = {}) => Object.values(n(e));
|
|
5
6
|
//#endregion
|
|
6
|
-
export {
|
|
7
|
+
export { r as SCRIBE_DOCUMENT_NODE_CAPABILITY_ROLES, i as SCRIBE_DOCUMENT_NODE_CONTENT_KINDS, e as ScribeTableTransformError, t as applyScribeTableTransform, a as createScribeDocumentNodeCapabilityManifest, s as createScribeSchemaExtensions, o as defineScribeDocumentNodeCapability };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
2
|
+
export type ScribeTableTransformErrorCode = "invalid_input" | "invalid_target" | "unsupported_structure" | "operation_not_applicable" | "invalid_result";
|
|
3
|
+
export declare class ScribeTableTransformError extends Error {
|
|
4
|
+
readonly code: ScribeTableTransformErrorCode;
|
|
5
|
+
readonly cause?: unknown;
|
|
6
|
+
constructor(code: ScribeTableTransformErrorCode, message: string, cause?: unknown);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A half-open logical table rectangle. The top and left coordinates are
|
|
10
|
+
* included; the bottom and right coordinates are excluded.
|
|
11
|
+
*/
|
|
12
|
+
export type ScribeTableMergeRectangle = Readonly<{
|
|
13
|
+
topRow: number;
|
|
14
|
+
leftColumn: number;
|
|
15
|
+
bottomRowExclusive: number;
|
|
16
|
+
rightColumnExclusive: number;
|
|
17
|
+
}>;
|
|
18
|
+
export type ScribeTableTransformOperation = Readonly<{
|
|
19
|
+
type: "insert_row";
|
|
20
|
+
index: number;
|
|
21
|
+
}> | Readonly<{
|
|
22
|
+
type: "delete_row";
|
|
23
|
+
index: number;
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
type: "insert_column";
|
|
26
|
+
index: number;
|
|
27
|
+
}> | Readonly<{
|
|
28
|
+
type: "delete_column";
|
|
29
|
+
index: number;
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
type: "merge_cells";
|
|
32
|
+
rectangle: ScribeTableMergeRectangle;
|
|
33
|
+
}> | Readonly<{
|
|
34
|
+
type: "split_cell";
|
|
35
|
+
row: number;
|
|
36
|
+
column: number;
|
|
37
|
+
}>;
|
|
38
|
+
export type ScribeTableGeometry = Readonly<{
|
|
39
|
+
rows: number;
|
|
40
|
+
columns: number;
|
|
41
|
+
physicalCells: number;
|
|
42
|
+
}>;
|
|
43
|
+
export type ScribeTableTransformResult = Readonly<{
|
|
44
|
+
document: ProseMirrorNode;
|
|
45
|
+
tablePosition: number;
|
|
46
|
+
before: ScribeTableGeometry;
|
|
47
|
+
after: ScribeTableGeometry;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Applies one bounded table transform to a ProseMirror document without an
|
|
51
|
+
* EditorView or browser DOM. `tablePosition` is the position immediately
|
|
52
|
+
* before the target table node.
|
|
53
|
+
*
|
|
54
|
+
* Application authorization, revision checks, destructive previews, and
|
|
55
|
+
* collaborative persistence remain outside this kernel.
|
|
56
|
+
*/
|
|
57
|
+
export declare const applyScribeTableTransform: (document: ProseMirrorNode, tablePosition: number, operation: ScribeTableTransformOperation) => ScribeTableTransformResult;
|
|
58
|
+
//# sourceMappingURL=table-transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-transforms.d.ts","sourceRoot":"","sources":["../lib/table-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAehE,MAAM,MAAM,6BAA6B,GACrC,eAAe,GACf,gBAAgB,GAChB,uBAAuB,GACvB,0BAA0B,GAC1B,gBAAgB,CAAC;AAErB,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,EAAE,6BAA6B,CAAC;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEzB,YAAY,IAAI,EAAE,6BAA6B,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAKhF;CACF;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GACrC,QAAQ,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC/C,QAAQ,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAC/C,QAAQ,CAAC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAClD,QAAQ,CAAC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAClD,QAAQ,CAAC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,SAAS,EAAE,yBAAyB,CAAA;CAAE,CAAC,GACvE,QAAQ,CAAC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,QAAQ,EAAE,eAAe,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC,CAAC;AA4ZH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,aAC1B,eAAe,iBACV,MAAM,aACV,6BAA6B,KACvC,0BA4EF,CAAC"}
|