@clevertask/scribe 0.0.9 → 0.0.11
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 +23 -0
- package/dist/browser-BJWkU9cc.js +2106 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/Menu/BarMenu.d.ts +1 -0
- package/dist/components/Menu/BarMenu.js +38 -36
- package/dist/components/Menu/BubbleMenu.js +1 -1
- 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 +208 -200
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.js +30 -24
- package/dist/components/Scribe/extension/math-extension.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +7 -5
- 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 +69 -75
- package/dist/index-BqFHWqw6.js +156 -0
- package/dist/{index-C3_lI_rP.js → index-C_aWB8qt.js} +449 -427
- package/dist/index-CasgquAq.js +39381 -0
- package/dist/{index-Gm-3o3nq.js → index-DeZ8laak.js} +1124 -1083
- package/dist/main.css +95 -5
- package/dist/{turndown.browser.es-BSoGafvq.js → turndown.browser.es-C1wFFc_i.js} +342 -334
- package/dist/utils/create-scribe-editor.js +2 -2
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +33 -31
- package/dist/browser-DEobZXxB.js +0 -2099
- package/dist/index-NRgJVTH-.js +0 -7576
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { S as o, T as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getSuggestionItems as
|
|
7
|
-
import { LatexExtension as
|
|
8
|
-
|
|
1
|
+
import r from "./extension-link.js";
|
|
2
|
+
import { S as o, T as i, a, b as n, c as l, d as m, e as u, P as c, F as g, H as d, I as f, E as p, f as h, g as b } from "../../../index-CasgquAq.js";
|
|
3
|
+
import { S as T } from "../../../index-BqFHWqw6.js";
|
|
4
|
+
import y from "./extension-selectedText.js";
|
|
5
|
+
import E from "./slashCommand/renderItems.js";
|
|
6
|
+
import { getSuggestionItems as C } from "./slashCommand/items.js";
|
|
7
|
+
import { LatexExtension as H } from "./math-extension.js";
|
|
8
|
+
import S from "./emoji/suggest.js";
|
|
9
|
+
const M = (e) => [
|
|
9
10
|
o.configure({
|
|
10
11
|
dropcursor: {
|
|
11
12
|
width: 4,
|
|
12
13
|
color: "#ebf6fe"
|
|
13
14
|
}
|
|
14
15
|
}),
|
|
15
|
-
|
|
16
|
+
i.configure({
|
|
16
17
|
HTMLAttributes: {
|
|
17
18
|
class: "scribe-task-list"
|
|
18
19
|
}
|
|
19
20
|
}),
|
|
20
|
-
|
|
21
|
+
a.configure({
|
|
21
22
|
nested: !0
|
|
22
23
|
}),
|
|
23
24
|
n.configure({
|
|
@@ -25,35 +26,40 @@ const E = (r) => [
|
|
|
25
26
|
}),
|
|
26
27
|
l,
|
|
27
28
|
m,
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
u,
|
|
30
|
+
c.configure({
|
|
30
31
|
showOnlyWhenEditable: !0,
|
|
31
32
|
includeChildren: !0,
|
|
32
33
|
showOnlyCurrent: !1,
|
|
33
34
|
emptyEditorClass: "is-editor-empty",
|
|
34
35
|
emptyNodeClass: "is-node-empty",
|
|
35
|
-
placeholder: ({ editor:
|
|
36
|
+
placeholder: ({ editor: t, node: s }) => t.isDestroyed ? "" : s.type.name === "heading" ? `Heading ${s.attrs.level}` : e.placeholderText || 'Type "/" for commands...'
|
|
36
37
|
}),
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
g.configure({ mode: "deepest", className: "has-focus" }),
|
|
39
|
+
T.configure({
|
|
39
40
|
slashSuggestion: {
|
|
40
|
-
items:
|
|
41
|
-
render:
|
|
41
|
+
items: C,
|
|
42
|
+
render: E(e)
|
|
42
43
|
}
|
|
43
44
|
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
d,
|
|
46
|
+
y,
|
|
47
|
+
r,
|
|
48
|
+
f.configure({
|
|
48
49
|
inline: !0,
|
|
49
50
|
HTMLAttributes: {
|
|
50
51
|
class: "scribe-image-node"
|
|
51
52
|
},
|
|
52
53
|
allowBase64: !0
|
|
53
54
|
}),
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
p.configure({
|
|
56
|
+
emojis: b,
|
|
57
|
+
enableEmoticons: !0,
|
|
58
|
+
suggestion: S(e)
|
|
59
|
+
}),
|
|
60
|
+
H,
|
|
61
|
+
h
|
|
56
62
|
];
|
|
57
63
|
export {
|
|
58
|
-
|
|
64
|
+
M as initExtensions
|
|
59
65
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as fa, P as pa, b as va, m as ga } from "../../../index-
|
|
1
|
+
import { N as fa, P as pa, b as va, m as ga } from "../../../index-DeZ8laak.js";
|
|
2
2
|
class u0 {
|
|
3
3
|
// The + prefix indicates that these fields aren't writeable
|
|
4
4
|
// Lexer holding the input string.
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { h as n } from "../../../../index-CasgquAq.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../../../../turndown.browser.es-
|
|
5
|
-
import "../../../../browser-
|
|
4
|
+
import "../../../../turndown.browser.es-C1wFFc_i.js";
|
|
5
|
+
import "../../../../browser-BJWkU9cc.js";
|
|
6
6
|
import "../../../../utils/is-in-viewport.js";
|
|
7
7
|
import "../extension-link.js";
|
|
8
|
-
import "
|
|
8
|
+
import "../../../../index-BqFHWqw6.js";
|
|
9
9
|
import "../extension-selectedText.js";
|
|
10
10
|
import "../math-extension.js";
|
|
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-DeZ8laak.js";
|
|
2
|
+
import { S as o, s as e } from "../../../../index-BqFHWqw6.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-C_aWB8qt.js";
|
|
2
|
+
import { l as s, h as u } from "../../../../index-CasgquAq.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
|
};
|
|
@@ -28,5 +28,6 @@ export interface ScribeProps {
|
|
|
28
28
|
mainContainerStyle?: React.CSSProperties;
|
|
29
29
|
mainContainerClassName?: ClassValue;
|
|
30
30
|
onKeyDown?: KeyboardEventHandler;
|
|
31
|
+
darkMode?: boolean;
|
|
31
32
|
}
|
|
32
33
|
export declare const Scribe: import('react').ForwardRefExoticComponent<ScribeProps & import('react').RefAttributes<ScribeRef>>;
|
|
@@ -1,100 +1,94 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a, jsxs as L } from "react/jsx-runtime";
|
|
2
2
|
import R from "../Menu/BarMenu.js";
|
|
3
|
-
import {
|
|
4
|
-
import "../../
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
if (typeof n == "string" || typeof n == "number") e += n;
|
|
12
|
-
else if (typeof n == "object") if (Array.isArray(n)) {
|
|
13
|
-
var o = n.length;
|
|
14
|
-
for (r = 0; r < o; r++) n[r] && (s = h(n[r])) && (e && (e += " "), e += s);
|
|
15
|
-
} else for (s in n) n[s] && (e && (e += " "), e += s);
|
|
16
|
-
return e;
|
|
17
|
-
}
|
|
18
|
-
function y() {
|
|
19
|
-
for (var n, r, s = 0, e = "", o = arguments.length; s < o; s++) (n = arguments[s]) && (r = h(n)) && (e && (e += " "), e += r);
|
|
20
|
-
return e;
|
|
21
|
-
}
|
|
22
|
-
const V = O((n, r) => {
|
|
3
|
+
import { c as p } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { html2md as g } from "../../utils/html-to-markdown.js";
|
|
5
|
+
import "../../browser-BJWkU9cc.js";
|
|
6
|
+
import { E as T } from "../../index-DeZ8laak.js";
|
|
7
|
+
import { initExtensions as z } from "./extension/index.js";
|
|
8
|
+
import { E as J } from "../../index-C_aWB8qt.js";
|
|
9
|
+
import { forwardRef as O, useRef as P, useCallback as m, useImperativeHandle as D, useEffect as c } from "react";
|
|
10
|
+
import '../../assets/index.css';const W = O((C, x) => {
|
|
23
11
|
const {
|
|
24
|
-
autoFocus:
|
|
25
|
-
content:
|
|
26
|
-
editable:
|
|
27
|
-
editorProps:
|
|
28
|
-
extensions:
|
|
29
|
-
onContentChange:
|
|
12
|
+
autoFocus: d = !1,
|
|
13
|
+
content: E,
|
|
14
|
+
editable: e = !0,
|
|
15
|
+
editorProps: s,
|
|
16
|
+
extensions: h,
|
|
17
|
+
onContentChange: l,
|
|
30
18
|
showBarMenu: w = !0,
|
|
31
|
-
editorContentStyle:
|
|
32
|
-
editorContentClassName:
|
|
19
|
+
editorContentStyle: y,
|
|
20
|
+
editorContentClassName: M,
|
|
33
21
|
mainContainerStyle: N,
|
|
34
22
|
mainContainerClassName: j,
|
|
35
|
-
onKeyDown:
|
|
36
|
-
externalEditor:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
onKeyDown: k,
|
|
24
|
+
externalEditor: v,
|
|
25
|
+
darkMode: i
|
|
26
|
+
} = C, u = P(v || null), f = m(
|
|
27
|
+
({ editor: t }) => {
|
|
28
|
+
const o = t.getHTML(), r = t.getJSON(), B = !e;
|
|
29
|
+
l && l({
|
|
30
|
+
jsonContent: t.isEmpty ? "" : r,
|
|
31
|
+
htmlContent: t.isEmpty ? "" : o,
|
|
32
|
+
markdownContent: t.isEmpty ? "" : g(o),
|
|
44
33
|
source: B ? "programmatic" : "user"
|
|
45
34
|
});
|
|
46
35
|
},
|
|
47
|
-
[
|
|
36
|
+
[e, l]
|
|
48
37
|
);
|
|
49
|
-
|
|
50
|
-
...
|
|
51
|
-
editable:
|
|
52
|
-
extensions: [...
|
|
38
|
+
u.current || (u.current = new T({
|
|
39
|
+
...s,
|
|
40
|
+
editable: e,
|
|
41
|
+
extensions: [...z(C), ...h ?? []],
|
|
53
42
|
editorProps: {
|
|
54
43
|
attributes: {
|
|
55
44
|
class: "scribe"
|
|
56
45
|
},
|
|
57
|
-
...
|
|
46
|
+
...s == null ? void 0 : s.editorProps
|
|
58
47
|
}
|
|
59
48
|
}));
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}, []),
|
|
63
|
-
var
|
|
64
|
-
const
|
|
65
|
-
html: () =>
|
|
66
|
-
json: () =>
|
|
67
|
-
markdown: () =>
|
|
49
|
+
const n = u.current, b = m(() => {
|
|
50
|
+
n == null || n.commands.setContent("");
|
|
51
|
+
}, []), S = m((t) => {
|
|
52
|
+
var r;
|
|
53
|
+
const o = {
|
|
54
|
+
html: () => n == null ? void 0 : n.getHTML(),
|
|
55
|
+
json: () => n == null ? void 0 : n.getJSON(),
|
|
56
|
+
markdown: () => g((n == null ? void 0 : n.getHTML()) || "")
|
|
68
57
|
};
|
|
69
|
-
return
|
|
70
|
-
}, []),
|
|
71
|
-
|
|
58
|
+
return n != null && n.isEmpty ? "" : (r = o[t]) == null ? void 0 : r.call(o);
|
|
59
|
+
}, []), H = m((t) => {
|
|
60
|
+
n == null || n.commands.setContent(t);
|
|
72
61
|
}, []);
|
|
73
|
-
return D(
|
|
74
|
-
resetContent:
|
|
75
|
-
setContent:
|
|
76
|
-
getContent:
|
|
77
|
-
editor:
|
|
78
|
-
}), [
|
|
79
|
-
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
|
|
84
|
-
}), [
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
/* @__PURE__ */
|
|
62
|
+
return D(x, () => ({
|
|
63
|
+
resetContent: b,
|
|
64
|
+
setContent: H,
|
|
65
|
+
getContent: S,
|
|
66
|
+
editor: n
|
|
67
|
+
}), [b]), c(() => {
|
|
68
|
+
n == null || n.commands.setContent(E || "");
|
|
69
|
+
}, [E]), c(() => {
|
|
70
|
+
n == null || n.setEditable(!!e);
|
|
71
|
+
}, [e]), c(() => (n.off("update"), n.on("update", f), () => {
|
|
72
|
+
n.off("update", f);
|
|
73
|
+
}), [f]), c(() => {
|
|
74
|
+
d && (n == null || n.commands.focus("end"));
|
|
75
|
+
}, [d]), /* @__PURE__ */ a("div", { className: p("scribe-wrapper", j), style: N, children: /* @__PURE__ */ L("div", { className: p(e && "rounded-lg border", i ? "border-zinc-700" : "border-zinc-200"), children: [
|
|
76
|
+
n && w && /* @__PURE__ */ a(R, { editor: n, darkMode: !!i }),
|
|
77
|
+
/* @__PURE__ */ a(
|
|
89
78
|
"div",
|
|
90
79
|
{
|
|
91
|
-
className:
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
className: p(
|
|
81
|
+
"prose max-w-none",
|
|
82
|
+
e && "w-full p-[16px]",
|
|
83
|
+
i && "prose-invert",
|
|
84
|
+
M
|
|
85
|
+
),
|
|
86
|
+
style: y,
|
|
87
|
+
children: /* @__PURE__ */ a(J, { editor: n, onKeyDown: k })
|
|
94
88
|
}
|
|
95
89
|
)
|
|
96
90
|
] }) });
|
|
97
91
|
});
|
|
98
92
|
export {
|
|
99
|
-
|
|
93
|
+
W as Scribe
|
|
100
94
|
};
|