@clevertask/scribe 0.1.10 → 0.1.12
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/CalloutBubbleMenu.d.ts +7 -0
- package/dist/components/Menu/CalloutBubbleMenu.d.ts.map +1 -0
- package/dist/components/Menu/CalloutBubbleMenu.js +156 -0
- 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 +306 -0
- package/dist/components/Menu/calloutBubbleMenuPlugin.d.ts +10 -0
- package/dist/components/Menu/calloutBubbleMenuPlugin.d.ts.map +1 -0
- package/dist/components/Menu/calloutBubbleMenuPlugin.js +22 -0
- package/dist/components/Menu/contextualMenuOwner.d.ts +4 -0
- package/dist/components/Menu/contextualMenuOwner.d.ts.map +1 -0
- package/dist/components/Menu/contextualMenuOwner.js +9 -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/callout.d.ts +32 -0
- package/dist/components/Scribe/extension/callout.d.ts.map +1 -0
- package/dist/components/Scribe/extension/callout.js +118 -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 +73 -26
- 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 +140 -133
- 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-_8uh0Ik9.js} +1323 -1780
- package/dist/{extension-link-DJy7XDoj.js → extension-link-CjfUZ90W.js} +1 -1
- package/dist/{html-to-markdown-Cta7-ssO.js → html-to-markdown-C920nQtn.js} +155 -56
- package/dist/icons/CalloutIcon.d.ts +9 -0
- package/dist/icons/CalloutIcon.d.ts.map +1 -0
- package/dist/icons/CalloutIcon.js +72 -0
- package/dist/main.css +170 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +9 -8
- package/dist/{markdown-to-html-DwSNqq2i.js → markdown-to-html-CW0Nb9Ye.js} +103 -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 +47 -24
|
@@ -1,142 +1,144 @@
|
|
|
1
|
-
import { n as e, t } from "../../BarMenu-
|
|
2
|
-
import { i as n, t as r } from "../../dist-
|
|
3
|
-
import i from "../Menu/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
1
|
+
import { n as e, t } from "../../BarMenu-5M9g9Y1j.js";
|
|
2
|
+
import { i as n, t as r } from "../../dist-Dw4STOPE.js";
|
|
3
|
+
import i from "../Menu/CalloutBubbleMenu.js";
|
|
4
|
+
import a from "../Menu/LinkBubbleMenu.js";
|
|
5
|
+
import o from "../Menu/TableBubbleMenu.js";
|
|
6
|
+
import { t as s } from "../../html-to-markdown-C920nQtn.js";
|
|
7
|
+
import { t as c } from "../../extension-_8uh0Ik9.js";
|
|
8
|
+
import { SuggestionItemType as l } from "./extension/slashCommand/items.js";
|
|
7
9
|
import "./extension/tableOfContents.js";
|
|
8
10
|
import "../../utils/index.js";
|
|
9
|
-
import { ListOptionBar as
|
|
10
|
-
import { forwardRef as
|
|
11
|
-
import { jsx as
|
|
11
|
+
import { ListOptionBar as u } from "../Menu/Mobile/ListOptionBar.js";
|
|
12
|
+
import { forwardRef as d, useCallback as f, useEffect as p, useImperativeHandle as m, useRef as h, useState as g } from "react";
|
|
13
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
14
|
import '../../assets/index.css';//#region lib/components/Scribe/index.tsx
|
|
13
|
-
var
|
|
15
|
+
var y = "Rich text editor", b = [
|
|
14
16
|
"role",
|
|
15
17
|
"aria-label",
|
|
16
18
|
"aria-multiline",
|
|
17
19
|
"aria-readonly"
|
|
18
|
-
],
|
|
20
|
+
], x = (t, n, r) => {
|
|
19
21
|
let i = t.role ?? "textbox";
|
|
20
22
|
return {
|
|
21
23
|
...t,
|
|
22
24
|
role: i,
|
|
23
25
|
class: e("scribe", t.class),
|
|
24
|
-
"aria-label": n ?? t["aria-label"] ??
|
|
26
|
+
"aria-label": n ?? t["aria-label"] ?? y,
|
|
25
27
|
...i === "textbox" ? {
|
|
26
28
|
"aria-multiline": "true",
|
|
27
29
|
"aria-readonly": String(!r)
|
|
28
30
|
} : {}
|
|
29
31
|
};
|
|
30
|
-
},
|
|
31
|
-
let t =
|
|
32
|
-
return
|
|
32
|
+
}, S = (e) => {
|
|
33
|
+
let t = h([]), n = h(e);
|
|
34
|
+
return p(() => {
|
|
33
35
|
n.current = e;
|
|
34
36
|
}, [e]), {
|
|
35
|
-
handleTableOfContentsChange:
|
|
37
|
+
handleTableOfContentsChange: f((e, r) => {
|
|
36
38
|
t.current = e, n.current?.(e, r);
|
|
37
39
|
}, []),
|
|
38
40
|
tableOfContentsItemsRef: t
|
|
39
41
|
};
|
|
40
|
-
},
|
|
41
|
-
let { ariaLabel:
|
|
42
|
-
ariaLabel:
|
|
43
|
-
editable:
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
ariaLabel:
|
|
47
|
-
editable:
|
|
42
|
+
}, C = d((n, c) => {
|
|
43
|
+
let { ariaLabel: l, autoFocus: d = !1, content: g, editable: y = !0, editor: S, editorProps: C, externalEditor: w, initialContentWasApplied: T, onContentChange: E, showBarMenu: D = !0, editorContentStyle: O, editorContentClassName: k, mainContainerStyle: A, mainContainerClassName: j, onKeyDown: M, mobile: N, tableOfContentsItemsRef: P } = n, F = h({
|
|
44
|
+
ariaLabel: l,
|
|
45
|
+
editable: y
|
|
46
|
+
}), I = h(null);
|
|
47
|
+
F.current = {
|
|
48
|
+
ariaLabel: l,
|
|
49
|
+
editable: y
|
|
48
50
|
};
|
|
49
|
-
let
|
|
51
|
+
let L = h(T && g !== void 0), R = f(({ editor: e, transaction: t }) => {
|
|
50
52
|
if (t.getMeta("scribeTableOfContents")) return;
|
|
51
|
-
let n = e.getHTML(), r = e.getJSON(), i = !
|
|
52
|
-
|
|
53
|
+
let n = e.getHTML(), r = e.getJSON(), i = !y;
|
|
54
|
+
E && E({
|
|
53
55
|
jsonContent: e.isEmpty ? "" : r,
|
|
54
56
|
htmlContent: e.isEmpty ? "" : n,
|
|
55
|
-
markdownContent: e.isEmpty ? "" :
|
|
57
|
+
markdownContent: e.isEmpty ? "" : s(n),
|
|
56
58
|
source: i ? "programmatic" : "user"
|
|
57
59
|
});
|
|
58
|
-
}, [
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
html: () =>
|
|
62
|
-
json: () =>
|
|
63
|
-
markdown: () =>
|
|
64
|
-
}[e]?.(), [
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
let t = typeof e == "string" ? e : e.id, n =
|
|
68
|
-
if (!n ||
|
|
69
|
-
let r =
|
|
70
|
-
if (
|
|
71
|
-
let e = Math.max(0, Math.min(n.pos + n.node.nodeSize - 1,
|
|
72
|
-
|
|
60
|
+
}, [y, E]), z = f(() => {
|
|
61
|
+
S.commands.setContent("");
|
|
62
|
+
}, [S]), B = f((e) => S.isEmpty ? "" : {
|
|
63
|
+
html: () => S.getHTML(),
|
|
64
|
+
json: () => S.getJSON(),
|
|
65
|
+
markdown: () => s(S.getHTML())
|
|
66
|
+
}[e]?.(), [S]), V = f((e) => {
|
|
67
|
+
S.commands.setContent(e);
|
|
68
|
+
}, [S]), H = f((e) => {
|
|
69
|
+
let t = typeof e == "string" ? e : e.id, n = P.current.find((e) => e.id === t) ?? (typeof e == "string" ? void 0 : e);
|
|
70
|
+
if (!n || S.isDestroyed) return;
|
|
71
|
+
let r = S.view.nodeDOM(n.pos), i = r instanceof HTMLElement ? r : n.dom;
|
|
72
|
+
if (S.isEditable) {
|
|
73
|
+
let e = Math.max(0, Math.min(n.pos + n.node.nodeSize - 1, S.state.doc.content.size));
|
|
74
|
+
S.commands.focus(e, { scrollIntoView: !1 });
|
|
73
75
|
}
|
|
74
76
|
i.scrollIntoView({
|
|
75
77
|
behavior: "smooth",
|
|
76
78
|
block: "start"
|
|
77
79
|
});
|
|
78
|
-
}, [
|
|
79
|
-
return
|
|
80
|
-
resetContent:
|
|
81
|
-
setContent:
|
|
82
|
-
getContent:
|
|
83
|
-
scrollToTableOfContentsItem:
|
|
84
|
-
editor:
|
|
80
|
+
}, [S, P]);
|
|
81
|
+
return m(c, () => ({
|
|
82
|
+
resetContent: z,
|
|
83
|
+
setContent: V,
|
|
84
|
+
getContent: B,
|
|
85
|
+
scrollToTableOfContentsItem: H,
|
|
86
|
+
editor: S
|
|
85
87
|
}), [
|
|
86
|
-
|
|
87
|
-
R,
|
|
88
|
-
L,
|
|
88
|
+
S,
|
|
89
89
|
B,
|
|
90
|
-
z
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
z,
|
|
91
|
+
H,
|
|
92
|
+
V
|
|
93
|
+
]), p(() => {
|
|
94
|
+
if (g !== void 0) {
|
|
95
|
+
if (L.current) {
|
|
96
|
+
L.current = !1;
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
|
-
|
|
99
|
+
S.commands.setContent(g, { emitUpdate: !1 });
|
|
98
100
|
}
|
|
99
|
-
}, [
|
|
100
|
-
if (!
|
|
101
|
-
|
|
101
|
+
}, [g, S]), p(() => {
|
|
102
|
+
if (!w) {
|
|
103
|
+
I.current = null;
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
|
-
let e =
|
|
106
|
+
let e = S.view.dom, t = Object.fromEntries(b.map((t) => [t, e.getAttribute(t)])), n = S.options.editable, r = S.options.editorProps ?? {}, i = r.attributes, a = /* @__PURE__ */ new Set(), o = (e, t) => {
|
|
105
107
|
let n = typeof i == "function" ? i.call(t, e) : i;
|
|
106
108
|
return Object.keys(n ?? {}).forEach((e) => a.add(e)), n ?? {};
|
|
107
109
|
}, s = (e, n) => {
|
|
108
110
|
let r = o(e, n), i = {};
|
|
109
|
-
return
|
|
111
|
+
return b.forEach((e) => {
|
|
110
112
|
let n = t[e];
|
|
111
113
|
!a.has(e) && n !== null && (i[e] = n);
|
|
112
114
|
}), {
|
|
113
115
|
...i,
|
|
114
116
|
...r
|
|
115
117
|
};
|
|
116
|
-
}, c = s(
|
|
117
|
-
|
|
118
|
-
editor:
|
|
118
|
+
}, c = s(S.state, r);
|
|
119
|
+
I.current = {
|
|
120
|
+
editor: S,
|
|
119
121
|
attributes: c
|
|
120
122
|
};
|
|
121
123
|
let l = function(e) {
|
|
122
124
|
let t = s(e, this);
|
|
123
|
-
|
|
124
|
-
let n =
|
|
125
|
-
return
|
|
125
|
+
I.current?.editor === S && (I.current.attributes = t);
|
|
126
|
+
let n = F.current;
|
|
127
|
+
return x(t, n.ariaLabel, n.editable);
|
|
126
128
|
};
|
|
127
|
-
return
|
|
129
|
+
return S.setOptions({ editorProps: {
|
|
128
130
|
...r,
|
|
129
131
|
attributes: l
|
|
130
132
|
} }), () => {
|
|
131
|
-
if (!
|
|
132
|
-
let s =
|
|
133
|
+
if (!S.isDestroyed) {
|
|
134
|
+
let s = S.options.editorProps ?? {}, c = s.attributes === l;
|
|
133
135
|
if (c) {
|
|
134
136
|
let e = { ...s };
|
|
135
|
-
i === void 0 ? delete e.attributes : e.attributes = i,
|
|
137
|
+
i === void 0 ? delete e.attributes : e.attributes = i, S.setOptions({ editorProps: e });
|
|
136
138
|
}
|
|
137
|
-
|
|
138
|
-
let u = c ? o(
|
|
139
|
-
u &&
|
|
139
|
+
S.setEditable(!!n, !1);
|
|
140
|
+
let u = c ? o(S.state, r) : null;
|
|
141
|
+
u && b.forEach((n) => {
|
|
140
142
|
let r = n in u ? u[n] : a.has(n) ? null : t[n];
|
|
141
143
|
if (r == null) {
|
|
142
144
|
e.removeAttribute(n);
|
|
@@ -145,12 +147,12 @@ var _ = "Rich text editor", v = [
|
|
|
145
147
|
e.setAttribute(n, r);
|
|
146
148
|
});
|
|
147
149
|
}
|
|
148
|
-
|
|
150
|
+
I.current?.editor === S && (I.current = null);
|
|
149
151
|
};
|
|
150
|
-
}, [
|
|
151
|
-
|
|
152
|
-
let e =
|
|
153
|
-
|
|
152
|
+
}, [S, w]), p(() => {
|
|
153
|
+
S.setEditable(!!y);
|
|
154
|
+
let e = S.view.dom, t = x((w ? I.current?.attributes : typeof C?.editorProps?.attributes == "function" ? C.editorProps.attributes.call(C.editorProps, S.state) : C?.editorProps?.attributes) ?? {}, l, y);
|
|
155
|
+
b.forEach((n) => {
|
|
154
156
|
let r = t[n];
|
|
155
157
|
if (r === void 0) {
|
|
156
158
|
e.removeAttribute(n);
|
|
@@ -159,78 +161,83 @@ var _ = "Rich text editor", v = [
|
|
|
159
161
|
e.setAttribute(n, r);
|
|
160
162
|
});
|
|
161
163
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
]),
|
|
168
|
-
|
|
169
|
-
}), [
|
|
170
|
-
|
|
171
|
-
}, [
|
|
172
|
-
className: e("scribe-wrapper", "scribe-root",
|
|
164
|
+
l,
|
|
165
|
+
y,
|
|
166
|
+
S,
|
|
167
|
+
C,
|
|
168
|
+
w
|
|
169
|
+
]), p(() => (S.off("update"), S.on("update", R), () => {
|
|
170
|
+
S.off("update", R);
|
|
171
|
+
}), [S, R]), p(() => {
|
|
172
|
+
d && S.commands.focus("end");
|
|
173
|
+
}, [d, S]), /* @__PURE__ */ v("div", {
|
|
174
|
+
className: e("scribe-wrapper", "scribe-root", j),
|
|
173
175
|
"data-scribe-root": !0,
|
|
174
|
-
style:
|
|
175
|
-
children: [/* @__PURE__ */
|
|
176
|
-
className: e("scribe-frame",
|
|
176
|
+
style: A,
|
|
177
|
+
children: [/* @__PURE__ */ v("div", {
|
|
178
|
+
className: e("scribe-frame", y && "scribe-frame--editable"),
|
|
177
179
|
children: [
|
|
178
|
-
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
className: e("scribe-content",
|
|
181
|
-
style:
|
|
182
|
-
children: [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
S && D ? /* @__PURE__ */ _(t, { editor: S }) : null,
|
|
181
|
+
/* @__PURE__ */ v("div", {
|
|
182
|
+
className: e("scribe-content", y && "scribe-content--editable", k),
|
|
183
|
+
style: O,
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ _(r, {
|
|
186
|
+
editor: S,
|
|
187
|
+
onKeyDown: M
|
|
188
|
+
}),
|
|
189
|
+
y ? /* @__PURE__ */ _(a, { editor: S }) : null,
|
|
190
|
+
y && S.schema.nodes.callout ? /* @__PURE__ */ _(i, { editor: S }) : null,
|
|
191
|
+
y && S.schema.nodes.table ? /* @__PURE__ */ _(o, { editor: S }) : null
|
|
192
|
+
]
|
|
186
193
|
}),
|
|
187
|
-
|
|
194
|
+
N ? /* @__PURE__ */ _(u, { editor: S }) : null
|
|
188
195
|
]
|
|
189
|
-
}), /* @__PURE__ */
|
|
196
|
+
}), /* @__PURE__ */ _("div", {
|
|
190
197
|
className: "scribe-popup-root",
|
|
191
198
|
"data-scribe-popup-root": !0
|
|
192
199
|
})]
|
|
193
200
|
});
|
|
194
201
|
});
|
|
195
|
-
|
|
196
|
-
var
|
|
197
|
-
let { ariaLabel: r, content: i, editable: a = !0, editorProps:
|
|
202
|
+
C.displayName = "ScribeEditor";
|
|
203
|
+
var w = d((e, t) => {
|
|
204
|
+
let { ariaLabel: r, content: i, editable: a = !0, editorProps: o, extensions: s, onTableOfContentsChange: l } = e, { handleTableOfContentsChange: u, tableOfContentsItemsRef: d } = S(l), f = o?.editorProps?.attributes, p = h({
|
|
198
205
|
ariaLabel: r,
|
|
199
206
|
editable: a
|
|
200
207
|
});
|
|
201
|
-
|
|
208
|
+
p.current = {
|
|
202
209
|
ariaLabel: r,
|
|
203
210
|
editable: a
|
|
204
211
|
};
|
|
205
|
-
let
|
|
206
|
-
let t =
|
|
207
|
-
return
|
|
208
|
-
} :
|
|
209
|
-
...
|
|
210
|
-
content: i ??
|
|
212
|
+
let m = typeof f == "function" ? function(e) {
|
|
213
|
+
let t = p.current;
|
|
214
|
+
return x(f.call(this, e), t.ariaLabel, t.editable);
|
|
215
|
+
} : x(f ?? {}, r, a), [v] = g(() => ({
|
|
216
|
+
...o,
|
|
217
|
+
content: i ?? o?.content,
|
|
211
218
|
editable: a,
|
|
212
|
-
extensions: [...
|
|
219
|
+
extensions: [...c({
|
|
213
220
|
...e,
|
|
214
221
|
onTableOfContentsChange: u
|
|
215
|
-
}), ...
|
|
222
|
+
}), ...s ?? []],
|
|
216
223
|
editorProps: {
|
|
217
|
-
...
|
|
218
|
-
attributes:
|
|
224
|
+
...o?.editorProps,
|
|
225
|
+
attributes: m
|
|
219
226
|
},
|
|
220
|
-
shouldRerenderOnTransaction:
|
|
221
|
-
})),
|
|
222
|
-
return
|
|
227
|
+
shouldRerenderOnTransaction: o?.shouldRerenderOnTransaction ?? !1
|
|
228
|
+
})), y = n(v);
|
|
229
|
+
return y ? /* @__PURE__ */ _(C, {
|
|
223
230
|
...e,
|
|
224
231
|
ref: t,
|
|
225
|
-
editor:
|
|
232
|
+
editor: y,
|
|
226
233
|
initialContentWasApplied: !0,
|
|
227
234
|
tableOfContentsItemsRef: d
|
|
228
235
|
}) : null;
|
|
229
236
|
});
|
|
230
|
-
|
|
231
|
-
var
|
|
232
|
-
let { externalEditor: n, onTableOfContentsChange: r } = e, { tableOfContentsItemsRef: i } =
|
|
233
|
-
return n ? /* @__PURE__ */
|
|
237
|
+
w.displayName = "OwnedScribe";
|
|
238
|
+
var T = d((e, t) => {
|
|
239
|
+
let { externalEditor: n, onTableOfContentsChange: r } = e, { tableOfContentsItemsRef: i } = S(r);
|
|
240
|
+
return n ? /* @__PURE__ */ _(C, {
|
|
234
241
|
...e,
|
|
235
242
|
ref: t,
|
|
236
243
|
editor: n,
|
|
@@ -238,14 +245,14 @@ var C = l((e, t) => {
|
|
|
238
245
|
tableOfContentsItemsRef: i
|
|
239
246
|
}) : null;
|
|
240
247
|
});
|
|
241
|
-
|
|
242
|
-
var
|
|
248
|
+
T.displayName = "ExternalScribe";
|
|
249
|
+
var E = d((e, t) => e.externalEditor ? /* @__PURE__ */ _(T, {
|
|
243
250
|
...e,
|
|
244
251
|
ref: t
|
|
245
|
-
}) : /* @__PURE__ */
|
|
252
|
+
}) : /* @__PURE__ */ _(w, {
|
|
246
253
|
...e,
|
|
247
254
|
ref: t
|
|
248
255
|
}));
|
|
249
|
-
|
|
256
|
+
E.displayName = "Scribe";
|
|
250
257
|
//#endregion
|
|
251
|
-
export {
|
|
258
|
+
export { E as Scribe, l as SuggestionItemType };
|
|
@@ -1175,24 +1175,26 @@ function pn(e, t, n) {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
var mn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1177
1177
|
let { selection: a } = n, { empty: o, ranges: s } = a, c = N(e, r.schema);
|
|
1178
|
-
if (i)
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1178
|
+
if (i) {
|
|
1179
|
+
if (o) {
|
|
1180
|
+
let e = Tt(r, c);
|
|
1181
|
+
n.addStoredMark(c.create({
|
|
1182
|
+
...e,
|
|
1183
|
+
...t
|
|
1184
|
+
}));
|
|
1185
|
+
} else s.forEach((e) => {
|
|
1186
|
+
let i = e.$from.pos, a = e.$to.pos;
|
|
1187
|
+
r.doc.nodesBetween(i, a, (e, r) => {
|
|
1188
|
+
let o = Math.max(r, i), s = Math.min(r + e.nodeSize, a);
|
|
1189
|
+
e.marks.find((e) => e.type === c) ? e.marks.forEach((e) => {
|
|
1190
|
+
c === e.type && n.addMark(o, s, c.create({
|
|
1191
|
+
...e.attrs,
|
|
1192
|
+
...t
|
|
1193
|
+
}));
|
|
1194
|
+
}) : n.addMark(o, s, c.create(t));
|
|
1195
|
+
});
|
|
1194
1196
|
});
|
|
1195
|
-
}
|
|
1197
|
+
}
|
|
1196
1198
|
return pn(r, n, c);
|
|
1197
1199
|
}, hn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), gn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1198
1200
|
let a = j(e, n.schema), o;
|
|
@@ -1635,14 +1637,16 @@ function Zn(e) {
|
|
|
1635
1637
|
let a = g.slice(0, i);
|
|
1636
1638
|
m = a.trim();
|
|
1637
1639
|
let o = e.slice(0, p + i + n[0].length), c = [];
|
|
1638
|
-
if (m)
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1640
|
+
if (m) {
|
|
1641
|
+
if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
|
|
1642
|
+
e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
|
|
1643
|
+
}); c.length > 0;) {
|
|
1644
|
+
let e = c[c.length - 1];
|
|
1645
|
+
if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
|
|
1646
|
+
else break;
|
|
1647
|
+
}
|
|
1648
|
+
else c = r.inlineTokens(m);
|
|
1644
1649
|
}
|
|
1645
|
-
else c = r.inlineTokens(m);
|
|
1646
1650
|
return {
|
|
1647
1651
|
type: t,
|
|
1648
1652
|
raw: o,
|
|
@@ -2664,13 +2668,15 @@ var $ = class e extends sr {
|
|
|
2664
2668
|
closest(e, t = {}) {
|
|
2665
2669
|
let n = null, r = this.parent;
|
|
2666
2670
|
for (; r && !n;) {
|
|
2667
|
-
if (r.node.type.name === e)
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
let
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2671
|
+
if (r.node.type.name === e) {
|
|
2672
|
+
if (Object.keys(t).length > 0) {
|
|
2673
|
+
let e = r.node.attrs, n = Object.keys(t);
|
|
2674
|
+
for (let r = 0; r < n.length; r += 1) {
|
|
2675
|
+
let i = n[r];
|
|
2676
|
+
if (e[i] !== t[i]) break;
|
|
2677
|
+
}
|
|
2678
|
+
} else n = r;
|
|
2679
|
+
}
|
|
2674
2680
|
r = r.parent;
|
|
2675
2681
|
}
|
|
2676
2682
|
return n;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
|
|
2
|
-
import { t } from "./dist-
|
|
2
|
+
import { t } from "./dist-DFua_Xbu.js";
|
|
3
3
|
import * as n from "react";
|
|
4
4
|
import r, { createContext as i, forwardRef as a, useContext as o, useDebugValue as s, useEffect as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f, version as p } from "react";
|
|
5
5
|
import m, { flushSync as h } from "react-dom";
|