@clevertask/scribe 0.1.10 → 0.1.11
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 +11 -1
- package/dist/{BarMenu-5S2vKAtc.js → BarMenu-5M9g9Y1j.js} +7 -5
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.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.d.ts +8 -0
- package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -0
- package/dist/components/Menu/TableBubbleMenu.js +305 -0
- package/dist/components/Menu/tableBubbleMenuPlugin.d.ts +11 -0
- package/dist/components/Menu/tableBubbleMenuPlugin.d.ts.map +1 -0
- package/dist/components/Menu/tableBubbleMenuPlugin.js +22 -0
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- 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/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts +8 -0
- package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -0
- package/dist/components/Scribe/extension/resizable-table.js +2 -0
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +1390 -1390
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +27 -0
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +2 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +133 -128
- package/dist/{dist-DErUltkU.js → dist-DFua_Xbu.js} +37 -31
- package/dist/{dist-wYqYXEOz.js → dist-Dw4STOPE.js} +1 -1
- package/dist/{extension-6I5t1ZxQ.js → extension-Dy6hHSvD.js} +1324 -1783
- package/dist/{extension-link-DJy7XDoj.js → extension-link-CjfUZ90W.js} +1 -1
- package/dist/{html-to-markdown-Cta7-ssO.js → html-to-markdown-B6Uhn7ok.js} +112 -54
- package/dist/main.css +52 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-DwSNqq2i.js → markdown-to-html-WmeDaJXP.js} +73 -60
- package/dist/{menus-m_EkiaUN.js → menus-_EXlLMjz.js} +2 -2
- package/dist/{purify.es-CFiLaBu1.js → purify.es-BES4pJF7.js} +267 -260
- package/dist/resizable-table-Ddw3l6DJ.js +489 -0
- package/dist/{slashCommand-DuSH9sXJ.js → slashCommand-CxX07Nbk.js} +24 -22
- 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 +4 -4
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { N as e, a as t, c as n, g as r, n as i, p as a } from "./dist-DFua_Xbu.js";
|
|
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 b, splitCell as x, tableEditing as S, toggleHeader as C, toggleHeaderCell as w } from "@tiptap/pm/tables";
|
|
4
|
+
//#region node_modules/.pnpm/@tiptap+extension-table@3.29.2_@tiptap+core@3.29.2_@tiptap+pm@3.29.2__@tiptap+pm@3.29.2/node_modules/@tiptap/extension-table/dist/index.js
|
|
5
|
+
function T(e) {
|
|
6
|
+
return e === "left" || e === "right" || e === "center" ? e : null;
|
|
7
|
+
}
|
|
8
|
+
function E(e) {
|
|
9
|
+
let t = (e.style.textAlign || "").trim().toLowerCase(), n = (e.getAttribute("align") || "").trim().toLowerCase();
|
|
10
|
+
return T(t || n);
|
|
11
|
+
}
|
|
12
|
+
function D(e) {
|
|
13
|
+
return T(e?.align);
|
|
14
|
+
}
|
|
15
|
+
function O() {
|
|
16
|
+
return {
|
|
17
|
+
default: null,
|
|
18
|
+
parseHTML: (e) => E(e),
|
|
19
|
+
renderHTML: (e) => e.align ? { style: `text-align: ${e.align}` } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function k(e) {
|
|
23
|
+
let t = e.parentElement, n = e.closest("table");
|
|
24
|
+
if (!t || !n) return null;
|
|
25
|
+
let r = Array.from(t.children).indexOf(e), i = n.querySelectorAll("colgroup > col")[r]?.getAttribute("width");
|
|
26
|
+
return i ? [parseInt(i, 10)] : null;
|
|
27
|
+
}
|
|
28
|
+
function A(e) {
|
|
29
|
+
let t = e.getAttribute("colwidth");
|
|
30
|
+
return t ? t.split(",").map((e) => parseInt(e, 10)) : k(e);
|
|
31
|
+
}
|
|
32
|
+
var j = /[ \t\r\n\f]+/g;
|
|
33
|
+
function M(e) {
|
|
34
|
+
return e.children.length > 0 ? !1 : (e.textContent ?? "").replace(j, "") === "";
|
|
35
|
+
}
|
|
36
|
+
function N(e) {
|
|
37
|
+
let t = e.createAndFill();
|
|
38
|
+
if (!t) throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);
|
|
39
|
+
return t.content;
|
|
40
|
+
}
|
|
41
|
+
var P = t.create({
|
|
42
|
+
name: "tableCell",
|
|
43
|
+
addOptions() {
|
|
44
|
+
return { HTMLAttributes: {} };
|
|
45
|
+
},
|
|
46
|
+
content: "block+",
|
|
47
|
+
addAttributes() {
|
|
48
|
+
return {
|
|
49
|
+
colspan: { default: 1 },
|
|
50
|
+
rowspan: { default: 1 },
|
|
51
|
+
colwidth: {
|
|
52
|
+
default: null,
|
|
53
|
+
parseHTML: A
|
|
54
|
+
},
|
|
55
|
+
align: O()
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
tableRole: "cell",
|
|
59
|
+
isolating: !0,
|
|
60
|
+
parseHTML() {
|
|
61
|
+
return [{
|
|
62
|
+
tag: "td",
|
|
63
|
+
getAttrs: (e) => M(e) ? {} : !1,
|
|
64
|
+
getContent: (e, t) => N(t.nodes[this.name])
|
|
65
|
+
}, { tag: "td" }];
|
|
66
|
+
},
|
|
67
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
68
|
+
return [
|
|
69
|
+
"td",
|
|
70
|
+
e(this.options.HTMLAttributes, t),
|
|
71
|
+
0
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}), F = t.create({
|
|
75
|
+
name: "tableHeader",
|
|
76
|
+
addOptions() {
|
|
77
|
+
return { HTMLAttributes: {} };
|
|
78
|
+
},
|
|
79
|
+
content: "block+",
|
|
80
|
+
addAttributes() {
|
|
81
|
+
return {
|
|
82
|
+
colspan: { default: 1 },
|
|
83
|
+
rowspan: { default: 1 },
|
|
84
|
+
colwidth: {
|
|
85
|
+
default: null,
|
|
86
|
+
parseHTML: A
|
|
87
|
+
},
|
|
88
|
+
align: O()
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
tableRole: "header_cell",
|
|
92
|
+
isolating: !0,
|
|
93
|
+
parseHTML() {
|
|
94
|
+
return [{
|
|
95
|
+
tag: "th",
|
|
96
|
+
getAttrs: (e) => M(e) ? {} : !1,
|
|
97
|
+
getContent: (e, t) => N(t.nodes[this.name])
|
|
98
|
+
}, { tag: "th" }];
|
|
99
|
+
},
|
|
100
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
101
|
+
return [
|
|
102
|
+
"th",
|
|
103
|
+
e(this.options.HTMLAttributes, t),
|
|
104
|
+
0
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
}), I = t.create({
|
|
108
|
+
name: "tableRow",
|
|
109
|
+
addOptions() {
|
|
110
|
+
return { HTMLAttributes: {} };
|
|
111
|
+
},
|
|
112
|
+
content: "(tableCell | tableHeader)*",
|
|
113
|
+
tableRole: "row",
|
|
114
|
+
parseHTML() {
|
|
115
|
+
return [{ tag: "tr" }];
|
|
116
|
+
},
|
|
117
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
118
|
+
return [
|
|
119
|
+
"tr",
|
|
120
|
+
e(this.options.HTMLAttributes, t),
|
|
121
|
+
0
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
function L(e, t) {
|
|
126
|
+
return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
|
|
127
|
+
}
|
|
128
|
+
function R(e, t, n, r, i, a) {
|
|
129
|
+
var o;
|
|
130
|
+
let s = 0, c = !0, l = t.firstChild, u = e.firstChild;
|
|
131
|
+
if (u !== null) for (let e = 0, n = 0; e < u.childCount; e += 1) {
|
|
132
|
+
let { colspan: o, colwidth: d } = u.child(e).attrs;
|
|
133
|
+
for (let e = 0; e < o; e += 1, n += 1) {
|
|
134
|
+
let o = i === n ? a : d && d[e], u = o ? `${o}px` : "";
|
|
135
|
+
if (s += o || r, o || (c = !1), l) {
|
|
136
|
+
if (l.style.width !== u) {
|
|
137
|
+
let [e, t] = L(r, o);
|
|
138
|
+
l.style.setProperty(e, t);
|
|
139
|
+
}
|
|
140
|
+
l = l.nextSibling;
|
|
141
|
+
} else {
|
|
142
|
+
let e = document.createElement("col"), [n, i] = L(r, o);
|
|
143
|
+
e.style.setProperty(n, i), t.appendChild(e);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
for (; l;) {
|
|
148
|
+
let e = l.nextSibling;
|
|
149
|
+
(o = l.parentNode) == null || o.removeChild(l), l = e;
|
|
150
|
+
}
|
|
151
|
+
let d = e.attrs.style && typeof e.attrs.style == "string" && /\bwidth\s*:/i.test(e.attrs.style);
|
|
152
|
+
c && !d ? (n.style.width = `${s}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${s}px`);
|
|
153
|
+
}
|
|
154
|
+
var z = class {
|
|
155
|
+
constructor(e, t, n, r = {}) {
|
|
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
|
+
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")), R(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
159
|
+
}
|
|
160
|
+
update(e) {
|
|
161
|
+
return e.type === this.node.type && (this.node = e, R(e, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
162
|
+
}
|
|
163
|
+
ignoreMutation(e) {
|
|
164
|
+
let t = e.target, n = this.dom.contains(t), r = this.contentDOM.contains(t);
|
|
165
|
+
return !!(n && !r && (e.type === "attributes" || e.type === "childList" || e.type === "characterData"));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
function B(e, t, n, r) {
|
|
169
|
+
let i = 0, a = !0, o = [], s = e.firstChild;
|
|
170
|
+
if (!s) return {};
|
|
171
|
+
for (let e = 0, c = 0; e < s.childCount; e += 1) {
|
|
172
|
+
let { colspan: l, colwidth: u } = s.child(e).attrs;
|
|
173
|
+
for (let e = 0; e < l; e += 1, c += 1) {
|
|
174
|
+
let s = n === c ? r : u && u[e];
|
|
175
|
+
i += s || t, s || (a = !1);
|
|
176
|
+
let [l, d] = L(t, s);
|
|
177
|
+
o.push(["col", { style: `${l}: ${d}` }]);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
let c = a ? `${i}px` : "", l = a ? "" : `${i}px`;
|
|
181
|
+
return {
|
|
182
|
+
colgroup: [
|
|
183
|
+
"colgroup",
|
|
184
|
+
{},
|
|
185
|
+
...o
|
|
186
|
+
],
|
|
187
|
+
tableWidth: c,
|
|
188
|
+
tableMinWidth: l
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function V(e, t) {
|
|
192
|
+
return t ? e.createChecked(null, t) : e.createAndFill();
|
|
193
|
+
}
|
|
194
|
+
function H(e) {
|
|
195
|
+
if (e.cached.tableNodeTypes) return e.cached.tableNodeTypes;
|
|
196
|
+
let t = {};
|
|
197
|
+
return Object.keys(e.nodes).forEach((n) => {
|
|
198
|
+
let r = e.nodes[n];
|
|
199
|
+
r.spec.tableRole && (t[r.spec.tableRole] = r);
|
|
200
|
+
}), e.cached.tableNodeTypes = t, t;
|
|
201
|
+
}
|
|
202
|
+
function U(e, t, n, r, i) {
|
|
203
|
+
let a = H(e), o = [], s = [];
|
|
204
|
+
for (let e = 0; e < n; e += 1) {
|
|
205
|
+
let e = V(a.cell, i);
|
|
206
|
+
if (e && s.push(e), r) {
|
|
207
|
+
let e = V(a.header_cell, i);
|
|
208
|
+
e && o.push(e);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
let c = [];
|
|
212
|
+
for (let e = 0; e < t; e += 1) c.push(a.row.createChecked(null, r && e === 0 ? o : s));
|
|
213
|
+
return a.table.createChecked(null, c);
|
|
214
|
+
}
|
|
215
|
+
function W(e) {
|
|
216
|
+
return e instanceof s;
|
|
217
|
+
}
|
|
218
|
+
var G = ({ editor: e }) => {
|
|
219
|
+
let { selection: t } = e.state;
|
|
220
|
+
if (!W(t)) return !1;
|
|
221
|
+
let n = 0;
|
|
222
|
+
return a(t.ranges[0].$from, (e) => e.type.name === "table")?.node.descendants((e) => {
|
|
223
|
+
if (e.type.name === "table") return !1;
|
|
224
|
+
["tableCell", "tableHeader"].includes(e.type.name) && (n += 1);
|
|
225
|
+
}), n === t.ranges.length && (e.commands.deleteTable(), !0);
|
|
226
|
+
};
|
|
227
|
+
function K(e) {
|
|
228
|
+
let t = "", n = 0;
|
|
229
|
+
for (; n < e.length;) {
|
|
230
|
+
if (e[n] === "\\" && n + 1 < e.length) {
|
|
231
|
+
t += e[n] + e[n + 1], n += 2;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (e[n] !== "`") {
|
|
235
|
+
t += e[n++];
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
let r = 0;
|
|
239
|
+
for (; n + r < e.length && e[n + r] === "`";) r += 1;
|
|
240
|
+
let i = n + r, a = !1;
|
|
241
|
+
for (; i < e.length;) {
|
|
242
|
+
if (e[i] !== "`") {
|
|
243
|
+
i += 1;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
let o = 0;
|
|
247
|
+
for (; i + o < e.length && e[i + o] === "`";) o += 1;
|
|
248
|
+
if (o === r) {
|
|
249
|
+
let o = e.slice(n + r, i);
|
|
250
|
+
t += e.slice(n, n + r) + o.replace(/(?<!\\)\|/g, "\\|") + e.slice(i, i + r), n = i + r, a = !0;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
i += o;
|
|
254
|
+
}
|
|
255
|
+
a || (t += e.slice(n, n + r), n += r);
|
|
256
|
+
}
|
|
257
|
+
return t;
|
|
258
|
+
}
|
|
259
|
+
function q(e) {
|
|
260
|
+
return e.split("\n").map((e) => !e.includes("|") || !e.includes("`") ? e : K(e)).join("\n");
|
|
261
|
+
}
|
|
262
|
+
function J(e) {
|
|
263
|
+
return (e || "").replace(/\s+/g, " ").trim();
|
|
264
|
+
}
|
|
265
|
+
function Y(e, t, n = {}) {
|
|
266
|
+
let r = n.cellLineSeparator ?? "";
|
|
267
|
+
if (!e || !e.content || e.content.length === 0) return "";
|
|
268
|
+
let i = [];
|
|
269
|
+
e.content.forEach((e) => {
|
|
270
|
+
let n = [];
|
|
271
|
+
e.content && e.content.forEach((e) => {
|
|
272
|
+
let i = "";
|
|
273
|
+
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) : "";
|
|
274
|
+
let a = J(i.split(r).join("\n").replace(/[ \t]*\r?\n[ \t]*/g, "<br>")), o = e.type === "tableHeader", s = D(e.attrs);
|
|
275
|
+
n.push({
|
|
276
|
+
text: a,
|
|
277
|
+
isHeader: o,
|
|
278
|
+
align: s
|
|
279
|
+
});
|
|
280
|
+
}), i.push(n);
|
|
281
|
+
});
|
|
282
|
+
let a = i.reduce((e, t) => Math.max(e, t.length), 0);
|
|
283
|
+
if (a === 0) return "";
|
|
284
|
+
let o = Array.from({ length: a }).fill(0);
|
|
285
|
+
i.forEach((e) => {
|
|
286
|
+
for (let t = 0; t < a; t += 1) {
|
|
287
|
+
let n = (e[t]?.text || "").length;
|
|
288
|
+
n > o[t] && (o[t] = n), o[t] < 3 && (o[t] = 3);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
let s = (e, t) => e + " ".repeat(Math.max(0, t - e.length)), c = i[0], l = c.some((e) => e.isHeader), u = Array.from({ length: a }).fill(null);
|
|
292
|
+
i.forEach((e) => {
|
|
293
|
+
for (let t = 0; t < a; t += 1) !u[t] && e[t]?.align && (u[t] = e[t].align);
|
|
294
|
+
});
|
|
295
|
+
let d = "\n", f = Array.from({ length: a }).map((e, t) => l && c[t] && c[t].text || "");
|
|
296
|
+
return d += `| ${f.map((e, t) => s(e, o[t])).join(" | ")} |
|
|
297
|
+
`, d += `| ${o.map((e, t) => {
|
|
298
|
+
let n = Math.max(3, e), r = u[t];
|
|
299
|
+
return r === "left" ? `:${"-".repeat(n)}` : r === "right" ? `${"-".repeat(n)}:` : r === "center" ? `:${"-".repeat(n)}:` : "-".repeat(n);
|
|
300
|
+
}).join(" | ")} |
|
|
301
|
+
`, (l ? i.slice(1) : i).forEach((e) => {
|
|
302
|
+
d += `| ${Array.from({ length: a }).fill(0).map((t, n) => s(e[n] && e[n].text || "", o[n])).join(" | ")} |
|
|
303
|
+
`;
|
|
304
|
+
}), d;
|
|
305
|
+
}
|
|
306
|
+
var X = Y, Z = t.create({
|
|
307
|
+
name: "table",
|
|
308
|
+
addOptions() {
|
|
309
|
+
return {
|
|
310
|
+
HTMLAttributes: {},
|
|
311
|
+
resizable: !1,
|
|
312
|
+
renderWrapper: !1,
|
|
313
|
+
handleWidth: 5,
|
|
314
|
+
cellMinWidth: 25,
|
|
315
|
+
View: z,
|
|
316
|
+
lastColumnResizable: !0,
|
|
317
|
+
allowTableNodeSelection: !1
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
content: "tableRow+",
|
|
321
|
+
tableRole: "table",
|
|
322
|
+
isolating: !0,
|
|
323
|
+
group: "block",
|
|
324
|
+
parseHTML() {
|
|
325
|
+
return [{ tag: "table" }];
|
|
326
|
+
},
|
|
327
|
+
renderHTML({ node: t, HTMLAttributes: n }) {
|
|
328
|
+
let { colgroup: r, tableWidth: i, tableMinWidth: a } = B(t, this.options.cellMinWidth), o = n.style;
|
|
329
|
+
function s() {
|
|
330
|
+
return o || (i ? `width: ${i}` : `min-width: ${a}`);
|
|
331
|
+
}
|
|
332
|
+
let c = [
|
|
333
|
+
"table",
|
|
334
|
+
e(this.options.HTMLAttributes, n, { style: s() }),
|
|
335
|
+
r,
|
|
336
|
+
["tbody", 0]
|
|
337
|
+
];
|
|
338
|
+
return this.options.renderWrapper ? [
|
|
339
|
+
"div",
|
|
340
|
+
{ class: "tableWrapper" },
|
|
341
|
+
c
|
|
342
|
+
] : c;
|
|
343
|
+
},
|
|
344
|
+
parseMarkdown: (e, t) => {
|
|
345
|
+
let n = [], r = Array.isArray(e.align) ? e.align : [];
|
|
346
|
+
if (e.header) {
|
|
347
|
+
let i = [];
|
|
348
|
+
e.header.forEach((e, n) => {
|
|
349
|
+
let a = T(r[n] ?? e.align), o = a ? { align: a } : {};
|
|
350
|
+
i.push(t.createNode("tableHeader", o, [{
|
|
351
|
+
type: "paragraph",
|
|
352
|
+
content: t.parseInline(e.tokens)
|
|
353
|
+
}]));
|
|
354
|
+
}), n.push(t.createNode("tableRow", {}, i));
|
|
355
|
+
}
|
|
356
|
+
return e.rows && e.rows.forEach((e) => {
|
|
357
|
+
let i = [];
|
|
358
|
+
e.forEach((e, n) => {
|
|
359
|
+
let a = T(r[n] ?? e.align), o = a ? { align: a } : {};
|
|
360
|
+
i.push(t.createNode("tableCell", o, [{
|
|
361
|
+
type: "paragraph",
|
|
362
|
+
content: t.parseInline(e.tokens)
|
|
363
|
+
}]));
|
|
364
|
+
}), n.push(t.createNode("tableRow", {}, i));
|
|
365
|
+
}), t.createNode("table", void 0, n);
|
|
366
|
+
},
|
|
367
|
+
renderMarkdown: (e, t) => X(e, t),
|
|
368
|
+
markdownTokenizer: {
|
|
369
|
+
name: "table",
|
|
370
|
+
level: "block",
|
|
371
|
+
start: (e) => {
|
|
372
|
+
let t = e.split("\n");
|
|
373
|
+
if (t.length < 2) return -1;
|
|
374
|
+
let n = t[1];
|
|
375
|
+
return !/^[ \t|:]*-[ \t|:-]*$/.test(n) || !n.includes("|") ? -1 : t[0].includes("|") ? 0 : -1;
|
|
376
|
+
},
|
|
377
|
+
tokenize(e, t, n) {
|
|
378
|
+
let r = e.indexOf("\n\n"), i = r >= 0 ? e.slice(0, r) : e, a = i.split("\n");
|
|
379
|
+
if (a.length < 2) return;
|
|
380
|
+
let o = a[1];
|
|
381
|
+
if (!/^[ \t|:]*-[ \t|:-]*$/.test(o) || !o.includes("|")) return;
|
|
382
|
+
let s = q(i);
|
|
383
|
+
if (s === i) return;
|
|
384
|
+
let c = n.blockTokens(s)[0];
|
|
385
|
+
if (c?.type !== "table" || !c.raw) return;
|
|
386
|
+
let l = c.raw.split("\n").length, u = e.split("\n").slice(0, l).join("\n");
|
|
387
|
+
return {
|
|
388
|
+
...c,
|
|
389
|
+
raw: u
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
addCommands() {
|
|
394
|
+
return {
|
|
395
|
+
insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
396
|
+
let s = U(a.schema, e, t, n);
|
|
397
|
+
if (i) {
|
|
398
|
+
let e = r.selection.from + 1;
|
|
399
|
+
r.replaceSelectionWith(s).scrollIntoView().setSelection(o.near(r.doc.resolve(e)));
|
|
400
|
+
}
|
|
401
|
+
return !0;
|
|
402
|
+
},
|
|
403
|
+
addColumnBefore: () => ({ state: e, dispatch: t }) => l(e, t),
|
|
404
|
+
addColumnAfter: () => ({ state: e, dispatch: t }) => c(e, t),
|
|
405
|
+
deleteColumn: () => ({ state: e, dispatch: t }) => m(e, t),
|
|
406
|
+
addRowBefore: () => ({ state: e, dispatch: t }) => d(e, t),
|
|
407
|
+
addRowAfter: () => ({ state: e, dispatch: t }) => u(e, t),
|
|
408
|
+
deleteRow: () => ({ state: e, dispatch: t }) => h(e, t),
|
|
409
|
+
deleteTable: () => ({ state: e, dispatch: t }) => g(e, t),
|
|
410
|
+
mergeCells: () => ({ state: e, dispatch: t }) => y(e, t),
|
|
411
|
+
splitCell: () => ({ state: e, dispatch: t }) => x(e, t),
|
|
412
|
+
toggleHeaderColumn: () => ({ state: e, dispatch: t }) => C("column")(e, t),
|
|
413
|
+
toggleHeaderRow: () => ({ state: e, dispatch: t }) => C("row")(e, t),
|
|
414
|
+
toggleHeaderCell: () => ({ state: e, dispatch: t }) => w(e, t),
|
|
415
|
+
mergeOrSplit: () => ({ state: e, dispatch: t }) => y(e, t) ? !0 : x(e, t),
|
|
416
|
+
setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => b(e, t)(n, r),
|
|
417
|
+
goToNextCell: () => ({ state: e, dispatch: t }) => v(1)(e, t),
|
|
418
|
+
goToPreviousCell: () => ({ state: e, dispatch: t }) => v(-1)(e, t),
|
|
419
|
+
fixTables: () => ({ state: e, dispatch: t }) => (t && _(e), !0),
|
|
420
|
+
setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
421
|
+
if (n) {
|
|
422
|
+
let n = s.create(t.doc, e.anchorCell, e.headCell);
|
|
423
|
+
t.setSelection(n);
|
|
424
|
+
}
|
|
425
|
+
return !0;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
},
|
|
429
|
+
addKeyboardShortcuts() {
|
|
430
|
+
return {
|
|
431
|
+
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
432
|
+
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
433
|
+
Backspace: G,
|
|
434
|
+
"Mod-Backspace": G,
|
|
435
|
+
Delete: G,
|
|
436
|
+
"Mod-Delete": G
|
|
437
|
+
};
|
|
438
|
+
},
|
|
439
|
+
addProseMirrorPlugins() {
|
|
440
|
+
return [...this.options.resizable && this.editor.isEditable ? [f({
|
|
441
|
+
handleWidth: this.options.handleWidth,
|
|
442
|
+
cellMinWidth: this.options.cellMinWidth,
|
|
443
|
+
defaultCellMinWidth: this.options.cellMinWidth,
|
|
444
|
+
View: this.options.View,
|
|
445
|
+
lastColumnResizable: this.options.lastColumnResizable
|
|
446
|
+
})] : [], S({ allowTableNodeSelection: this.options.allowTableNodeSelection })];
|
|
447
|
+
},
|
|
448
|
+
addNodeView() {
|
|
449
|
+
let t = this.options.resizable && this.editor.isEditable, n = this.options.View;
|
|
450
|
+
return t || !n ? null : ({ node: t, view: r, HTMLAttributes: i }) => {
|
|
451
|
+
let a = e(this.options.HTMLAttributes, i);
|
|
452
|
+
return new n(t, this.options.cellMinWidth, r, a);
|
|
453
|
+
};
|
|
454
|
+
},
|
|
455
|
+
extendNodeSchema(e) {
|
|
456
|
+
let t = {
|
|
457
|
+
name: e.name,
|
|
458
|
+
options: e.options,
|
|
459
|
+
storage: e.storage
|
|
460
|
+
};
|
|
461
|
+
return { tableRole: n(r(e, "tableRole", t)) };
|
|
462
|
+
}
|
|
463
|
+
}), Q = i.create({
|
|
464
|
+
name: "tableKit",
|
|
465
|
+
addExtensions() {
|
|
466
|
+
let e = [];
|
|
467
|
+
return this.options.table !== !1 && e.push(Z.configure(this.options.table)), this.options.tableCell !== !1 && e.push(P.configure(this.options.tableCell)), this.options.tableHeader !== !1 && e.push(F.configure(this.options.tableHeader)), this.options.tableRow !== !1 && e.push(I.configure(this.options.tableRow)), e;
|
|
468
|
+
}
|
|
469
|
+
}), $ = Z.extend({
|
|
470
|
+
onUpdate() {
|
|
471
|
+
if (this.editor.isEditable) return;
|
|
472
|
+
let e = p.getState(this.editor.state);
|
|
473
|
+
e && (e.activeHandle > -1 || e.dragging) && this.editor.view.dispatch(this.editor.state.tr.setMeta(p, { setHandle: -1 }));
|
|
474
|
+
},
|
|
475
|
+
addProseMirrorPlugins() {
|
|
476
|
+
return [f({
|
|
477
|
+
handleWidth: this.options.handleWidth,
|
|
478
|
+
cellMinWidth: this.options.cellMinWidth,
|
|
479
|
+
defaultCellMinWidth: this.options.cellMinWidth,
|
|
480
|
+
View: this.options.View,
|
|
481
|
+
lastColumnResizable: this.options.lastColumnResizable
|
|
482
|
+
}), S({ allowTableNodeSelection: this.options.allowTableNodeSelection })];
|
|
483
|
+
},
|
|
484
|
+
addNodeView() {
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
}).configure({ resizable: !0 });
|
|
488
|
+
//#endregion
|
|
489
|
+
export { Q as n, $ as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as e, n as t } from "./dist-
|
|
1
|
+
import { d as e, n as t } from "./dist-DFua_Xbu.js";
|
|
2
2
|
import { a as n, c as r, i, r as a } from "./floating-ui.dom-CmJ6iBdh.js";
|
|
3
3
|
import { Plugin as o, PluginKey as s } from "@tiptap/pm/state";
|
|
4
4
|
import { Decoration as c, DecorationSet as l } from "@tiptap/pm/view";
|
|
@@ -300,31 +300,33 @@ function S({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
|
|
|
300
300
|
dismissOnOutsideClick: f,
|
|
301
301
|
dismiss: () => h(e.view)
|
|
302
302
|
})
|
|
303
|
-
}, T === "started" && ((v = r?.onBeforeStart) == null || v.call(r, g)), T === "updated" && ((y = r?.onBeforeUpdate) == null || y.call(r, g)), T === "started" && S(T, g), T === "started" || T === "updated")
|
|
304
|
-
|
|
305
|
-
items: o ?? [],
|
|
306
|
-
loading: !1
|
|
307
|
-
};
|
|
308
|
-
else {
|
|
309
|
-
g = {
|
|
303
|
+
}, T === "started" && ((v = r?.onBeforeStart) == null || v.call(r, g)), T === "updated" && ((y = r?.onBeforeUpdate) == null || y.call(r, g)), T === "started" && S(T, g), T === "started" || T === "updated") {
|
|
304
|
+
if (!P) _.abort(), g = {
|
|
310
305
|
...g,
|
|
311
306
|
items: o ?? [],
|
|
312
|
-
loading: !0
|
|
313
|
-
}, T = "updated", S(T, g);
|
|
314
|
-
let e = await _.fetch(A.query || "", a);
|
|
315
|
-
if (e.status === "aborted") return;
|
|
316
|
-
if (!t.getState(n.state)?.active) {
|
|
317
|
-
_.abort();
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
g = e.status === "resolved" ? {
|
|
321
|
-
...g,
|
|
322
|
-
items: e.items,
|
|
323
|
-
loading: !1
|
|
324
|
-
} : {
|
|
325
|
-
...g,
|
|
326
307
|
loading: !1
|
|
327
308
|
};
|
|
309
|
+
else {
|
|
310
|
+
g = {
|
|
311
|
+
...g,
|
|
312
|
+
items: o ?? [],
|
|
313
|
+
loading: !0
|
|
314
|
+
}, T = "updated", S(T, g);
|
|
315
|
+
let e = await _.fetch(A.query || "", a);
|
|
316
|
+
if (e.status === "aborted") return;
|
|
317
|
+
if (!t.getState(n.state)?.active) {
|
|
318
|
+
_.abort();
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
g = e.status === "resolved" ? {
|
|
322
|
+
...g,
|
|
323
|
+
items: e.items,
|
|
324
|
+
loading: !1
|
|
325
|
+
} : {
|
|
326
|
+
...g,
|
|
327
|
+
loading: !1
|
|
328
|
+
};
|
|
329
|
+
}
|
|
328
330
|
}
|
|
329
331
|
if (T === "stopped") {
|
|
330
332
|
_.abort(), S(T, g), g = void 0;
|
|
@@ -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":"AAuQA,eAAO,MAAM,OAAO,SAAU,MAAM,WAuCnC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../html-to-markdown-
|
|
1
|
+
import { t as e } from "../html-to-markdown-B6Uhn7ok.js";
|
|
2
2
|
export { e as html2md };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as e } from "../dist-
|
|
2
|
-
import { t } from "../html-to-markdown-
|
|
3
|
-
import { t as n } from "../markdown-to-html-
|
|
1
|
+
import { t as e } from "../dist-DFua_Xbu.js";
|
|
2
|
+
import { t } from "../html-to-markdown-B6Uhn7ok.js";
|
|
3
|
+
import { t as n } from "../markdown-to-html-WmeDaJXP.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-Dy6hHSvD.js";
|
|
7
7
|
//#region lib/utils/create-scribe-editor.ts
|
|
8
8
|
function o({ content: n = "", editable: r = !1, onContentChange: i }) {
|
|
9
9
|
return new e({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-to-html.d.ts","sourceRoot":"","sources":["../../lib/utils/markdown-to-html.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,OAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"markdown-to-html.d.ts","sourceRoot":"","sources":["../../lib/utils/markdown-to-html.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,OAAQ,MAAM,WAG9B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../markdown-to-html-
|
|
1
|
+
import { t as e } from "../markdown-to-html-WmeDaJXP.js";
|
|
2
2
|
export { e as md2html };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clevertask/scribe",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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": [
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"@tiptap/starter-kit": "^3.29.2",
|
|
65
65
|
"@tiptap/suggestion": "^3.29.2",
|
|
66
66
|
"clsx": "^2.1.1",
|
|
67
|
-
"dompurify": "^3.4.
|
|
67
|
+
"dompurify": "^3.4.13",
|
|
68
68
|
"katex": "^0.17.0",
|
|
69
|
-
"marked": "^18.0.
|
|
69
|
+
"marked": "^18.0.9",
|
|
70
70
|
"tippy.js": "^6.3.7",
|
|
71
71
|
"turndown": "^7.2.4"
|
|
72
72
|
},
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
"glob": "^13.0.6",
|
|
87
87
|
"jsdom": "^30.0.1",
|
|
88
88
|
"lodash": "^4.18.1",
|
|
89
|
-
"oxfmt": "^0.
|
|
90
|
-
"oxlint": "^1.
|
|
89
|
+
"oxfmt": "^0.62.0",
|
|
90
|
+
"oxlint": "^1.77.0",
|
|
91
91
|
"typescript": "~7.0.2",
|
|
92
|
-
"vite": "^8.2.
|
|
92
|
+
"vite": "^8.2.1",
|
|
93
93
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
94
94
|
"vitest": "^4.1.10"
|
|
95
95
|
},
|