@clevertask/scribe 0.0.15 → 0.1.1
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 +77 -27
- package/dist/BarMenu-DaKIz3zZ.js +327 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts +0 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +8 -140
- package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/BubbleMenu.js +2074 -159
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +42 -22
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +19 -1
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/EmojiList.js +42 -42
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -4
- package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +20 -15
- package/dist/components/Scribe/extension/extension-link.js +2 -984
- package/dist/components/Scribe/extension/extension-markdown-paste.js +4 -4
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts +3 -0
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -0
- package/dist/components/Scribe/extension/getPopupMountTarget.js +16 -0
- package/dist/components/Scribe/extension/index.d.ts +16 -2
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +37122 -34
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +4 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3730 -14
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +21 -16
- package/dist/components/Scribe/extension/tableOfContents.d.ts +48 -0
- package/dist/components/Scribe/extension/tableOfContents.d.ts.map +1 -0
- package/dist/components/Scribe/extension/tableOfContents.js +180 -0
- package/dist/components/Scribe/index.d.ts +12 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +133 -87
- package/dist/extension-link-Ch_T7WWG.js +1030 -0
- package/dist/icons/ToolbarIcons.d.ts +19 -0
- package/dist/icons/ToolbarIcons.d.ts.map +1 -0
- package/dist/icons/ToolbarIcons.js +135 -0
- package/dist/{index-BKFDqQPh.js → index-BiBV5TQx.js} +6598 -5432
- package/dist/index-CqzMmrnw.js +1410 -0
- package/dist/index-DxF-1P4n.js +834 -0
- package/dist/index-V-gN11Y9.js +249 -0
- package/dist/main.css +200 -1123
- package/dist/main.js +1 -1
- package/dist/markdown-to-html-pL7ckd-m.js +1135 -0
- package/dist/purify.es-exIQuqhb.js +595 -0
- package/dist/tippy.esm-DLHdsnfG.js +1711 -0
- package/dist/utils/create-scribe-editor.d.ts +2 -2
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/create-scribe-editor.js +3 -3
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +583 -18
- package/dist/utils/index.js +1 -1
- package/dist/utils/markdown-to-html.js +2 -2
- package/package.json +34 -37
- package/dist/clsx-OuTLNxxd.js +0 -16
- package/dist/index-CL2WLiGu.js +0 -159
- package/dist/index-Cxf4VEm1.js +0 -50957
- package/dist/index-PzbCrHp0.js +0 -2349
- package/dist/markdown-to-html-__93dwok.js +0 -1557
- package/dist/purify.es-BPDBzHtc.js +0 -552
- package/dist/turndown.browser.es-RmA_HBaI.js +0 -649
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { P as z, b as J, D as Q, e as V, g as X, a as Y } from "./index-BiBV5TQx.js";
|
|
2
|
+
function Z(u) {
|
|
3
|
+
var s;
|
|
4
|
+
const { char: g, allowSpaces: y, allowToIncludeChar: $, allowedPrefixes: E, startOfLine: k, $position: h } = u, P = y && !$, S = X(g), N = new RegExp(`\\s${S}$`), _ = k ? "^" : "", M = $ ? "" : S, C = P ? new RegExp(`${_}${S}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${_}(?:^)?${S}[^\\s${M}]*`, "gm"), R = ((s = h.nodeBefore) == null ? void 0 : s.isText) && h.nodeBefore.text;
|
|
5
|
+
if (!R)
|
|
6
|
+
return null;
|
|
7
|
+
const O = h.pos - R.length, c = Array.from(R.matchAll(C)).pop();
|
|
8
|
+
if (!c || c.input === void 0 || c.index === void 0)
|
|
9
|
+
return null;
|
|
10
|
+
const D = c.input.slice(Math.max(0, c.index - 1), c.index), f = new RegExp(`^[${E?.join("")}\0]?$`).test(D);
|
|
11
|
+
if (E !== null && !f)
|
|
12
|
+
return null;
|
|
13
|
+
const n = O + c.index;
|
|
14
|
+
let v = n + c[0].length;
|
|
15
|
+
return P && N.test(R.slice(v - 1, v + 1)) && (c[0] += " ", v += 1), n < h.pos && v >= h.pos ? {
|
|
16
|
+
range: {
|
|
17
|
+
from: n,
|
|
18
|
+
to: v
|
|
19
|
+
},
|
|
20
|
+
query: c[0].slice(g.length),
|
|
21
|
+
text: c[0]
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
function ee(u) {
|
|
25
|
+
return u.docChanged ? u.steps.some((s) => {
|
|
26
|
+
const g = s.slice;
|
|
27
|
+
if (!g?.content)
|
|
28
|
+
return !1;
|
|
29
|
+
const y = g.content.textBetween(0, g.content.size, `
|
|
30
|
+
`);
|
|
31
|
+
return /\s/.test(y);
|
|
32
|
+
}) : !1;
|
|
33
|
+
}
|
|
34
|
+
var te = new z("suggestion");
|
|
35
|
+
function ne({
|
|
36
|
+
pluginKey: u = te,
|
|
37
|
+
editor: s,
|
|
38
|
+
char: g = "@",
|
|
39
|
+
allowSpaces: y = !1,
|
|
40
|
+
allowToIncludeChar: $ = !1,
|
|
41
|
+
allowedPrefixes: E = [" "],
|
|
42
|
+
startOfLine: k = !1,
|
|
43
|
+
decorationTag: h = "span",
|
|
44
|
+
decorationClass: P = "suggestion",
|
|
45
|
+
decorationContent: S = "",
|
|
46
|
+
decorationEmptyClass: N = "is-empty",
|
|
47
|
+
command: _ = () => null,
|
|
48
|
+
items: M = () => [],
|
|
49
|
+
render: C = () => ({}),
|
|
50
|
+
allow: R = () => !0,
|
|
51
|
+
findSuggestionMatch: O = Z,
|
|
52
|
+
shouldShow: c,
|
|
53
|
+
shouldResetDismissed: D
|
|
54
|
+
}) {
|
|
55
|
+
let f;
|
|
56
|
+
const n = C?.(), v = y && !$, T = () => {
|
|
57
|
+
const t = s.state.selection.$anchor.pos, o = s.view.coordsAtPos(t), { top: l, right: i, bottom: a, left: r } = o;
|
|
58
|
+
try {
|
|
59
|
+
return new DOMRect(r, l, i - r, a - l);
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}, j = (t, o) => o ? () => {
|
|
64
|
+
const l = u.getState(s.state), i = l?.decorationId, a = t.dom.querySelector(`[data-decoration-id="${i}"]`);
|
|
65
|
+
return a?.getBoundingClientRect() || null;
|
|
66
|
+
} : T, W = ({
|
|
67
|
+
match: t,
|
|
68
|
+
dismissedRange: o,
|
|
69
|
+
state: l,
|
|
70
|
+
transaction: i
|
|
71
|
+
}) => D?.({
|
|
72
|
+
editor: s,
|
|
73
|
+
state: l,
|
|
74
|
+
range: o,
|
|
75
|
+
match: t,
|
|
76
|
+
transaction: i,
|
|
77
|
+
allowSpaces: v
|
|
78
|
+
}) ? !1 : v ? t.range.from === o.from : t.range.from === o.from && !ee(i);
|
|
79
|
+
function G(t, o) {
|
|
80
|
+
var l;
|
|
81
|
+
try {
|
|
82
|
+
const a = u.getState(t.state), r = a?.decorationId ? t.dom.querySelector(`[data-decoration-id="${a.decorationId}"]`) : null, m = {
|
|
83
|
+
// @ts-ignore editor is available in closure
|
|
84
|
+
editor: s,
|
|
85
|
+
range: a?.range || { from: 0, to: 0 },
|
|
86
|
+
query: a?.query || null,
|
|
87
|
+
text: a?.text || null,
|
|
88
|
+
items: [],
|
|
89
|
+
command: (x) => _({ editor: s, range: a?.range || { from: 0, to: 0 }, props: x }),
|
|
90
|
+
decorationNode: r,
|
|
91
|
+
clientRect: j(t, r)
|
|
92
|
+
};
|
|
93
|
+
(l = n?.onExit) == null || l.call(n, m);
|
|
94
|
+
} catch {
|
|
95
|
+
}
|
|
96
|
+
const i = t.state.tr.setMeta(o, { exit: !0 });
|
|
97
|
+
t.dispatch(i);
|
|
98
|
+
}
|
|
99
|
+
const A = new J({
|
|
100
|
+
key: u,
|
|
101
|
+
view() {
|
|
102
|
+
return {
|
|
103
|
+
update: async (t, o) => {
|
|
104
|
+
var l, i, a, r, m, x, I;
|
|
105
|
+
const e = (l = this.key) == null ? void 0 : l.getState(o), p = (i = this.key) == null ? void 0 : i.getState(t.state), d = e.active && p.active && e.range.from !== p.range.from, B = !e.active && p.active, L = e.active && !p.active, K = !B && !L && e.query !== p.query, w = B || d && K, b = K || d, F = L || d && K;
|
|
106
|
+
if (!w && !b && !F)
|
|
107
|
+
return;
|
|
108
|
+
const q = F && !w ? e : p, U = t.dom.querySelector(`[data-decoration-id="${q.decorationId}"]`);
|
|
109
|
+
f = {
|
|
110
|
+
editor: s,
|
|
111
|
+
range: q.range,
|
|
112
|
+
query: q.query,
|
|
113
|
+
text: q.text,
|
|
114
|
+
items: [],
|
|
115
|
+
command: (H) => _({
|
|
116
|
+
editor: s,
|
|
117
|
+
range: q.range,
|
|
118
|
+
props: H
|
|
119
|
+
}),
|
|
120
|
+
decorationNode: U,
|
|
121
|
+
clientRect: j(t, U)
|
|
122
|
+
}, w && ((a = n?.onBeforeStart) == null || a.call(n, f)), b && ((r = n?.onBeforeUpdate) == null || r.call(n, f)), (b || w) && (f.items = await M({
|
|
123
|
+
editor: s,
|
|
124
|
+
query: q.query
|
|
125
|
+
})), F && ((m = n?.onExit) == null || m.call(n, f)), b && ((x = n?.onUpdate) == null || x.call(n, f)), w && ((I = n?.onStart) == null || I.call(n, f));
|
|
126
|
+
},
|
|
127
|
+
destroy: () => {
|
|
128
|
+
var t;
|
|
129
|
+
f && ((t = n?.onExit) == null || t.call(n, f));
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
state: {
|
|
134
|
+
// Initialize the plugin's internal state.
|
|
135
|
+
init() {
|
|
136
|
+
return {
|
|
137
|
+
active: !1,
|
|
138
|
+
range: {
|
|
139
|
+
from: 0,
|
|
140
|
+
to: 0
|
|
141
|
+
},
|
|
142
|
+
query: null,
|
|
143
|
+
text: null,
|
|
144
|
+
composing: !1,
|
|
145
|
+
dismissedRange: null
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
// Apply changes to the plugin state from a view transaction.
|
|
149
|
+
apply(t, o, l, i) {
|
|
150
|
+
const { isEditable: a } = s, { composing: r } = s.view, { selection: m } = t, { empty: x, from: I } = m, e = { ...o }, p = t.getMeta(u);
|
|
151
|
+
if (p && p.exit)
|
|
152
|
+
return e.active = !1, e.decorationId = null, e.range = { from: 0, to: 0 }, e.query = null, e.text = null, e.dismissedRange = o.active ? { ...o.range } : o.dismissedRange, e;
|
|
153
|
+
if (e.composing = r, t.docChanged && e.dismissedRange !== null && (e.dismissedRange = {
|
|
154
|
+
from: t.mapping.map(e.dismissedRange.from),
|
|
155
|
+
to: t.mapping.map(e.dismissedRange.to)
|
|
156
|
+
}), a && (x || s.view.composing)) {
|
|
157
|
+
(I < o.range.from || I > o.range.to) && !r && !o.composing && (e.active = !1);
|
|
158
|
+
const d = O({
|
|
159
|
+
char: g,
|
|
160
|
+
allowSpaces: y,
|
|
161
|
+
allowToIncludeChar: $,
|
|
162
|
+
allowedPrefixes: E,
|
|
163
|
+
startOfLine: k,
|
|
164
|
+
$position: m.$from
|
|
165
|
+
}), B = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
166
|
+
d && R({
|
|
167
|
+
editor: s,
|
|
168
|
+
state: i,
|
|
169
|
+
range: d.range,
|
|
170
|
+
isActive: o.active
|
|
171
|
+
}) && (!c || c({
|
|
172
|
+
editor: s,
|
|
173
|
+
range: d.range,
|
|
174
|
+
query: d.query,
|
|
175
|
+
text: d.text,
|
|
176
|
+
transaction: t
|
|
177
|
+
})) ? (e.dismissedRange !== null && !W({
|
|
178
|
+
match: d,
|
|
179
|
+
dismissedRange: e.dismissedRange,
|
|
180
|
+
state: i,
|
|
181
|
+
transaction: t
|
|
182
|
+
}) && (e.dismissedRange = null), e.dismissedRange === null ? (e.active = !0, e.decorationId = o.decorationId ? o.decorationId : B, e.range = d.range, e.query = d.query, e.text = d.text) : e.active = !1) : (d || (e.dismissedRange = null), e.active = !1);
|
|
183
|
+
} else
|
|
184
|
+
e.active = !1;
|
|
185
|
+
return e.active || (e.decorationId = null, e.range = { from: 0, to: 0 }, e.query = null, e.text = null), e;
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
props: {
|
|
189
|
+
// Call the keydown hook if suggestion is active.
|
|
190
|
+
handleKeyDown(t, o) {
|
|
191
|
+
var l, i;
|
|
192
|
+
const { active: a, range: r } = A.getState(t.state);
|
|
193
|
+
if (!a)
|
|
194
|
+
return !1;
|
|
195
|
+
if (o.key === "Escape" || o.key === "Esc") {
|
|
196
|
+
const x = A.getState(t.state);
|
|
197
|
+
return (l = n?.onKeyDown) == null || l.call(n, { view: t, event: o, range: x.range }), G(t, u), !0;
|
|
198
|
+
}
|
|
199
|
+
return ((i = n?.onKeyDown) == null ? void 0 : i.call(n, { view: t, event: o, range: r })) || !1;
|
|
200
|
+
},
|
|
201
|
+
// Setup decorator on the currently active suggestion.
|
|
202
|
+
decorations(t) {
|
|
203
|
+
const { active: o, range: l, decorationId: i, query: a } = A.getState(t);
|
|
204
|
+
if (!o)
|
|
205
|
+
return null;
|
|
206
|
+
const r = !a?.length, m = [P];
|
|
207
|
+
return r && m.push(N), Q.create(t.doc, [
|
|
208
|
+
V.inline(l.from, l.to, {
|
|
209
|
+
nodeName: h,
|
|
210
|
+
class: m.join(" "),
|
|
211
|
+
"data-decoration-id": i,
|
|
212
|
+
"data-decoration-content": S
|
|
213
|
+
})
|
|
214
|
+
]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return A;
|
|
219
|
+
}
|
|
220
|
+
var oe = ne;
|
|
221
|
+
const ae = new z("slashSuggestion"), le = Y.create({
|
|
222
|
+
name: "slashCommand",
|
|
223
|
+
addOptions() {
|
|
224
|
+
return {
|
|
225
|
+
...this.parent?.(),
|
|
226
|
+
slashSuggestion: {
|
|
227
|
+
char: "/",
|
|
228
|
+
startOfLine: !0,
|
|
229
|
+
command: ({ editor: u, range: s, props: g }) => {
|
|
230
|
+
g.command({ editor: u, range: s, props: g });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
addProseMirrorPlugins() {
|
|
236
|
+
return [
|
|
237
|
+
oe({
|
|
238
|
+
pluginKey: ae,
|
|
239
|
+
...this.options.slashSuggestion,
|
|
240
|
+
editor: this.editor
|
|
241
|
+
})
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
export {
|
|
246
|
+
ne as S,
|
|
247
|
+
le as a,
|
|
248
|
+
ae as s
|
|
249
|
+
};
|