@clevertask/scribe 0.0.10 → 0.0.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/dist/assets/index.css +1 -1
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/Menu/BarMenu.js +119 -4
- package/dist/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts +6 -0
- package/dist/components/Menu/Mobile/ListOptionBar.js +40 -0
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +1 -0
- package/dist/components/Scribe/extension/emoji/EmojiList.js +35 -0
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +16 -0
- package/dist/components/Scribe/extension/emoji/suggest.js +40 -0
- package/dist/components/Scribe/extension/extension-link.js +221 -217
- 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.js +33 -28
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +8 -6
- package/dist/components/Scribe/extension/slashCommand/index.js +4 -153
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +14 -14
- package/dist/components/Scribe/index.d.ts +1 -0
- package/dist/components/Scribe/index.js +85 -61
- package/dist/index-B0pieAxt.js +160 -0
- package/dist/index-CCS9HOYd.js +51031 -0
- package/dist/{index-Gm-3o3nq.js → index-DoNRu1rY.js} +1654 -1553
- package/dist/index-VneQGVTd.js +2385 -0
- package/dist/main.css +64 -6
- package/dist/marked.esm-BS_MmRZC.js +1566 -0
- package/dist/purify.es-BGaRrCfO.js +553 -0
- package/dist/turndown.browser.es-RmA_HBaI.js +649 -0
- package/dist/utils/create-scribe-editor.js +7 -6
- package/dist/utils/html-to-markdown.js +7 -6
- package/dist/utils/markdown-to-html.js +4 -3
- package/package.json +44 -41
- package/dist/BarMenu-SiPgB2ow.js +0 -134
- package/dist/browser-DEobZXxB.js +0 -2099
- package/dist/components/Scribe/extension/math-extension.d.ts +0 -2
- package/dist/components/Scribe/extension/math-extension.js +0 -11770
- package/dist/index-C3_lI_rP.js +0 -2269
- package/dist/index-NRgJVTH-.js +0 -7576
- package/dist/turndown.browser.es-BSoGafvq.js +0 -1164
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ScribeProps } from '..';
|
|
2
|
-
export declare const initExtensions: (props: ScribeProps) => (import('@tiptap/core').Mark<import('@tiptap/extension-link').LinkOptions, any> | import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Node<
|
|
2
|
+
export declare const initExtensions: (props: ScribeProps) => (import('@tiptap/core').Mark<import('@tiptap/extension-link').LinkOptions, any> | import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Node<import('@tiptap/extension-table-row').TableRowOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-highlight').HighlightOptions, any>)[];
|
|
@@ -1,59 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getSuggestionItems as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
|
|
1
|
+
import r from "./extension-link.js";
|
|
2
|
+
import { T as i, a as o, b as a, H as n, M as l, c as m, S as u, d as c, e as g, f as d, P as f, F as h, I as p, E as b, g as T } from "../../../index-CCS9HOYd.js";
|
|
3
|
+
import { S as y } from "../../../index-B0pieAxt.js";
|
|
4
|
+
import C from "./extension-selectedText.js";
|
|
5
|
+
import E from "./slashCommand/renderItems.js";
|
|
6
|
+
import { getSuggestionItems as H } from "./slashCommand/items.js";
|
|
7
|
+
import S from "./emoji/suggest.js";
|
|
8
|
+
const A = (e) => [
|
|
9
|
+
u.configure({
|
|
10
10
|
dropcursor: {
|
|
11
11
|
width: 4,
|
|
12
12
|
color: "#ebf6fe"
|
|
13
13
|
}
|
|
14
14
|
}),
|
|
15
|
-
|
|
15
|
+
c.configure({
|
|
16
16
|
HTMLAttributes: {
|
|
17
17
|
class: "scribe-task-list"
|
|
18
18
|
}
|
|
19
19
|
}),
|
|
20
|
-
|
|
20
|
+
g.configure({
|
|
21
21
|
nested: !0
|
|
22
22
|
}),
|
|
23
|
-
|
|
23
|
+
d.configure({
|
|
24
24
|
resizable: !0
|
|
25
25
|
}),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
i,
|
|
27
|
+
o,
|
|
28
|
+
a,
|
|
29
|
+
f.configure({
|
|
30
30
|
showOnlyWhenEditable: !0,
|
|
31
31
|
includeChildren: !0,
|
|
32
32
|
showOnlyCurrent: !1,
|
|
33
33
|
emptyEditorClass: "is-editor-empty",
|
|
34
34
|
emptyNodeClass: "is-node-empty",
|
|
35
|
-
placeholder: ({ editor:
|
|
35
|
+
placeholder: ({ editor: t, node: s }) => t.isDestroyed ? "" : s.type.name === "heading" ? `Heading ${s.attrs.level}` : e.placeholderText || 'Type "/" for commands...'
|
|
36
36
|
}),
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
h.configure({ mode: "deepest", className: "has-focus" }),
|
|
38
|
+
y.configure({
|
|
39
39
|
slashSuggestion: {
|
|
40
|
-
items:
|
|
41
|
-
render:
|
|
40
|
+
items: H,
|
|
41
|
+
render: E(e)
|
|
42
42
|
}
|
|
43
43
|
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
n,
|
|
45
|
+
C,
|
|
46
|
+
r,
|
|
47
|
+
p.configure({
|
|
48
48
|
inline: !0,
|
|
49
49
|
HTMLAttributes: {
|
|
50
50
|
class: "scribe-image-node"
|
|
51
51
|
},
|
|
52
52
|
allowBase64: !0
|
|
53
53
|
}),
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
b.configure({
|
|
55
|
+
emojis: T,
|
|
56
|
+
enableEmoticons: !0,
|
|
57
|
+
suggestion: S(e)
|
|
58
|
+
}),
|
|
59
|
+
l,
|
|
60
|
+
m
|
|
56
61
|
];
|
|
57
62
|
export {
|
|
58
|
-
|
|
63
|
+
A as initExtensions
|
|
59
64
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { h as n } from "../../../../index-CCS9HOYd.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../../../../
|
|
5
|
-
import "../../../../browser-
|
|
4
|
+
import "../../../../purify.es-BGaRrCfO.js";
|
|
5
|
+
import "../../../../turndown.browser.es-RmA_HBaI.js";
|
|
6
|
+
import "../../../../marked.esm-BS_MmRZC.js";
|
|
6
7
|
import "../../../../utils/is-in-viewport.js";
|
|
7
8
|
import "../extension-link.js";
|
|
8
|
-
import "
|
|
9
|
+
import "../../../../index-B0pieAxt.js";
|
|
9
10
|
import "../extension-selectedText.js";
|
|
10
|
-
import "../
|
|
11
|
+
import "../emoji/EmojiList.js";
|
|
12
|
+
import "../../../../clsx-OuTLNxxd.js";
|
|
11
13
|
export {
|
|
12
|
-
|
|
14
|
+
n as SlashCommandList
|
|
13
15
|
};
|
|
@@ -1,155 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var s;
|
|
4
|
-
const { char: g, allowSpaces: v, allowToIncludeChar: I, allowedPrefixes: m, startOfLine: R, $position: d } = f, P = v && !I, p = z(g), D = new RegExp(`\\s${p}$`), h = R ? "^" : "", C = I ? "" : p, K = P ? new RegExp(`${h}${p}.*?(?=\\s${C}|$)`, "gm") : new RegExp(`${h}(?:^)?${p}[^\\s${C}]*`, "gm"), r = ((s = d.nodeBefore) === null || s === void 0 ? void 0 : s.isText) && d.nodeBefore.text;
|
|
5
|
-
if (!r)
|
|
6
|
-
return null;
|
|
7
|
-
const e = d.pos - r.length, o = Array.from(r.matchAll(K)).pop();
|
|
8
|
-
if (!o || o.input === void 0 || o.index === void 0)
|
|
9
|
-
return null;
|
|
10
|
-
const n = o.input.slice(Math.max(0, o.index - 1), o.index), i = new RegExp(`^[${m == null ? void 0 : m.join("")}\0]?$`).test(n);
|
|
11
|
-
if (m !== null && !i)
|
|
12
|
-
return null;
|
|
13
|
-
const a = e + o.index;
|
|
14
|
-
let l = a + o[0].length;
|
|
15
|
-
return P && D.test(r.slice(l - 1, l + 1)) && (o[0] += " ", l += 1), a < d.pos && l >= d.pos ? {
|
|
16
|
-
range: {
|
|
17
|
-
from: a,
|
|
18
|
-
to: l
|
|
19
|
-
},
|
|
20
|
-
query: o[0].slice(g.length),
|
|
21
|
-
text: o[0]
|
|
22
|
-
} : null;
|
|
23
|
-
}
|
|
24
|
-
const J = new F("suggestion");
|
|
25
|
-
function Q({ pluginKey: f = J, editor: s, char: g = "@", allowSpaces: v = !1, allowToIncludeChar: I = !1, allowedPrefixes: m = [" "], startOfLine: R = !1, decorationTag: d = "span", decorationClass: P = "suggestion", command: p = () => null, items: D = () => [], render: h = () => ({}), allow: C = () => !0, findSuggestionMatch: K = H }) {
|
|
26
|
-
let r;
|
|
27
|
-
const e = h == null ? void 0 : h(), o = new T({
|
|
28
|
-
key: f,
|
|
29
|
-
view() {
|
|
30
|
-
return {
|
|
31
|
-
update: async (n, i) => {
|
|
32
|
-
var a, l, u, x, y, w, S;
|
|
33
|
-
const t = (a = this.key) === null || a === void 0 ? void 0 : a.getState(i), c = (l = this.key) === null || l === void 0 ? void 0 : l.getState(n.state), q = t.active && c.active && t.range.from !== c.range.from, O = !t.active && c.active, b = t.active && !c.active, B = !O && !b && t.query !== c.query, _ = O || q && B, M = B || q, k = b || q && B;
|
|
34
|
-
if (!_ && !M && !k)
|
|
35
|
-
return;
|
|
36
|
-
const $ = k && !_ ? t : c, N = n.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`);
|
|
37
|
-
r = {
|
|
38
|
-
editor: s,
|
|
39
|
-
range: $.range,
|
|
40
|
-
query: $.query,
|
|
41
|
-
text: $.text,
|
|
42
|
-
items: [],
|
|
43
|
-
command: (E) => p({
|
|
44
|
-
editor: s,
|
|
45
|
-
range: $.range,
|
|
46
|
-
props: E
|
|
47
|
-
}),
|
|
48
|
-
decorationNode: N,
|
|
49
|
-
// virtual node for popper.js or tippy.js
|
|
50
|
-
// this can be used for building popups without a DOM node
|
|
51
|
-
clientRect: N ? () => {
|
|
52
|
-
var E;
|
|
53
|
-
const { decorationId: L } = (E = this.key) === null || E === void 0 ? void 0 : E.getState(s.state), A = n.dom.querySelector(`[data-decoration-id="${L}"]`);
|
|
54
|
-
return (A == null ? void 0 : A.getBoundingClientRect()) || null;
|
|
55
|
-
} : null
|
|
56
|
-
}, _ && ((u = e == null ? void 0 : e.onBeforeStart) === null || u === void 0 || u.call(e, r)), M && ((x = e == null ? void 0 : e.onBeforeUpdate) === null || x === void 0 || x.call(e, r)), (M || _) && (r.items = await D({
|
|
57
|
-
editor: s,
|
|
58
|
-
query: $.query
|
|
59
|
-
})), k && ((y = e == null ? void 0 : e.onExit) === null || y === void 0 || y.call(e, r)), M && ((w = e == null ? void 0 : e.onUpdate) === null || w === void 0 || w.call(e, r)), _ && ((S = e == null ? void 0 : e.onStart) === null || S === void 0 || S.call(e, r));
|
|
60
|
-
},
|
|
61
|
-
destroy: () => {
|
|
62
|
-
var n;
|
|
63
|
-
r && ((n = e == null ? void 0 : e.onExit) === null || n === void 0 || n.call(e, r));
|
|
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(n, i, a, l) {
|
|
83
|
-
const { isEditable: u } = s, { composing: x } = s.view, { selection: y } = n, { empty: w, from: S } = y, t = { ...i };
|
|
84
|
-
if (t.composing = x, u && (w || s.view.composing)) {
|
|
85
|
-
(S < i.range.from || S > i.range.to) && !x && !i.composing && (t.active = !1);
|
|
86
|
-
const c = K({
|
|
87
|
-
char: g,
|
|
88
|
-
allowSpaces: v,
|
|
89
|
-
allowToIncludeChar: I,
|
|
90
|
-
allowedPrefixes: m,
|
|
91
|
-
startOfLine: R,
|
|
92
|
-
$position: y.$from
|
|
93
|
-
}), q = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
94
|
-
c && C({
|
|
95
|
-
editor: s,
|
|
96
|
-
state: l,
|
|
97
|
-
range: c.range,
|
|
98
|
-
isActive: i.active
|
|
99
|
-
}) ? (t.active = !0, t.decorationId = i.decorationId ? i.decorationId : q, t.range = c.range, t.query = c.query, t.text = c.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(n, i) {
|
|
108
|
-
var a;
|
|
109
|
-
const { active: l, range: u } = o.getState(n.state);
|
|
110
|
-
return l && ((a = e == null ? void 0 : e.onKeyDown) === null || a === void 0 ? void 0 : a.call(e, { view: n, event: i, range: u })) || !1;
|
|
111
|
-
},
|
|
112
|
-
// Setup decorator on the currently active suggestion.
|
|
113
|
-
decorations(n) {
|
|
114
|
-
const { active: i, range: a, decorationId: l } = o.getState(n);
|
|
115
|
-
return i ? U.create(n.doc, [
|
|
116
|
-
j.inline(a.from, a.to, {
|
|
117
|
-
nodeName: d,
|
|
118
|
-
class: P,
|
|
119
|
-
"data-decoration-id": l
|
|
120
|
-
})
|
|
121
|
-
]) : null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return o;
|
|
126
|
-
}
|
|
127
|
-
const V = new F("slashSuggestion"), X = G.create({
|
|
128
|
-
name: "slashCommand",
|
|
129
|
-
addOptions() {
|
|
130
|
-
var f;
|
|
131
|
-
return {
|
|
132
|
-
...(f = this.parent) == null ? void 0 : f.call(this),
|
|
133
|
-
slashSuggestion: {
|
|
134
|
-
char: "/",
|
|
135
|
-
startOfLine: !0,
|
|
136
|
-
command: ({ editor: s, range: g, props: v }) => {
|
|
137
|
-
v.command({ editor: s, range: g, props: v });
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
|
-
addProseMirrorPlugins() {
|
|
143
|
-
return [
|
|
144
|
-
Q({
|
|
145
|
-
pluginKey: V,
|
|
146
|
-
...this.options.slashSuggestion,
|
|
147
|
-
editor: this.editor
|
|
148
|
-
})
|
|
149
|
-
];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
1
|
+
import "../../../../index-DoNRu1rY.js";
|
|
2
|
+
import { S as o, s as e } from "../../../../index-B0pieAxt.js";
|
|
152
3
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
4
|
+
o as SlashCommand,
|
|
5
|
+
e as slashMenuPluginKey
|
|
155
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';
|
|
2
|
-
declare const renderItems: () => {
|
|
2
|
+
declare const renderItems: (_props: any) => () => {
|
|
3
3
|
onStart: (props: SuggestionProps) => void;
|
|
4
4
|
onUpdate: (props: SuggestionProps) => void;
|
|
5
5
|
onKeyDown(props: SuggestionKeyDownProps): boolean;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { l as
|
|
3
|
-
const
|
|
4
|
-
let
|
|
1
|
+
import { R as c, t as d } from "../../../../index-VneQGVTd.js";
|
|
2
|
+
import { l as s, h as u } from "../../../../index-CCS9HOYd.js";
|
|
3
|
+
const y = (a) => () => {
|
|
4
|
+
let r, t = [], n, i = !s.isEmpty(t);
|
|
5
5
|
return {
|
|
6
6
|
onStart: (e) => {
|
|
7
|
-
|
|
8
|
-
props:
|
|
7
|
+
n = { ...e, ...a }, r = new c(u, {
|
|
8
|
+
props: n,
|
|
9
9
|
editor: e.editor
|
|
10
|
-
}), e.clientRect && (t =
|
|
10
|
+
}), e.clientRect && (t = d("body", {
|
|
11
11
|
getReferenceClientRect: e.clientRect,
|
|
12
12
|
appendTo: () => document.body,
|
|
13
|
-
content:
|
|
13
|
+
content: r.element,
|
|
14
14
|
showOnCreate: !0,
|
|
15
15
|
interactive: !0,
|
|
16
16
|
trigger: "manual",
|
|
17
17
|
placement: "bottom-start"
|
|
18
|
-
}), i = !
|
|
18
|
+
}), i = !s.isEmpty(t));
|
|
19
19
|
},
|
|
20
20
|
onUpdate: (e) => {
|
|
21
|
-
|
|
21
|
+
n = e, r.updateProps(e), e.clientRect && i && t[0].setProps({
|
|
22
22
|
getReferenceClientRect: e.clientRect
|
|
23
23
|
});
|
|
24
24
|
},
|
|
25
25
|
onKeyDown(e) {
|
|
26
26
|
var o;
|
|
27
|
-
return e.event.key === "Escape" && i && !t[0].state.isDestroyed ? (t[0].hide(), !0) : (e.event.key === "Enter" &&
|
|
28
|
-
(
|
|
29
|
-
).length === 0 && this.onExit(), ((o =
|
|
27
|
+
return e.event.key === "Escape" && i && !t[0].state.isDestroyed ? (t[0].hide(), !0) : (e.event.key === "Enter" && n.items.filter(
|
|
28
|
+
(l) => l.title.toLowerCase().startsWith(n.query.toLowerCase())
|
|
29
|
+
).length === 0 && this.onExit(), ((o = r == null ? void 0 : r.ref) == null ? void 0 : o.onKeyDown(e)) || !1);
|
|
30
30
|
},
|
|
31
31
|
onExit() {
|
|
32
32
|
i && !t[0].state.isDestroyed && t[0].destroy();
|
|
@@ -34,5 +34,5 @@ const m = () => {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
y as default
|
|
38
38
|
};
|
|
@@ -29,5 +29,6 @@ export interface ScribeProps {
|
|
|
29
29
|
mainContainerClassName?: ClassValue;
|
|
30
30
|
onKeyDown?: KeyboardEventHandler;
|
|
31
31
|
darkMode?: boolean;
|
|
32
|
+
mobile?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export declare const Scribe: import('react').ForwardRefExoticComponent<ScribeProps & import('react').RefAttributes<ScribeRef>>;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as s, jsxs as O } from "react/jsx-runtime";
|
|
2
|
+
import R from "../Menu/BarMenu.js";
|
|
3
|
+
import { c as f } from "../../clsx-OuTLNxxd.js";
|
|
3
4
|
import { html2md as g } from "../../utils/html-to-markdown.js";
|
|
4
|
-
import "../../
|
|
5
|
-
import
|
|
5
|
+
import "../../marked.esm-BS_MmRZC.js";
|
|
6
|
+
import "../../purify.es-BGaRrCfO.js";
|
|
7
|
+
import { E as T } from "../../index-DoNRu1rY.js";
|
|
6
8
|
import { initExtensions as z } from "./extension/index.js";
|
|
7
|
-
import { E as J } from "../../index-
|
|
8
|
-
import { forwardRef as
|
|
9
|
-
import
|
|
9
|
+
import { E as J } from "../../index-VneQGVTd.js";
|
|
10
|
+
import { forwardRef as P, useRef as D, useCallback as a, useImperativeHandle as F, useEffect as c } from "react";
|
|
11
|
+
import { ListOptionBar as I } from "../Menu/Mobile/ListOptionBar.js";
|
|
12
|
+
import '../../assets/index.css';const _ = P((C, x) => {
|
|
10
13
|
const {
|
|
11
14
|
autoFocus: d = !1,
|
|
12
15
|
content: E,
|
|
13
16
|
editable: e = !0,
|
|
14
|
-
editorProps:
|
|
17
|
+
editorProps: r,
|
|
15
18
|
extensions: h,
|
|
16
|
-
onContentChange:
|
|
19
|
+
onContentChange: i,
|
|
17
20
|
showBarMenu: w = !0,
|
|
18
21
|
editorContentStyle: y,
|
|
19
22
|
editorContentClassName: M,
|
|
@@ -21,73 +24,94 @@ import '../../assets/index.css';const V = O((C, x) => {
|
|
|
21
24
|
mainContainerClassName: j,
|
|
22
25
|
onKeyDown: k,
|
|
23
26
|
externalEditor: v,
|
|
24
|
-
darkMode:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
darkMode: l,
|
|
28
|
+
mobile: S
|
|
29
|
+
} = C, p = D(v || null), u = a(
|
|
30
|
+
({ editor: n }) => {
|
|
31
|
+
const o = n.getHTML(), m = n.getJSON(), L = !e;
|
|
32
|
+
i && i({
|
|
33
|
+
jsonContent: n.isEmpty ? "" : m,
|
|
34
|
+
htmlContent: n.isEmpty ? "" : o,
|
|
35
|
+
markdownContent: n.isEmpty ? "" : g(o),
|
|
36
|
+
source: L ? "programmatic" : "user"
|
|
33
37
|
});
|
|
34
38
|
},
|
|
35
|
-
[e,
|
|
39
|
+
[e, i]
|
|
36
40
|
);
|
|
37
|
-
|
|
38
|
-
...
|
|
41
|
+
p.current || (p.current = new T({
|
|
42
|
+
...r,
|
|
39
43
|
editable: e,
|
|
40
44
|
extensions: [...z(C), ...h ?? []],
|
|
41
45
|
editorProps: {
|
|
42
46
|
attributes: {
|
|
43
47
|
class: "scribe"
|
|
44
48
|
},
|
|
45
|
-
...
|
|
49
|
+
...r == null ? void 0 : r.editorProps
|
|
46
50
|
}
|
|
47
51
|
}));
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
}, []),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
const t = p.current, b = a(() => {
|
|
53
|
+
t == null || t.commands.setContent("");
|
|
54
|
+
}, []), B = a(
|
|
55
|
+
(n) => {
|
|
56
|
+
var m;
|
|
57
|
+
const o = {
|
|
58
|
+
html: () => t == null ? void 0 : t.getHTML(),
|
|
59
|
+
json: () => t == null ? void 0 : t.getJSON(),
|
|
60
|
+
markdown: () => g((t == null ? void 0 : t.getHTML()) || "")
|
|
61
|
+
};
|
|
62
|
+
return t != null && t.isEmpty ? "" : (m = o[n]) == null ? void 0 : m.call(o);
|
|
63
|
+
},
|
|
64
|
+
[]
|
|
65
|
+
), H = a((n) => {
|
|
66
|
+
t == null || t.commands.setContent(n);
|
|
60
67
|
}, []);
|
|
61
|
-
return
|
|
68
|
+
return F(x, () => ({
|
|
62
69
|
resetContent: b,
|
|
63
|
-
setContent:
|
|
64
|
-
getContent:
|
|
65
|
-
editor:
|
|
70
|
+
setContent: H,
|
|
71
|
+
getContent: B,
|
|
72
|
+
editor: t
|
|
66
73
|
}), [b]), c(() => {
|
|
67
|
-
|
|
74
|
+
t == null || t.commands.setContent(E || "");
|
|
68
75
|
}, [E]), c(() => {
|
|
69
|
-
|
|
70
|
-
}, [e]), c(() => (
|
|
71
|
-
|
|
72
|
-
}), [
|
|
73
|
-
d && (
|
|
74
|
-
}, [d]), /* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
t == null || t.setEditable(!!e);
|
|
77
|
+
}, [e]), c(() => (t.off("update"), t.on("update", u), () => {
|
|
78
|
+
t.off("update", u);
|
|
79
|
+
}), [u]), c(() => {
|
|
80
|
+
d && (t == null || t.commands.focus("end"));
|
|
81
|
+
}, [d]), /* @__PURE__ */ s(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: f("scribe-wrapper", j),
|
|
85
|
+
style: N,
|
|
86
|
+
children: /* @__PURE__ */ O(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: f(
|
|
90
|
+
e && "rounded-lg border",
|
|
91
|
+
l ? "border-zinc-700" : "border-zinc-200"
|
|
92
|
+
),
|
|
93
|
+
children: [
|
|
94
|
+
t && w && /* @__PURE__ */ s(R, { editor: t, darkMode: !!l }),
|
|
95
|
+
/* @__PURE__ */ s(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
className: f(
|
|
99
|
+
"prose max-w-none",
|
|
100
|
+
e && "w-full p-[16px]",
|
|
101
|
+
l && "prose-invert",
|
|
102
|
+
M
|
|
103
|
+
),
|
|
104
|
+
style: y,
|
|
105
|
+
children: /* @__PURE__ */ s(J, { editor: t, onKeyDown: k })
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
S && /* @__PURE__ */ s(I, { editor: t })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
);
|
|
90
114
|
});
|
|
91
115
|
export {
|
|
92
|
-
|
|
116
|
+
_ as Scribe
|
|
93
117
|
};
|