@clevertask/scribe 0.1.3 → 0.1.5
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 +3 -0
- package/dist/BarMenu-V1uRL3bt.js +272 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +2 -10
- package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/BubbleMenu.js +165 -2090
- package/dist/components/Menu/LinkBubbleMenu.d.ts +8 -0
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -0
- package/dist/components/Menu/LinkBubbleMenu.js +78 -0
- package/dist/components/Menu/LinkEditor.d.ts +14 -0
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -0
- package/dist/components/Menu/LinkEditor.js +140 -0
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
- package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
- package/dist/components/Menu/linkUrl.d.ts +2 -0
- package/dist/components/Menu/linkUrl.d.ts.map +1 -0
- package/dist/components/Menu/linkUrl.js +21 -0
- package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
- package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
- package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-link.js +2 -4
- package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
- package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
- package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
- package/dist/components/Scribe/extension/index.d.ts +4 -4
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +2 -37169
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
- package/dist/components/Scribe/extension/tableOfContents.js +153 -180
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +113 -153
- package/dist/dist-BQjH-i-q.js +7016 -0
- package/dist/dist-CnXCIcnl.js +3506 -0
- package/dist/dist-RuuEA1GJ.js +686 -0
- package/dist/extension-CZOsheCI.js +56236 -0
- package/dist/extension-link-DZID_SYl.js +908 -0
- package/dist/floating-ui.dom-rih69525.js +928 -0
- package/dist/html-to-markdown-CrNOkSye.js +497 -0
- package/dist/icons/ToolbarIcons.d.ts.map +1 -1
- package/dist/icons/ToolbarIcons.js +76 -135
- package/dist/main.css +10 -0
- package/dist/main.js +7 -15
- package/dist/markdown-to-html-DEczPfuq.js +1458 -0
- package/dist/menus-CzX7kyXn.js +633 -0
- package/dist/purify.es-DF9CW1cl.js +767 -0
- package/dist/rolldown-runtime-B8UxIWdF.js +7 -0
- package/dist/slashCommand-B7CRIaKG.js +429 -0
- package/dist/tables-CjOC70rm.js +1345 -0
- package/dist/tippy.esm-D9LL2xiE.js +1713 -0
- package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
- package/dist/utils/convert-legacy-math-delimiters.js +7 -13
- package/dist/utils/create-scribe-editor.js +2 -31
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +2 -600
- package/dist/utils/index.js +24 -12
- package/dist/utils/is-in-viewport.d.ts.map +1 -1
- package/dist/utils/is-in-viewport.js +6 -6
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +2 -5
- package/dist/vite-env.d.js +0 -1
- package/package.json +40 -38
- package/dist/BarMenu-DaKIz3zZ.js +0 -327
- package/dist/extension-link-Ch_T7WWG.js +0 -1030
- package/dist/index-BiBV5TQx.js +0 -13513
- package/dist/index-CqzMmrnw.js +0 -1410
- package/dist/index-DxF-1P4n.js +0 -834
- package/dist/index-V-gN11Y9.js +0 -249
- package/dist/markdown-to-html-pL7ckd-m.js +0 -1135
- package/dist/purify.es-exIQuqhb.js +0 -595
- package/dist/tippy.esm-DLHdsnfG.js +0 -1711
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
3
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
4
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
|
+
});
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as n, e as t };
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { a as e, i as t } from "./dist-CnXCIcnl.js";
|
|
2
|
+
import { H as n, U as r, d as i, n as a } from "./dist-BQjH-i-q.js";
|
|
3
|
+
import { a as o, c as s, i as c, r as l } from "./floating-ui.dom-rih69525.js";
|
|
4
|
+
//#region node_modules/.pnpm/@tiptap+suggestion@3.29.0_@floating-ui+dom@1.8.0_@tiptap+core@3.29.0_@tiptap+pm@3.29.0__@tiptap+pm@3.29.0/node_modules/@tiptap/suggestion/dist/index.js
|
|
5
|
+
function u(e) {
|
|
6
|
+
let { char: t, allowSpaces: n, allowToIncludeChar: r, allowedPrefixes: a, startOfLine: o, $position: s } = e, c = n && !r, l = i(t), u = RegExp(`\\s${l}$`), d = o ? "^" : "", f = r ? "" : l, p = RegExp(c ? `${d}${l}.*?(?=\\s${f}|$)` : `${d}(?:^)?${l}[^\\s${f}]*`, "gm"), m = s.nodeBefore?.isText && s.nodeBefore.text;
|
|
7
|
+
if (!m) return null;
|
|
8
|
+
let h = s.pos - m.length, g = Array.from(m.matchAll(p)).pop();
|
|
9
|
+
if (!g || g.input === void 0 || g.index === void 0) return null;
|
|
10
|
+
let _ = g.input.slice(Math.max(0, g.index - 1), g.index), v = RegExp(`^[${a?.join("")}\0]?$`).test(_);
|
|
11
|
+
if (a !== null && !v) return null;
|
|
12
|
+
let y = h + g.index, b = y + g[0].length;
|
|
13
|
+
return c && u.test(m.slice(b - 1, b + 1)) && (g[0] += " ", b += 1), y < s.pos && b >= s.pos ? {
|
|
14
|
+
range: {
|
|
15
|
+
from: y,
|
|
16
|
+
to: b
|
|
17
|
+
},
|
|
18
|
+
query: g[0].slice(t.length),
|
|
19
|
+
text: g[0]
|
|
20
|
+
} : null;
|
|
21
|
+
}
|
|
22
|
+
function d(e) {
|
|
23
|
+
return e.docChanged ? e.steps.some((e) => {
|
|
24
|
+
let t = e.slice;
|
|
25
|
+
if (!t?.content) return !1;
|
|
26
|
+
let n = t.content.textBetween(0, t.content.size, "\n");
|
|
27
|
+
return /\s/.test(n);
|
|
28
|
+
}) : !1;
|
|
29
|
+
}
|
|
30
|
+
function f(e) {
|
|
31
|
+
return () => {
|
|
32
|
+
let t = e.state.selection.$anchor.pos, { top: n, right: r, bottom: i, left: a } = e.view.coordsAtPos(t);
|
|
33
|
+
try {
|
|
34
|
+
return new DOMRect(a, n, r - a, i - n);
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function p(e, t, n, r) {
|
|
41
|
+
return n ? () => {
|
|
42
|
+
let n = r.getState(e.state)?.decorationId;
|
|
43
|
+
return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect() || null;
|
|
44
|
+
} : f(e);
|
|
45
|
+
}
|
|
46
|
+
function m({ match: e, dismissedRange: t, state: n, transaction: r, editor: i, shouldResetDismissed: a, effectiveAllowSpaces: o }) {
|
|
47
|
+
return a?.({
|
|
48
|
+
editor: i,
|
|
49
|
+
state: n,
|
|
50
|
+
range: t,
|
|
51
|
+
match: e,
|
|
52
|
+
transaction: r,
|
|
53
|
+
allowSpaces: o
|
|
54
|
+
}) ? !1 : o ? e.range.from === t.from : e.range.from === t.from && !d(r);
|
|
55
|
+
}
|
|
56
|
+
function h({ view: e, pluginKeyRef: t }) {
|
|
57
|
+
let n = e.state.tr.setMeta(t, { exit: !0 });
|
|
58
|
+
e.dispatch(n);
|
|
59
|
+
}
|
|
60
|
+
function g({ pluginKey: e, decorationTag: t, decorationClass: i, decorationContent: a, decorationEmptyClass: o, renderer: s, dispatchExit: c }) {
|
|
61
|
+
return {
|
|
62
|
+
handleKeyDown(t, n) {
|
|
63
|
+
var r;
|
|
64
|
+
let i = e.getState(t.state);
|
|
65
|
+
return i.active ? n.key === "Escape" || n.key === "Esc" ? ((r = s?.onKeyDown) == null || r.call(s, {
|
|
66
|
+
view: t,
|
|
67
|
+
event: n,
|
|
68
|
+
range: i.range
|
|
69
|
+
}), c(t), !0) : (s?.onKeyDown)?.call(s, {
|
|
70
|
+
view: t,
|
|
71
|
+
event: n,
|
|
72
|
+
range: i.range
|
|
73
|
+
}) || !1 : !1;
|
|
74
|
+
},
|
|
75
|
+
decorations(s) {
|
|
76
|
+
let { active: c, range: l, decorationId: u, query: d } = e.getState(s);
|
|
77
|
+
if (!c) return null;
|
|
78
|
+
let f = !d?.length, p = [i];
|
|
79
|
+
return f && p.push(o), r.create(s.doc, [n.inline(l.from, l.to, {
|
|
80
|
+
nodeName: t,
|
|
81
|
+
class: p.join(" "),
|
|
82
|
+
"data-decoration-id": u || void 0,
|
|
83
|
+
"data-decoration-content": a
|
|
84
|
+
})]);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function _({ editor: e, char: t, effectiveAllowSpaces: n, allowToIncludeChar: r, allowedPrefixes: i, startOfLine: a, findSuggestionMatch: o, allow: s, shouldShow: c, shouldKeepDismissed: l, pluginKey: u }) {
|
|
89
|
+
return {
|
|
90
|
+
init() {
|
|
91
|
+
return {
|
|
92
|
+
active: !1,
|
|
93
|
+
range: {
|
|
94
|
+
from: 0,
|
|
95
|
+
to: 0
|
|
96
|
+
},
|
|
97
|
+
query: null,
|
|
98
|
+
text: null,
|
|
99
|
+
composing: !1,
|
|
100
|
+
dismissedRange: null
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
apply(d, f, p, m) {
|
|
104
|
+
let { isEditable: h } = e, { composing: g } = e.view, { selection: _ } = d, { empty: v, from: y } = _, b = { ...f }, x = d.getMeta(u);
|
|
105
|
+
if (x && x.exit) return b.active = !1, b.decorationId = null, b.range = {
|
|
106
|
+
from: 0,
|
|
107
|
+
to: 0
|
|
108
|
+
}, b.query = null, b.text = null, b.dismissedRange = f.active ? { ...f.range } : f.dismissedRange, b;
|
|
109
|
+
if (b.composing = g, d.docChanged && b.dismissedRange !== null && (b.dismissedRange = {
|
|
110
|
+
from: d.mapping.map(b.dismissedRange.from),
|
|
111
|
+
to: d.mapping.map(b.dismissedRange.to)
|
|
112
|
+
}), h && (v || e.view.composing)) {
|
|
113
|
+
(y < f.range.from || y > f.range.to) && !g && !f.composing && (b.active = !1);
|
|
114
|
+
let u = o({
|
|
115
|
+
char: t,
|
|
116
|
+
allowSpaces: n,
|
|
117
|
+
allowToIncludeChar: r,
|
|
118
|
+
allowedPrefixes: i,
|
|
119
|
+
startOfLine: a,
|
|
120
|
+
$position: _.$from
|
|
121
|
+
}), p = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
122
|
+
u && s({
|
|
123
|
+
editor: e,
|
|
124
|
+
state: m,
|
|
125
|
+
range: u.range,
|
|
126
|
+
isActive: f.active
|
|
127
|
+
}) && (!c || c({
|
|
128
|
+
editor: e,
|
|
129
|
+
range: u.range,
|
|
130
|
+
query: u.query,
|
|
131
|
+
text: u.text,
|
|
132
|
+
transaction: d
|
|
133
|
+
})) ? (b.dismissedRange !== null && !l({
|
|
134
|
+
match: u,
|
|
135
|
+
dismissedRange: b.dismissedRange,
|
|
136
|
+
state: m,
|
|
137
|
+
transaction: d
|
|
138
|
+
}) && (b.dismissedRange = null), b.dismissedRange === null ? (b.active = !0, b.decorationId = f.decorationId || p, b.range = u.range, b.query = u.query, b.text = u.text) : b.active = !1) : (u || (b.dismissedRange = null), b.active = !1);
|
|
139
|
+
} else b.active = !1;
|
|
140
|
+
return b.active || (b.decorationId = null, b.range = {
|
|
141
|
+
from: 0,
|
|
142
|
+
to: 0
|
|
143
|
+
}, b.query = null, b.text = null), b;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function v({ editor: e, items: t }) {
|
|
148
|
+
let n = null, r = null, i = null, a = () => {
|
|
149
|
+
r !== null && (clearTimeout(r), r = null), i?.(), i = null;
|
|
150
|
+
}, o = (e) => new Promise((t) => {
|
|
151
|
+
i = t, r = setTimeout(() => {
|
|
152
|
+
r = null;
|
|
153
|
+
let e = i;
|
|
154
|
+
i = null, e?.();
|
|
155
|
+
}, e);
|
|
156
|
+
}), s = () => {
|
|
157
|
+
n?.abort(), a(), n = null;
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
abort: s,
|
|
161
|
+
fetch: async (r, i) => {
|
|
162
|
+
s(), n = new AbortController();
|
|
163
|
+
let a = n;
|
|
164
|
+
if (i > 0 && await o(i), n !== a || a.signal.aborted) return { status: "aborted" };
|
|
165
|
+
try {
|
|
166
|
+
let i = await t({
|
|
167
|
+
editor: e,
|
|
168
|
+
query: r,
|
|
169
|
+
signal: a.signal
|
|
170
|
+
});
|
|
171
|
+
return n !== a || a.signal.aborted ? { status: "aborted" } : {
|
|
172
|
+
status: "resolved",
|
|
173
|
+
items: i
|
|
174
|
+
};
|
|
175
|
+
} catch {
|
|
176
|
+
return n !== a || a.signal.aborted ? { status: "aborted" } : { status: "error" };
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function y({ placement: e, offset: t, flip: n, floatingUi: r }) {
|
|
182
|
+
let i = [s({
|
|
183
|
+
mainAxis: t.mainAxis ?? 4,
|
|
184
|
+
crossAxis: t.crossAxis ?? 0
|
|
185
|
+
})];
|
|
186
|
+
return n && i.push(o()), r?.middleware?.length && i.push(...r.middleware), {
|
|
187
|
+
placement: e,
|
|
188
|
+
strategy: r?.strategy ?? "absolute",
|
|
189
|
+
middleware: i
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function b(e) {
|
|
193
|
+
if (e instanceof HTMLElement) return e;
|
|
194
|
+
if (typeof e == "string") try {
|
|
195
|
+
let t = document.querySelector(e);
|
|
196
|
+
if (t) return t;
|
|
197
|
+
} catch {
|
|
198
|
+
return document.body;
|
|
199
|
+
}
|
|
200
|
+
return document.body;
|
|
201
|
+
}
|
|
202
|
+
function x({ getReferenceRect: e, contextElement: t, config: n, container: r, dismissOnOutsideClick: i, dismiss: a }) {
|
|
203
|
+
return (o, s = {}) => {
|
|
204
|
+
let u = {
|
|
205
|
+
getBoundingClientRect: () => e() ?? new DOMRect(),
|
|
206
|
+
contextElement: t
|
|
207
|
+
}, d = !1, f = !o.isConnected;
|
|
208
|
+
f && b(r).appendChild(o), s.onPosition || (o.style.visibility = "hidden", o.style.width = "max-content");
|
|
209
|
+
let p = l(u, o, () => {
|
|
210
|
+
c(u, o, {
|
|
211
|
+
placement: n.placement,
|
|
212
|
+
strategy: n.strategy,
|
|
213
|
+
middleware: n.middleware
|
|
214
|
+
}).then(({ x: e, y: t, placement: n, strategy: r }) => {
|
|
215
|
+
if (s.onPosition) {
|
|
216
|
+
s.onPosition({
|
|
217
|
+
x: e,
|
|
218
|
+
y: t,
|
|
219
|
+
placement: n,
|
|
220
|
+
strategy: r
|
|
221
|
+
});
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
Object.assign(o.style, {
|
|
225
|
+
position: r,
|
|
226
|
+
left: `${e}px`,
|
|
227
|
+
top: `${t}px`
|
|
228
|
+
}), d || (d = !0, o.style.visibility = "");
|
|
229
|
+
});
|
|
230
|
+
}, s.autoUpdate), m;
|
|
231
|
+
return i && (m = (e) => {
|
|
232
|
+
let n = e.target;
|
|
233
|
+
!(n instanceof Node) || o.contains(n) || t.contains(n) || a();
|
|
234
|
+
}, document.addEventListener("pointerdown", m, !0)), () => {
|
|
235
|
+
p(), m && document.removeEventListener("pointerdown", m, !0), f && o.remove();
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function S({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i, debounce: a, initialItems: o, placement: s, offset: c, container: l, flip: u, floatingUi: d, dismissOnOutsideClick: f, command: p, clientRectFor: m, dispatchExit: h }) {
|
|
240
|
+
let g, _ = v({
|
|
241
|
+
editor: e,
|
|
242
|
+
items: n
|
|
243
|
+
}), b = y({
|
|
244
|
+
placement: s,
|
|
245
|
+
offset: c,
|
|
246
|
+
flip: u,
|
|
247
|
+
floatingUi: d
|
|
248
|
+
});
|
|
249
|
+
function S(e, t) {
|
|
250
|
+
var n, i, a;
|
|
251
|
+
switch (e) {
|
|
252
|
+
case "started":
|
|
253
|
+
(n = r?.onStart) == null || n.call(r, t);
|
|
254
|
+
break;
|
|
255
|
+
case "updated":
|
|
256
|
+
(i = r?.onUpdate) == null || i.call(r, t);
|
|
257
|
+
break;
|
|
258
|
+
case "stopped":
|
|
259
|
+
(a = r?.onExit) == null || a.call(r, t);
|
|
260
|
+
break;
|
|
261
|
+
default: break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
update: async (n, d) => {
|
|
266
|
+
var v, y;
|
|
267
|
+
let C = t.getState(d), w = t.getState(n.state);
|
|
268
|
+
if (!C || !w) return;
|
|
269
|
+
let T = null, E = C.query !== w.query, D = C.text !== w.text, O = C.range.from !== w.range.from || C.range.to !== w.range.to, k = E || D || O;
|
|
270
|
+
if (!C.active && w.active) T = "started";
|
|
271
|
+
else if (C.active && !w.active) T = "stopped";
|
|
272
|
+
else if (w.active && k) T = "updated";
|
|
273
|
+
else return;
|
|
274
|
+
let A = T === "stopped" ? C : w, j = n.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`), M = m(n, j), N = i === 0 || (A.query ? A.query.length >= i : !1), P = (T === "started" || T === "updated") && N;
|
|
275
|
+
if (g = {
|
|
276
|
+
editor: e,
|
|
277
|
+
range: A.range,
|
|
278
|
+
query: A.query || "",
|
|
279
|
+
text: A.text || "",
|
|
280
|
+
items: o ?? [],
|
|
281
|
+
command: (t) => p({
|
|
282
|
+
editor: e,
|
|
283
|
+
range: A.range,
|
|
284
|
+
props: t
|
|
285
|
+
}),
|
|
286
|
+
decorationNode: j,
|
|
287
|
+
clientRect: M,
|
|
288
|
+
loading: P,
|
|
289
|
+
placement: s,
|
|
290
|
+
offset: {
|
|
291
|
+
mainAxis: c.mainAxis ?? 4,
|
|
292
|
+
crossAxis: c.crossAxis ?? 0
|
|
293
|
+
},
|
|
294
|
+
container: l,
|
|
295
|
+
flip: u,
|
|
296
|
+
floatingUi: b,
|
|
297
|
+
mount: x({
|
|
298
|
+
getReferenceRect: M,
|
|
299
|
+
contextElement: n.dom,
|
|
300
|
+
config: b,
|
|
301
|
+
container: l,
|
|
302
|
+
dismissOnOutsideClick: f,
|
|
303
|
+
dismiss: () => h(e.view)
|
|
304
|
+
})
|
|
305
|
+
}, 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") if (!P) _.abort(), g = {
|
|
306
|
+
...g,
|
|
307
|
+
items: o ?? [],
|
|
308
|
+
loading: !1
|
|
309
|
+
};
|
|
310
|
+
else {
|
|
311
|
+
g = {
|
|
312
|
+
...g,
|
|
313
|
+
items: o ?? [],
|
|
314
|
+
loading: !0
|
|
315
|
+
}, T = "updated", S(T, g);
|
|
316
|
+
let e = await _.fetch(A.query || "", a);
|
|
317
|
+
if (e.status === "aborted") return;
|
|
318
|
+
if (!t.getState(n.state)?.active) {
|
|
319
|
+
_.abort();
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
g = e.status === "resolved" ? {
|
|
323
|
+
...g,
|
|
324
|
+
items: e.items,
|
|
325
|
+
loading: !1
|
|
326
|
+
} : {
|
|
327
|
+
...g,
|
|
328
|
+
loading: !1
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
if (T === "stopped") {
|
|
332
|
+
_.abort(), S(T, g), g = void 0;
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
T === "updated" && S(T, g);
|
|
336
|
+
},
|
|
337
|
+
destroy: () => {
|
|
338
|
+
var e;
|
|
339
|
+
_.abort(), g && ((e = r?.onExit) == null || e.call(r, g));
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
var C = new e("suggestion");
|
|
344
|
+
function w({ pluginKey: e = C, editor: n, char: r = "@", allowSpaces: i = !1, allowToIncludeChar: a = !1, allowedPrefixes: o = [" "], startOfLine: s = !1, decorationTag: c = "span", decorationClass: l = "suggestion", decorationContent: d = "", decorationEmptyClass: f = "is-empty", command: v = () => null, items: y = () => [], minQueryLength: b = 0, debounce: x = 0, initialItems: w, placement: T = "bottom-start", offset: E = {}, container: D, flip: O = !0, floatingUi: k, dismissOnOutsideClick: A = !0, render: j = () => ({}), allow: M = () => !0, findSuggestionMatch: N = u, shouldShow: P, shouldResetDismissed: F }) {
|
|
345
|
+
let I = j?.(), L = i && !a, R = (t, r) => p(n, t, r, e);
|
|
346
|
+
function z(e) {
|
|
347
|
+
return m({
|
|
348
|
+
...e,
|
|
349
|
+
editor: n,
|
|
350
|
+
shouldResetDismissed: F,
|
|
351
|
+
effectiveAllowSpaces: L
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
let B = (t) => h({
|
|
355
|
+
view: t,
|
|
356
|
+
pluginKeyRef: e
|
|
357
|
+
});
|
|
358
|
+
return new t({
|
|
359
|
+
key: e,
|
|
360
|
+
view: () => S({
|
|
361
|
+
editor: n,
|
|
362
|
+
pluginKey: e,
|
|
363
|
+
items: y,
|
|
364
|
+
renderer: I,
|
|
365
|
+
minQueryLength: b,
|
|
366
|
+
debounce: x,
|
|
367
|
+
initialItems: w,
|
|
368
|
+
placement: T,
|
|
369
|
+
offset: E,
|
|
370
|
+
container: D,
|
|
371
|
+
flip: O,
|
|
372
|
+
floatingUi: k,
|
|
373
|
+
dismissOnOutsideClick: A,
|
|
374
|
+
command: v,
|
|
375
|
+
clientRectFor: R,
|
|
376
|
+
dispatchExit: B
|
|
377
|
+
}),
|
|
378
|
+
state: _({
|
|
379
|
+
editor: n,
|
|
380
|
+
char: r,
|
|
381
|
+
effectiveAllowSpaces: L,
|
|
382
|
+
allowToIncludeChar: a,
|
|
383
|
+
allowedPrefixes: o,
|
|
384
|
+
startOfLine: s,
|
|
385
|
+
findSuggestionMatch: N,
|
|
386
|
+
allow: M,
|
|
387
|
+
shouldShow: P,
|
|
388
|
+
shouldKeepDismissed: z,
|
|
389
|
+
pluginKey: e
|
|
390
|
+
}),
|
|
391
|
+
props: g({
|
|
392
|
+
pluginKey: e,
|
|
393
|
+
decorationTag: c,
|
|
394
|
+
decorationClass: l,
|
|
395
|
+
decorationContent: d,
|
|
396
|
+
decorationEmptyClass: f,
|
|
397
|
+
renderer: I,
|
|
398
|
+
dispatchExit: B
|
|
399
|
+
})
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
var T = w, E = new e("slashSuggestion"), D = a.create({
|
|
403
|
+
name: "slashCommand",
|
|
404
|
+
addOptions() {
|
|
405
|
+
return {
|
|
406
|
+
...this.parent?.(),
|
|
407
|
+
slashSuggestion: {
|
|
408
|
+
char: "/",
|
|
409
|
+
startOfLine: !0,
|
|
410
|
+
command: ({ editor: e, range: t, props: n }) => {
|
|
411
|
+
n.command({
|
|
412
|
+
editor: e,
|
|
413
|
+
range: t,
|
|
414
|
+
props: n
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
},
|
|
420
|
+
addProseMirrorPlugins() {
|
|
421
|
+
return [T({
|
|
422
|
+
pluginKey: E,
|
|
423
|
+
...this.options.slashSuggestion,
|
|
424
|
+
editor: this.editor
|
|
425
|
+
})];
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
//#endregion
|
|
429
|
+
export { E as n, w as r, D as t };
|