@clevertask/scribe 0.0.12 → 0.0.13
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 +80 -4
- package/dist/components/Menu/BarMenu.js +21 -21
- package/dist/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +35 -38
- package/dist/components/Scribe/extension/emoji/suggest.js +5 -6
- package/dist/components/Scribe/extension/extension-link.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +4 -4
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/items.js +6 -7
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +10 -11
- package/dist/components/Scribe/index.js +78 -79
- package/dist/index-BfaHEr44.js +159 -0
- package/dist/{index-VneQGVTd.js → index-Bvgjhwaj.js} +11 -47
- package/dist/{index-CCS9HOYd.js → index-CWvaDN_2.js} +21 -29
- package/dist/{index-DoNRu1rY.js → index-flsxByQS.js} +17 -17
- package/dist/main.js +8 -6
- package/dist/marked.esm-H7n4rMcO.js +1554 -0
- package/dist/{purify.es-BGaRrCfO.js → purify.es-DcWaZU6I.js} +0 -1
- package/dist/utils/convert-legacy-math-delimiters.d.ts +1 -0
- package/dist/utils/convert-legacy-math-delimiters.js +13 -0
- package/dist/utils/create-scribe-editor.js +3 -3
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +8 -6
- package/dist/utils/markdown-to-html.js +2 -2
- package/package.json +46 -43
- package/dist/index-B0pieAxt.js +0 -160
- package/dist/marked.esm-BS_MmRZC.js +0 -1566
|
@@ -1,111 +1,110 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { c as
|
|
4
|
-
import { html2md as
|
|
5
|
-
import "../../marked.esm-
|
|
6
|
-
import "../../purify.es-
|
|
7
|
-
import { E as
|
|
8
|
-
import { initExtensions as
|
|
9
|
-
import { E as
|
|
10
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as n, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import O from "../Menu/BarMenu.js";
|
|
3
|
+
import { c as l } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { html2md as b } from "../../utils/html-to-markdown.js";
|
|
5
|
+
import "../../marked.esm-H7n4rMcO.js";
|
|
6
|
+
import "../../purify.es-DcWaZU6I.js";
|
|
7
|
+
import { E as R } from "../../index-flsxByQS.js";
|
|
8
|
+
import { initExtensions as T } from "./extension/index.js";
|
|
9
|
+
import { E as z } from "../../index-Bvgjhwaj.js";
|
|
10
|
+
import { forwardRef as J, useRef as D, useCallback as s, useImperativeHandle as F, useEffect as i } from "react";
|
|
11
11
|
import { ListOptionBar as I } from "../Menu/Mobile/ListOptionBar.js";
|
|
12
|
-
import '../../assets/index.css';const _ =
|
|
12
|
+
import '../../assets/index.css';const _ = J((p, g) => {
|
|
13
13
|
const {
|
|
14
|
-
autoFocus:
|
|
15
|
-
content:
|
|
16
|
-
editable:
|
|
17
|
-
editorProps:
|
|
18
|
-
extensions:
|
|
19
|
-
onContentChange:
|
|
20
|
-
showBarMenu:
|
|
21
|
-
editorContentStyle:
|
|
22
|
-
editorContentClassName:
|
|
23
|
-
mainContainerStyle:
|
|
24
|
-
mainContainerClassName:
|
|
25
|
-
onKeyDown:
|
|
26
|
-
externalEditor:
|
|
27
|
-
darkMode:
|
|
28
|
-
mobile:
|
|
29
|
-
} =
|
|
30
|
-
({ editor:
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
jsonContent:
|
|
34
|
-
htmlContent:
|
|
35
|
-
markdownContent:
|
|
14
|
+
autoFocus: u = !1,
|
|
15
|
+
content: f,
|
|
16
|
+
editable: o = !0,
|
|
17
|
+
editorProps: C,
|
|
18
|
+
extensions: x,
|
|
19
|
+
onContentChange: m,
|
|
20
|
+
showBarMenu: h = !0,
|
|
21
|
+
editorContentStyle: w,
|
|
22
|
+
editorContentClassName: y,
|
|
23
|
+
mainContainerStyle: M,
|
|
24
|
+
mainContainerClassName: N,
|
|
25
|
+
onKeyDown: j,
|
|
26
|
+
externalEditor: k,
|
|
27
|
+
darkMode: a,
|
|
28
|
+
mobile: v
|
|
29
|
+
} = p, c = D(k || null), d = s(
|
|
30
|
+
({ editor: e }) => {
|
|
31
|
+
const r = e.getHTML(), H = e.getJSON(), L = !o;
|
|
32
|
+
m && m({
|
|
33
|
+
jsonContent: e.isEmpty ? "" : H,
|
|
34
|
+
htmlContent: e.isEmpty ? "" : r,
|
|
35
|
+
markdownContent: e.isEmpty ? "" : b(r),
|
|
36
36
|
source: L ? "programmatic" : "user"
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
[
|
|
39
|
+
[o, m]
|
|
40
40
|
);
|
|
41
|
-
|
|
42
|
-
...
|
|
43
|
-
editable:
|
|
44
|
-
extensions: [...
|
|
41
|
+
c.current || (c.current = new R({
|
|
42
|
+
...C,
|
|
43
|
+
editable: o,
|
|
44
|
+
extensions: [...T(p), ...x ?? []],
|
|
45
45
|
editorProps: {
|
|
46
46
|
attributes: {
|
|
47
47
|
class: "scribe"
|
|
48
48
|
},
|
|
49
|
-
...
|
|
49
|
+
...C?.editorProps
|
|
50
50
|
}
|
|
51
51
|
}));
|
|
52
|
-
const t =
|
|
53
|
-
t
|
|
54
|
-
}, []),
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
markdown: () => g((t == null ? void 0 : t.getHTML()) || "")
|
|
52
|
+
const t = c.current, E = s(() => {
|
|
53
|
+
t?.commands.setContent("");
|
|
54
|
+
}, []), S = s(
|
|
55
|
+
(e) => {
|
|
56
|
+
const r = {
|
|
57
|
+
html: () => t?.getHTML(),
|
|
58
|
+
json: () => t?.getJSON(),
|
|
59
|
+
markdown: () => b(t?.getHTML() || "")
|
|
61
60
|
};
|
|
62
|
-
return t
|
|
61
|
+
return t?.isEmpty ? "" : r[e]?.();
|
|
63
62
|
},
|
|
64
63
|
[]
|
|
65
|
-
),
|
|
66
|
-
t
|
|
64
|
+
), B = s((e) => {
|
|
65
|
+
t?.commands.setContent(e);
|
|
67
66
|
}, []);
|
|
68
|
-
return F(
|
|
69
|
-
resetContent:
|
|
70
|
-
setContent:
|
|
71
|
-
getContent:
|
|
67
|
+
return F(g, () => ({
|
|
68
|
+
resetContent: E,
|
|
69
|
+
setContent: B,
|
|
70
|
+
getContent: S,
|
|
72
71
|
editor: t
|
|
73
|
-
}), [
|
|
74
|
-
t
|
|
75
|
-
}, [
|
|
76
|
-
t
|
|
77
|
-
}, [
|
|
78
|
-
t.off("update",
|
|
79
|
-
}), [
|
|
80
|
-
|
|
81
|
-
}, [
|
|
72
|
+
}), [E]), i(() => {
|
|
73
|
+
t?.commands.setContent(f || "");
|
|
74
|
+
}, [f]), i(() => {
|
|
75
|
+
t?.setEditable(!!o);
|
|
76
|
+
}, [o]), i(() => (t.off("update"), t.on("update", d), () => {
|
|
77
|
+
t.off("update", d);
|
|
78
|
+
}), [d]), i(() => {
|
|
79
|
+
u && t?.commands.focus("end");
|
|
80
|
+
}, [u]), /* @__PURE__ */ n(
|
|
82
81
|
"div",
|
|
83
82
|
{
|
|
84
|
-
className:
|
|
85
|
-
style:
|
|
86
|
-
children: /* @__PURE__ */
|
|
83
|
+
className: l("scribe-wrapper", N),
|
|
84
|
+
style: M,
|
|
85
|
+
children: /* @__PURE__ */ P(
|
|
87
86
|
"div",
|
|
88
87
|
{
|
|
89
|
-
className:
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
className: l(
|
|
89
|
+
o && "rounded-lg border",
|
|
90
|
+
a ? "border-zinc-700" : "border-zinc-200"
|
|
92
91
|
),
|
|
93
92
|
children: [
|
|
94
|
-
t &&
|
|
95
|
-
/* @__PURE__ */
|
|
93
|
+
t && h && /* @__PURE__ */ n(O, { editor: t, darkMode: !!a }),
|
|
94
|
+
/* @__PURE__ */ n(
|
|
96
95
|
"div",
|
|
97
96
|
{
|
|
98
|
-
className:
|
|
97
|
+
className: l(
|
|
99
98
|
"prose max-w-none",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
o && "w-full p-[16px]",
|
|
100
|
+
a && "prose-invert",
|
|
101
|
+
y
|
|
103
102
|
),
|
|
104
|
-
style:
|
|
105
|
-
children: /* @__PURE__ */
|
|
103
|
+
style: w,
|
|
104
|
+
children: /* @__PURE__ */ n(z, { editor: t, onKeyDown: j })
|
|
106
105
|
}
|
|
107
106
|
),
|
|
108
|
-
|
|
107
|
+
v && /* @__PURE__ */ n(I, { editor: t })
|
|
109
108
|
]
|
|
110
109
|
}
|
|
111
110
|
)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { P as L, b as U, D as z, c as G, e as H, a as J } from "./index-flsxByQS.js";
|
|
2
|
+
function Q(y) {
|
|
3
|
+
var i;
|
|
4
|
+
const { char: f, allowSpaces: D, allowToIncludeChar: I, allowedPrefixes: v, startOfLine: K, $position: g } = y, P = D && !I, m = H(f), B = new RegExp(`\\s${m}$`), C = K ? "^" : "", M = I ? "" : m, S = P ? new RegExp(`${C}${m}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${C}(?:^)?${m}[^\\s${M}]*`, "gm"), p = ((i = g.nodeBefore) === null || i === void 0 ? void 0 : i.isText) && g.nodeBefore.text;
|
|
5
|
+
if (!p)
|
|
6
|
+
return null;
|
|
7
|
+
const k = g.pos - p.length, n = Array.from(p.matchAll(S)).pop();
|
|
8
|
+
if (!n || n.input === void 0 || n.index === void 0)
|
|
9
|
+
return null;
|
|
10
|
+
const e = n.input.slice(Math.max(0, n.index - 1), n.index), $ = new RegExp(`^[${v?.join("")}\0]?$`).test(e);
|
|
11
|
+
if (v !== null && !$)
|
|
12
|
+
return null;
|
|
13
|
+
const o = k + n.index;
|
|
14
|
+
let a = o + n[0].length;
|
|
15
|
+
return P && B.test(p.slice(a - 1, a + 1)) && (n[0] += " ", a += 1), o < g.pos && a >= g.pos ? {
|
|
16
|
+
range: {
|
|
17
|
+
from: o,
|
|
18
|
+
to: a
|
|
19
|
+
},
|
|
20
|
+
query: n[0].slice(f.length),
|
|
21
|
+
text: n[0]
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
const V = new L("suggestion");
|
|
25
|
+
function W({ pluginKey: y = V, editor: i, char: f = "@", allowSpaces: D = !1, allowToIncludeChar: I = !1, allowedPrefixes: v = [" "], startOfLine: K = !1, decorationTag: g = "span", decorationClass: P = "suggestion", decorationContent: m = "", decorationEmptyClass: B = "is-empty", command: C = () => null, items: M = () => [], render: S = () => ({}), allow: p = () => !0, findSuggestionMatch: k = Q }) {
|
|
26
|
+
let n;
|
|
27
|
+
const e = S?.(), $ = new U({
|
|
28
|
+
key: y,
|
|
29
|
+
view() {
|
|
30
|
+
return {
|
|
31
|
+
update: async (o, a) => {
|
|
32
|
+
var l, c, r, u, d, w, h;
|
|
33
|
+
const t = (l = this.key) === null || l === void 0 ? void 0 : l.getState(a), s = (c = this.key) === null || c === void 0 ? void 0 : c.getState(o.state), q = t.active && s.active && t.range.from !== s.range.from, b = !t.active && s.active, j = t.active && !s.active, A = !b && !j && t.query !== s.query, _ = b || q && A, R = A || q, N = j || q && A;
|
|
34
|
+
if (!_ && !R && !N)
|
|
35
|
+
return;
|
|
36
|
+
const x = N && !_ ? t : s, F = o.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);
|
|
37
|
+
n = {
|
|
38
|
+
editor: i,
|
|
39
|
+
range: x.range,
|
|
40
|
+
query: x.query,
|
|
41
|
+
text: x.text,
|
|
42
|
+
items: [],
|
|
43
|
+
command: (E) => C({
|
|
44
|
+
editor: i,
|
|
45
|
+
range: x.range,
|
|
46
|
+
props: E
|
|
47
|
+
}),
|
|
48
|
+
decorationNode: F,
|
|
49
|
+
// virtual node for popper.js or tippy.js
|
|
50
|
+
// this can be used for building popups without a DOM node
|
|
51
|
+
clientRect: F ? () => {
|
|
52
|
+
var E;
|
|
53
|
+
const { decorationId: T } = (E = this.key) === null || E === void 0 ? void 0 : E.getState(i.state), O = o.dom.querySelector(`[data-decoration-id="${T}"]`);
|
|
54
|
+
return O?.getBoundingClientRect() || null;
|
|
55
|
+
} : null
|
|
56
|
+
}, _ && ((r = e?.onBeforeStart) === null || r === void 0 || r.call(e, n)), R && ((u = e?.onBeforeUpdate) === null || u === void 0 || u.call(e, n)), (R || _) && (n.items = await M({
|
|
57
|
+
editor: i,
|
|
58
|
+
query: x.query
|
|
59
|
+
})), N && ((d = e?.onExit) === null || d === void 0 || d.call(e, n)), R && ((w = e?.onUpdate) === null || w === void 0 || w.call(e, n)), _ && ((h = e?.onStart) === null || h === void 0 || h.call(e, n));
|
|
60
|
+
},
|
|
61
|
+
destroy: () => {
|
|
62
|
+
var o;
|
|
63
|
+
n && ((o = e?.onExit) === null || o === void 0 || o.call(e, n));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
state: {
|
|
68
|
+
// Initialize the plugin's internal state.
|
|
69
|
+
init() {
|
|
70
|
+
return {
|
|
71
|
+
active: !1,
|
|
72
|
+
range: {
|
|
73
|
+
from: 0,
|
|
74
|
+
to: 0
|
|
75
|
+
},
|
|
76
|
+
query: null,
|
|
77
|
+
text: null,
|
|
78
|
+
composing: !1
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
// Apply changes to the plugin state from a view transaction.
|
|
82
|
+
apply(o, a, l, c) {
|
|
83
|
+
const { isEditable: r } = i, { composing: u } = i.view, { selection: d } = o, { empty: w, from: h } = d, t = { ...a };
|
|
84
|
+
if (t.composing = u, r && (w || i.view.composing)) {
|
|
85
|
+
(h < a.range.from || h > a.range.to) && !u && !a.composing && (t.active = !1);
|
|
86
|
+
const s = k({
|
|
87
|
+
char: f,
|
|
88
|
+
allowSpaces: D,
|
|
89
|
+
allowToIncludeChar: I,
|
|
90
|
+
allowedPrefixes: v,
|
|
91
|
+
startOfLine: K,
|
|
92
|
+
$position: d.$from
|
|
93
|
+
}), q = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
94
|
+
s && p({
|
|
95
|
+
editor: i,
|
|
96
|
+
state: c,
|
|
97
|
+
range: s.range,
|
|
98
|
+
isActive: a.active
|
|
99
|
+
}) ? (t.active = !0, t.decorationId = a.decorationId ? a.decorationId : q, t.range = s.range, t.query = s.query, t.text = s.text) : t.active = !1;
|
|
100
|
+
} else
|
|
101
|
+
t.active = !1;
|
|
102
|
+
return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
props: {
|
|
106
|
+
// Call the keydown hook if suggestion is active.
|
|
107
|
+
handleKeyDown(o, a) {
|
|
108
|
+
var l;
|
|
109
|
+
const { active: c, range: r } = $.getState(o.state);
|
|
110
|
+
return c && ((l = e?.onKeyDown) === null || l === void 0 ? void 0 : l.call(e, { view: o, event: a, range: r })) || !1;
|
|
111
|
+
},
|
|
112
|
+
// Setup decorator on the currently active suggestion.
|
|
113
|
+
decorations(o) {
|
|
114
|
+
const { active: a, range: l, decorationId: c, query: r } = $.getState(o);
|
|
115
|
+
if (!a)
|
|
116
|
+
return null;
|
|
117
|
+
const u = !r?.length, d = [P];
|
|
118
|
+
return u && d.push(B), z.create(o.doc, [
|
|
119
|
+
G.inline(l.from, l.to, {
|
|
120
|
+
nodeName: g,
|
|
121
|
+
class: d.join(" "),
|
|
122
|
+
"data-decoration-id": c,
|
|
123
|
+
"data-decoration-content": m
|
|
124
|
+
})
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return $;
|
|
130
|
+
}
|
|
131
|
+
const X = new L("slashSuggestion"), Z = J.create({
|
|
132
|
+
name: "slashCommand",
|
|
133
|
+
addOptions() {
|
|
134
|
+
return {
|
|
135
|
+
...this.parent?.(),
|
|
136
|
+
slashSuggestion: {
|
|
137
|
+
char: "/",
|
|
138
|
+
startOfLine: !0,
|
|
139
|
+
command: ({ editor: y, range: i, props: f }) => {
|
|
140
|
+
f.command({ editor: y, range: i, props: f });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
addProseMirrorPlugins() {
|
|
146
|
+
return [
|
|
147
|
+
W({
|
|
148
|
+
pluginKey: X,
|
|
149
|
+
...this.options.slashSuggestion,
|
|
150
|
+
editor: this.editor
|
|
151
|
+
})
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export {
|
|
156
|
+
Z as S,
|
|
157
|
+
W as a,
|
|
158
|
+
X as s
|
|
159
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as Wr, P as kr, H as Fr, A as Ur, J as qr, a as zr } from "./index-
|
|
1
|
+
import { b as Wr, P as kr, H as Fr, A as Ur, J as qr, a as zr } from "./index-flsxByQS.js";
|
|
2
2
|
import B, { forwardRef as Kr, useState as ur, useDebugValue as Gr, version as Pt, useLayoutEffect as Yr, useEffect as cr, useContext as fr, createContext as lr } from "react";
|
|
3
3
|
import Xr, { flushSync as Jr } from "react-dom";
|
|
4
4
|
var k = "top", G = "bottom", Y = "right", F = "left", Dt = "auto", Fe = [k, G, Y, F], De = "start", Ie = "end", Qr = "clippingParents", pr = "viewport", je = "popper", Zr = "reference", Bt = /* @__PURE__ */ Fe.reduce(function(e, t) {
|
|
@@ -692,11 +692,11 @@ function qn(e) {
|
|
|
692
692
|
var V, H = i === "y" ? k : F, $ = i === "y" ? G : Y, j = i === "y" ? "height" : "width", P = p[i], I = P + w[H], J = P - w[$], Q = h ? -_[j] / 2 : 0, pe = D === De ? x[j] : _[j], Z = D === De ? -_[j] : -x[j], de = t.elements.arrow, ne = h && de ? Ct(de) : {
|
|
693
693
|
width: 0,
|
|
694
694
|
height: 0
|
|
695
|
-
}, X = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : yr(), ie = X[H], be = X[$], oe = Pe(0, x[j], ne[j]), we = O ? x[j] / 2 - Q - oe - ie - R.mainAxis : pe - oe - ie - R.mainAxis, ce = O ? -x[j] / 2 + Q + oe + be + R.mainAxis : Z + oe + be + R.mainAxis, Oe = t.elements.arrow && Ue(t.elements.arrow), ze = Oe ? i === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Le = (V = N
|
|
695
|
+
}, X = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : yr(), ie = X[H], be = X[$], oe = Pe(0, x[j], ne[j]), we = O ? x[j] / 2 - Q - oe - ie - R.mainAxis : pe - oe - ie - R.mainAxis, ce = O ? -x[j] / 2 + Q + oe + be + R.mainAxis : Z + oe + be + R.mainAxis, Oe = t.elements.arrow && Ue(t.elements.arrow), ze = Oe ? i === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Le = (V = N?.[i]) != null ? V : 0, Ke = P + we - Le - ze, Ge = P + ce - Le, Re = Pe(h ? at(I, Ke) : I, P, h ? ye(J, Ge) : J);
|
|
696
696
|
p[i] = Re, M[i] = Re - P;
|
|
697
697
|
}
|
|
698
698
|
if (u) {
|
|
699
|
-
var Me, Ye = i === "x" ? k : F, Xe = i === "x" ? G : Y, ae = p[E], fe = E === "y" ? "height" : "width", Ve = ae + w[Ye], ve = ae - w[Xe], Ne = [k, F].indexOf(T) !== -1, Je = (Me = N
|
|
699
|
+
var Me, Ye = i === "x" ? k : F, Xe = i === "x" ? G : Y, ae = p[E], fe = E === "y" ? "height" : "width", Ve = ae + w[Ye], ve = ae - w[Xe], Ne = [k, F].indexOf(T) !== -1, Je = (Me = N?.[E]) != null ? Me : 0, Qe = Ne ? Ve : ae - x[fe] - _[fe] - Je + R.altAxis, Ze = Ne ? ae + x[fe] + _[fe] - Je - R.altAxis : ve, et = h && Ne ? hn(Qe, ae, Ze) : Pe(h ? Qe : Ve, ae, h ? Ze : ve);
|
|
700
700
|
p[E] = et, M[E] = et - ae;
|
|
701
701
|
}
|
|
702
702
|
t.modifiersData[n] = M;
|
|
@@ -1547,7 +1547,7 @@ function Ri(e, t) {
|
|
|
1547
1547
|
element: z,
|
|
1548
1548
|
padding: 3
|
|
1549
1549
|
}
|
|
1550
|
-
}), he.push.apply(he,
|
|
1550
|
+
}), he.push.apply(he, g?.modifiers || []), i.popperInstance = ni(Ee, p, Object.assign({}, g, {
|
|
1551
1551
|
placement: S,
|
|
1552
1552
|
onFirstUpdate: y,
|
|
1553
1553
|
modifiers: he
|
|
@@ -1726,11 +1726,11 @@ class Mi {
|
|
|
1726
1726
|
this.preventHide = !1;
|
|
1727
1727
|
return;
|
|
1728
1728
|
}
|
|
1729
|
-
u
|
|
1729
|
+
u?.relatedTarget && (!((s = this.element.parentNode) === null || s === void 0) && s.contains(u.relatedTarget)) || u?.relatedTarget !== this.editor.view.dom && this.hide();
|
|
1730
1730
|
}, this.tippyBlurHandler = (u) => {
|
|
1731
1731
|
this.blurHandler({ event: u });
|
|
1732
1732
|
}, this.handleDebouncedUpdate = (u, s) => {
|
|
1733
|
-
const d = !
|
|
1733
|
+
const d = !s?.selection.eq(u.state.selection), l = !s?.doc.eq(u.state.doc);
|
|
1734
1734
|
!d && !l || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
1735
1735
|
this.updateHandler(u, d, l, s);
|
|
1736
1736
|
}, this.updateDelay));
|
|
@@ -1787,7 +1787,7 @@ class Mi {
|
|
|
1787
1787
|
this.handleDebouncedUpdate(t, r);
|
|
1788
1788
|
return;
|
|
1789
1789
|
}
|
|
1790
|
-
const a = !
|
|
1790
|
+
const a = !r?.selection.eq(t.state.selection), c = !r?.doc.eq(t.state.doc);
|
|
1791
1791
|
this.updateHandler(t, a, c, r);
|
|
1792
1792
|
}
|
|
1793
1793
|
show() {
|
|
@@ -1835,15 +1835,6 @@ function Vi(e) {
|
|
|
1835
1835
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1836
1836
|
}
|
|
1837
1837
|
var xt = { exports: {} }, ht = {};
|
|
1838
|
-
/**
|
|
1839
|
-
* @license React
|
|
1840
|
-
* use-sync-external-store-shim.production.min.js
|
|
1841
|
-
*
|
|
1842
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1843
|
-
*
|
|
1844
|
-
* This source code is licensed under the MIT license found in the
|
|
1845
|
-
* LICENSE file in the root directory of this source tree.
|
|
1846
|
-
*/
|
|
1847
1838
|
var rr;
|
|
1848
1839
|
function Ni() {
|
|
1849
1840
|
if (rr) return ht;
|
|
@@ -1880,15 +1871,6 @@ function Ni() {
|
|
|
1880
1871
|
return ht.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : l, ht;
|
|
1881
1872
|
}
|
|
1882
1873
|
var mt = {};
|
|
1883
|
-
/**
|
|
1884
|
-
* @license React
|
|
1885
|
-
* use-sync-external-store-shim.development.js
|
|
1886
|
-
*
|
|
1887
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1888
|
-
*
|
|
1889
|
-
* This source code is licensed under the MIT license found in the
|
|
1890
|
-
* LICENSE file in the root directory of this source tree.
|
|
1891
|
-
*/
|
|
1892
1874
|
var nr;
|
|
1893
1875
|
function ji() {
|
|
1894
1876
|
return nr || (nr = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
@@ -2051,7 +2033,7 @@ class Ii extends B.Component {
|
|
|
2051
2033
|
B.Fragment,
|
|
2052
2034
|
null,
|
|
2053
2035
|
B.createElement("div", { ref: Pi(r, this.editorContentRef), ...n }),
|
|
2054
|
-
|
|
2036
|
+
t?.contentComponent && B.createElement(Bi, { contentComponent: t.contentComponent })
|
|
2055
2037
|
);
|
|
2056
2038
|
}
|
|
2057
2039
|
}
|
|
@@ -2109,15 +2091,6 @@ var Wi = function e(t, r) {
|
|
|
2109
2091
|
}
|
|
2110
2092
|
return t !== t && r !== r;
|
|
2111
2093
|
}, ki = /* @__PURE__ */ Vi(Wi), Tt = { exports: {} }, yt = {};
|
|
2112
|
-
/**
|
|
2113
|
-
* @license React
|
|
2114
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
2115
|
-
*
|
|
2116
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2117
|
-
*
|
|
2118
|
-
* This source code is licensed under the MIT license found in the
|
|
2119
|
-
* LICENSE file in the root directory of this source tree.
|
|
2120
|
-
*/
|
|
2121
2094
|
var ir;
|
|
2122
2095
|
function Fi() {
|
|
2123
2096
|
if (ir) return yt;
|
|
@@ -2160,15 +2133,6 @@ function Fi() {
|
|
|
2160
2133
|
}, yt;
|
|
2161
2134
|
}
|
|
2162
2135
|
var gt = {};
|
|
2163
|
-
/**
|
|
2164
|
-
* @license React
|
|
2165
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
2166
|
-
*
|
|
2167
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2168
|
-
*
|
|
2169
|
-
* This source code is licensed under the MIT license found in the
|
|
2170
|
-
* LICENSE file in the root directory of this source tree.
|
|
2171
|
-
*/
|
|
2172
2136
|
var or;
|
|
2173
2137
|
function Ui() {
|
|
2174
2138
|
return or || (or = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
@@ -2270,7 +2234,7 @@ const Gi = () => fr(Nr), oo = (e) => {
|
|
|
2270
2234
|
const [t, r] = ur(null), { editor: n } = Gi();
|
|
2271
2235
|
return cr(() => {
|
|
2272
2236
|
var o;
|
|
2273
|
-
if (!t || !((o = e.editor) === null || o === void 0) && o.isDestroyed || n
|
|
2237
|
+
if (!t || !((o = e.editor) === null || o === void 0) && o.isDestroyed || n?.isDestroyed)
|
|
2274
2238
|
return;
|
|
2275
2239
|
const { pluginKey: a = "bubbleMenu", editor: c, tippyOptions: u = {}, updateDelay: s, shouldShow: d = null } = e, l = c || n;
|
|
2276
2240
|
if (!l) {
|
|
@@ -2348,7 +2312,7 @@ class ao {
|
|
|
2348
2312
|
const r = this.component, n = this.props, o = this.editor, a = Zi(), c = Qi(r), u = { ...n };
|
|
2349
2313
|
u.ref && !(a || c) && delete u.ref, !u.ref && (a || c) && (u.ref = (s) => {
|
|
2350
2314
|
this.ref = s;
|
|
2351
|
-
}), this.reactElement = B.createElement(r, { ...u }), (t = o
|
|
2315
|
+
}), this.reactElement = B.createElement(r, { ...u }), (t = o?.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
|
|
2352
2316
|
}
|
|
2353
2317
|
/**
|
|
2354
2318
|
* Re-renders the React component with new props.
|
|
@@ -2365,7 +2329,7 @@ class ao {
|
|
|
2365
2329
|
destroy() {
|
|
2366
2330
|
var t;
|
|
2367
2331
|
const r = this.editor;
|
|
2368
|
-
(t = r
|
|
2332
|
+
(t = r?.contentComponent) === null || t === void 0 || t.removeRenderer(this.id);
|
|
2369
2333
|
}
|
|
2370
2334
|
/**
|
|
2371
2335
|
* Update the attributes of the element that holds the React component.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as Cs, jsxs as dc } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as dv, useState as uv, useImperativeHandle as gv } from "react";
|
|
3
|
-
import "./purify.es-
|
|
3
|
+
import "./purify.es-DcWaZU6I.js";
|
|
4
4
|
import "./turndown.browser.es-RmA_HBaI.js";
|
|
5
|
-
import "./marked.esm-
|
|
5
|
+
import "./marked.esm-H7n4rMcO.js";
|
|
6
6
|
import { isInViewport as uc } from "./utils/is-in-viewport.js";
|
|
7
7
|
import "./components/Scribe/extension/extension-link.js";
|
|
8
|
-
import { a as lo, b as Ha, P as ba, D as xo, c as Qo, N as Ue, n as ul, d as Ee, S as wt, k as h0, l as fv, T as Dt, F as Xt, o as fa, p as tr, q as hv, r as v0, s as b0, t as vv, w as en, M as Tn, m as Fo, u as Co, v as Zi, x as bv, y as jv, z as kv, A as _v, B as yv, I as gl, C as He, f as wv, g as Dv, h as Iv, G as xv, e as Fv } from "./index-
|
|
9
|
-
import { a as Cv } from "./index-
|
|
8
|
+
import { a as lo, b as Ha, P as ba, D as xo, c as Qo, N as Ue, n as ul, d as Ee, S as wt, k as h0, l as fv, T as Dt, F as Xt, o as fa, p as tr, q as hv, r as v0, s as b0, t as vv, w as en, M as Tn, m as Fo, u as Co, v as Zi, x as bv, y as jv, z as kv, A as _v, B as yv, I as gl, C as He, f as wv, g as Dv, h as Iv, G as xv, e as Fv } from "./index-flsxByQS.js";
|
|
9
|
+
import { a as Cv } from "./index-BfaHEr44.js";
|
|
10
10
|
import "./components/Scribe/extension/extension-selectedText.js";
|
|
11
11
|
import "./components/Scribe/extension/emoji/EmojiList.js";
|
|
12
12
|
import { c as Ei } from "./clsx-OuTLNxxd.js";
|
|
@@ -694,7 +694,7 @@ function I0(a, { map: e, tableStart: t, table: n }, r) {
|
|
|
694
694
|
}), f += w.colspan - 1;
|
|
695
695
|
} else {
|
|
696
696
|
var d;
|
|
697
|
-
const j = m == null ? rt(n.type.schema).cell : (d = n.nodeAt(e.map[v + m * e.width])) === null || d === void 0 ? void 0 : d.type, w = j
|
|
697
|
+
const j = m == null ? rt(n.type.schema).cell : (d = n.nodeAt(e.map[v + m * e.width])) === null || d === void 0 ? void 0 : d.type, w = j?.createAndFill();
|
|
698
698
|
w && p.push(w);
|
|
699
699
|
}
|
|
700
700
|
return a.insert(i, rt(n.type.schema).row.create(null, p)), a;
|
|
@@ -1388,7 +1388,7 @@ function kb(a, e, t, n) {
|
|
|
1388
1388
|
function f(j) {
|
|
1389
1389
|
i.removeEventListener("mouseup", f), i.removeEventListener("mousemove", v);
|
|
1390
1390
|
const w = Rt.getState(a.state);
|
|
1391
|
-
w
|
|
1391
|
+
w?.dragging && (wb(a, w.activeHandle, Dc(w.dragging, j, t)), a.dispatch(a.state.tr.setMeta(Rt, { setDragging: null })));
|
|
1392
1392
|
}
|
|
1393
1393
|
function v(j) {
|
|
1394
1394
|
if (!j.which) return f(j);
|
|
@@ -1596,7 +1596,7 @@ const Ms = ({ editor: a }) => {
|
|
|
1596
1596
|
return !1;
|
|
1597
1597
|
let t = 0;
|
|
1598
1598
|
const n = vv(e.ranges[0].$from, (i) => i.type.name === "table");
|
|
1599
|
-
return n
|
|
1599
|
+
return n?.node.descendants((i) => {
|
|
1600
1600
|
if (i.type.name === "table")
|
|
1601
1601
|
return !1;
|
|
1602
1602
|
["tableCell", "tableHeader"].includes(i.type.name) && (t += 1);
|
|
@@ -2021,7 +2021,7 @@ const Ms = ({ editor: a }) => {
|
|
|
2021
2021
|
handlePaste: (a, e) => {
|
|
2022
2022
|
if (!e.clipboardData || this.editor.isActive(this.type.name))
|
|
2023
2023
|
return !1;
|
|
2024
|
-
const t = e.clipboardData.getData("text/plain"), n = e.clipboardData.getData("vscode-editor-data"), r = n ? JSON.parse(n) : void 0, i = r
|
|
2024
|
+
const t = e.clipboardData.getData("text/plain"), n = e.clipboardData.getData("vscode-editor-data"), r = n ? JSON.parse(n) : void 0, i = r?.mode;
|
|
2025
2025
|
if (!t || !i)
|
|
2026
2026
|
return !1;
|
|
2027
2027
|
const { tr: p, schema: m } = a.state, d = m.text(t.replace(/\r\n?/g, `
|
|
@@ -3201,7 +3201,7 @@ const E0 = S0(!1, !0), M0 = S0(!0, !0), h2 = lo.create({
|
|
|
3201
3201
|
return !1;
|
|
3202
3202
|
const E = w.doc.nodeAt(D);
|
|
3203
3203
|
return w.setNodeMarkup(D, void 0, {
|
|
3204
|
-
...E
|
|
3204
|
+
...E?.attrs,
|
|
3205
3205
|
checked: j
|
|
3206
3206
|
}), !0;
|
|
3207
3207
|
}).run(), !n.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(a, j) || (m.checked = !m.checked));
|
|
@@ -3372,14 +3372,6 @@ const E0 = S0(!1, !0), M0 = S0(!0, !0), h2 = lo.create({
|
|
|
3372
3372
|
}
|
|
3373
3373
|
});
|
|
3374
3374
|
var zs = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Fn = { exports: {} };
|
|
3375
|
-
/**
|
|
3376
|
-
* @license
|
|
3377
|
-
* Lodash <https://lodash.com/>
|
|
3378
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
3379
|
-
* Released under MIT license <https://lodash.com/license>
|
|
3380
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
3381
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
3382
|
-
*/
|
|
3383
3375
|
var z2 = Fn.exports, zc;
|
|
3384
3376
|
function B2() {
|
|
3385
3377
|
return zc || (zc = 1, (function(a, e) {
|
|
@@ -7089,7 +7081,7 @@ const L5 = dv((a, e) => {
|
|
|
7089
7081
|
onClick: () => p(j),
|
|
7090
7082
|
onKeyDown: Bc.noop,
|
|
7091
7083
|
children: [
|
|
7092
|
-
/* @__PURE__ */ Cs("div", { className: Ei("border rounded-[4px] p-2", a.darkMode && "invert"), children: v
|
|
7084
|
+
/* @__PURE__ */ Cs("div", { className: Ei("border rounded-[4px] p-2", a.darkMode && "invert"), children: v?.icon }),
|
|
7093
7085
|
/* @__PURE__ */ dc("div", { className: "flex flex-col", children: [
|
|
7094
7086
|
/* @__PURE__ */ Cs("span", { className: "font-bold", children: v.title }),
|
|
7095
7087
|
/* @__PURE__ */ Cs("span", { children: v.description })
|
|
@@ -18299,7 +18291,7 @@ class pr {
|
|
|
18299
18291
|
*/
|
|
18300
18292
|
parseAtom(e) {
|
|
18301
18293
|
var t = this.parseGroup("atom", e);
|
|
18302
|
-
if (
|
|
18294
|
+
if (t?.type === "internal" || this.mode === "text")
|
|
18303
18295
|
return t;
|
|
18304
18296
|
for (var n, r; ; ) {
|
|
18305
18297
|
this.consumeSpaces();
|
|
@@ -18884,12 +18876,12 @@ var S3 = function(e, t) {
|
|
|
18884
18876
|
},
|
|
18885
18877
|
deleteBlockMath: (a) => ({ editor: e, tr: t }) => {
|
|
18886
18878
|
var n;
|
|
18887
|
-
const r = (n = a
|
|
18879
|
+
const r = (n = a?.pos) != null ? n : e.state.selection.$from.pos, i = e.state.doc.nodeAt(r);
|
|
18888
18880
|
return !i || i.type.name !== this.name ? !1 : (t.delete(r, r + i.nodeSize), !0);
|
|
18889
18881
|
},
|
|
18890
18882
|
updateBlockMath: (a) => ({ editor: e, tr: t }) => {
|
|
18891
|
-
const n = a
|
|
18892
|
-
let r = a
|
|
18883
|
+
const n = a?.latex;
|
|
18884
|
+
let r = a?.pos;
|
|
18893
18885
|
r === void 0 && (r = e.state.selection.$from.pos);
|
|
18894
18886
|
const i = e.state.doc.nodeAt(r);
|
|
18895
18887
|
return !i || i.type.name !== this.name ? !1 : (t.setNodeMarkup(r, this.type, {
|
|
@@ -18998,17 +18990,17 @@ var S3 = function(e, t) {
|
|
|
18998
18990
|
return {
|
|
18999
18991
|
insertInlineMath: (a) => ({ editor: e, tr: t }) => {
|
|
19000
18992
|
var n;
|
|
19001
|
-
const r = a.latex, i = (n = a
|
|
18993
|
+
const r = a.latex, i = (n = a?.pos) != null ? n : e.state.selection.from;
|
|
19002
18994
|
return r ? (t.replaceWith(i, i, this.type.create({ latex: r })), !0) : !1;
|
|
19003
18995
|
},
|
|
19004
18996
|
deleteInlineMath: (a) => ({ editor: e, tr: t }) => {
|
|
19005
18997
|
var n;
|
|
19006
|
-
const r = (n = a
|
|
18998
|
+
const r = (n = a?.pos) != null ? n : e.state.selection.$from.pos, i = e.state.doc.nodeAt(r);
|
|
19007
18999
|
return !i || i.type.name !== this.name ? !1 : (t.delete(r, r + i.nodeSize), !0);
|
|
19008
19000
|
},
|
|
19009
19001
|
updateInlineMath: (a) => ({ editor: e, tr: t }) => {
|
|
19010
|
-
const n = a
|
|
19011
|
-
let r = a
|
|
19002
|
+
const n = a?.latex;
|
|
19003
|
+
let r = a?.pos;
|
|
19012
19004
|
r === void 0 && (r = e.state.selection.$from.pos);
|
|
19013
19005
|
const i = e.state.doc.nodeAt(r);
|
|
19014
19006
|
return !i || i.type.name !== this.name ? !1 : (t.setNodeMarkup(r, this.type, { ...i.attrs, latex: n }), !0);
|
|
@@ -50816,7 +50808,7 @@ const d5 = new ba("emojiSuggestion"), u5 = /:([a-zA-Z0-9_+-]+):$/, g5 = /:([a-zA
|
|
|
50816
50808
|
command: ({ editor: a, range: e, props: t }) => {
|
|
50817
50809
|
var n;
|
|
50818
50810
|
const r = a.view.state.selection.$to.nodeAfter;
|
|
50819
|
-
((n = r
|
|
50811
|
+
!((n = r?.text) === null || n === void 0) && n.startsWith(" ") && (e.to += 1), a.chain().focus().insertContentAt(e, [
|
|
50820
50812
|
{
|
|
50821
50813
|
type: this.name,
|
|
50822
50814
|
attrs: t
|
|
@@ -50873,7 +50865,7 @@ const d5 = new ba("emojiSuggestion"), u5 = /:([a-zA-Z0-9_+-]+):$/, g5 = /:([a-zA
|
|
|
50873
50865
|
n,
|
|
50874
50866
|
`:${e.attrs.name}:`
|
|
50875
50867
|
];
|
|
50876
|
-
const r = this.storage.isSupported(t), i = !!
|
|
50868
|
+
const r = this.storage.isSupported(t), i = !!t?.emoji, p = !!t?.fallbackImage, m = this.options.forceFallbackImages && !i || this.options.forceFallbackImages && p || this.options.forceFallbackImages && !r && p || (!r || !i) && p;
|
|
50877
50869
|
return [
|
|
50878
50870
|
"span",
|
|
50879
50871
|
n,
|
|
@@ -50891,7 +50883,7 @@ const d5 = new ba("emojiSuggestion"), u5 = /:([a-zA-Z0-9_+-]+):$/, g5 = /:([a-zA
|
|
|
50891
50883
|
},
|
|
50892
50884
|
renderText({ node: a }) {
|
|
50893
50885
|
const e = xn(a.attrs.name, this.options.emojis);
|
|
50894
|
-
return
|
|
50886
|
+
return e?.emoji || `:${a.attrs.name}:`;
|
|
50895
50887
|
},
|
|
50896
50888
|
addCommands() {
|
|
50897
50889
|
return {
|