@clevertask/scribe 0.0.7 → 0.0.8
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/{browser-Ce149ePN.js → browser-DEobZXxB.js} +48 -48
- package/dist/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-selectedText.js +4 -4
- package/dist/components/Scribe/extension/index.js +28 -3853
- package/dist/components/Scribe/extension/math-extension.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +7 -3
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/index.d.ts +4 -2
- package/dist/components/Scribe/index.js +62 -60
- package/dist/index-C3_lI_rP.js +2269 -0
- package/dist/{index-o3ZWOEgq.js → index-Gm-3o3nq.js} +25 -25
- package/dist/index-NRgJVTH-.js +7576 -0
- package/dist/main.js +8 -6
- package/dist/utils/create-scribe-editor.d.ts +11 -0
- package/dist/utils/create-scribe-editor.js +26 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +6 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +1 -1
- package/dist/SlashCommandList-DLPd43Tg.js +0 -3733
- package/dist/index-dyNx8_Ul.js +0 -2509
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as fa, P as pa,
|
|
1
|
+
import { N as fa, P as pa, b as va, m as ga } from "../../../index-Gm-3o3nq.js";
|
|
2
2
|
class u0 {
|
|
3
3
|
// The + prefix indicates that these fields aren't writeable
|
|
4
4
|
// Lexer holding the input string.
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { g } from "../../../../index-NRgJVTH-.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../../../../turndown.browser.es-BSoGafvq.js";
|
|
5
|
-
import "../../../../browser-
|
|
5
|
+
import "../../../../browser-DEobZXxB.js";
|
|
6
6
|
import "../../../../utils/is-in-viewport.js";
|
|
7
|
+
import "../extension-link.js";
|
|
8
|
+
import "./index.js";
|
|
9
|
+
import "../extension-selectedText.js";
|
|
10
|
+
import "../math-extension.js";
|
|
7
11
|
export {
|
|
8
|
-
|
|
12
|
+
g as SlashCommandList
|
|
9
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as F, P as T, D as U, c as j, e as z, a as G } from "../../../../index-Gm-3o3nq.js";
|
|
2
2
|
function H(f) {
|
|
3
3
|
var s;
|
|
4
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as l, t as c } from "../../../../index-
|
|
2
|
-
import { l as a,
|
|
1
|
+
import { R as l, t as c } from "../../../../index-C3_lI_rP.js";
|
|
2
|
+
import { l as a, g as d } from "../../../../index-NRgJVTH-.js";
|
|
3
3
|
const m = () => {
|
|
4
4
|
let n, t = [], r, i = !a.isEmpty(t);
|
|
5
5
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Content, Extension, JSONContent, UseEditorOptions } from '@tiptap/react';
|
|
2
|
-
import { KeyboardEventHandler } from 'react';
|
|
3
1
|
import { ClassValue } from 'clsx';
|
|
2
|
+
import { Content, Editor, Extension, JSONContent, UseEditorOptions } from '@tiptap/react';
|
|
3
|
+
import { KeyboardEventHandler } from 'react';
|
|
4
4
|
export type ScribeOnChangeContents = {
|
|
5
5
|
jsonContent: Content;
|
|
6
6
|
htmlContent: Content;
|
|
@@ -10,6 +10,7 @@ export interface ScribeRef {
|
|
|
10
10
|
resetContent: () => void;
|
|
11
11
|
getContent: (contentType: "html" | "json" | "markdown") => string | JSONContent | undefined;
|
|
12
12
|
setContent: (content: Content) => void;
|
|
13
|
+
editor: Editor;
|
|
13
14
|
}
|
|
14
15
|
export interface ScribeProps {
|
|
15
16
|
onContentChange?: (content: ScribeOnChangeContents) => void;
|
|
@@ -17,6 +18,7 @@ export interface ScribeProps {
|
|
|
17
18
|
editable?: boolean;
|
|
18
19
|
autoFocus?: boolean;
|
|
19
20
|
extensions?: Extension[];
|
|
21
|
+
externalEditor?: Editor;
|
|
20
22
|
editorProps?: UseEditorOptions;
|
|
21
23
|
showBarMenu?: boolean;
|
|
22
24
|
placeholderText?: string;
|
|
@@ -1,93 +1,95 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { initExtensions as B } from "./extension/index.js";
|
|
4
|
-
import { forwardRef as L, useCallback as f, useImperativeHandle as T, useEffect as u } from "react";
|
|
5
|
-
import A from "../Menu/BarMenu.js";
|
|
1
|
+
import { jsx as l, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import B from "../Menu/BarMenu.js";
|
|
6
3
|
import { html2md as b } from "../../utils/html-to-markdown.js";
|
|
7
|
-
import "../../browser-
|
|
8
|
-
import
|
|
9
|
-
|
|
4
|
+
import "../../browser-DEobZXxB.js";
|
|
5
|
+
import { E as L } from "../../index-Gm-3o3nq.js";
|
|
6
|
+
import { initExtensions as R } from "./extension/index.js";
|
|
7
|
+
import { E as T } from "../../index-C3_lI_rP.js";
|
|
8
|
+
import { forwardRef as A, useRef as J, useCallback as u, useImperativeHandle as O, useEffect as p } from "react";
|
|
9
|
+
import '../../assets/index.css';function h(t) {
|
|
10
|
+
var r, s, e = "";
|
|
10
11
|
if (typeof t == "string" || typeof t == "number") e += t;
|
|
11
12
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
12
|
-
var
|
|
13
|
-
for (
|
|
13
|
+
var o = t.length;
|
|
14
|
+
for (r = 0; r < o; r++) t[r] && (s = h(t[r])) && (e && (e += " "), e += s);
|
|
14
15
|
} else for (s in t) t[s] && (e && (e += " "), e += s);
|
|
15
16
|
return e;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
for (var t,
|
|
18
|
+
function C() {
|
|
19
|
+
for (var t, r, s = 0, e = "", o = arguments.length; s < o; s++) (t = arguments[s]) && (r = h(t)) && (e && (e += " "), e += r);
|
|
19
20
|
return e;
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
+
const G = A((t, r) => {
|
|
22
23
|
const {
|
|
23
24
|
autoFocus: s = !1,
|
|
24
25
|
content: e,
|
|
25
|
-
editable:
|
|
26
|
+
editable: o = !0,
|
|
26
27
|
editorProps: c,
|
|
27
|
-
extensions:
|
|
28
|
-
onContentChange:
|
|
28
|
+
extensions: w,
|
|
29
|
+
onContentChange: g,
|
|
29
30
|
showBarMenu: y = !0,
|
|
30
|
-
editorContentStyle:
|
|
31
|
-
editorContentClassName:
|
|
31
|
+
editorContentStyle: x,
|
|
32
|
+
editorContentClassName: E,
|
|
32
33
|
mainContainerStyle: v,
|
|
33
|
-
mainContainerClassName:
|
|
34
|
-
onKeyDown:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
editorProps: {
|
|
49
|
-
attributes: {
|
|
50
|
-
class: "scribe"
|
|
51
|
-
},
|
|
52
|
-
...c == null ? void 0 : c.editorProps
|
|
53
|
-
}
|
|
34
|
+
mainContainerClassName: N,
|
|
35
|
+
onKeyDown: j,
|
|
36
|
+
externalEditor: M
|
|
37
|
+
} = t, f = J(M || null);
|
|
38
|
+
f.current || (f.current = new L({
|
|
39
|
+
...c,
|
|
40
|
+
editable: o,
|
|
41
|
+
extensions: [...R(t), ...w ?? []],
|
|
42
|
+
onUpdate({ editor: a }) {
|
|
43
|
+
const m = a.getHTML(), i = a.getJSON();
|
|
44
|
+
g && g({
|
|
45
|
+
jsonContent: i,
|
|
46
|
+
htmlContent: m,
|
|
47
|
+
markdownContent: b(m)
|
|
48
|
+
});
|
|
54
49
|
},
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
editorProps: {
|
|
51
|
+
attributes: {
|
|
52
|
+
class: "scribe"
|
|
53
|
+
},
|
|
54
|
+
...c == null ? void 0 : c.editorProps
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
const n = f.current, d = u(() => {
|
|
57
58
|
n == null || n.commands.setContent("");
|
|
58
|
-
}, []),
|
|
59
|
-
var
|
|
59
|
+
}, []), S = u((a) => {
|
|
60
|
+
var i;
|
|
60
61
|
const m = {
|
|
61
62
|
html: () => n == null ? void 0 : n.getHTML(),
|
|
62
63
|
json: () => n == null ? void 0 : n.getJSON(),
|
|
63
64
|
markdown: () => b((n == null ? void 0 : n.getHTML()) || "")
|
|
64
65
|
};
|
|
65
|
-
return n != null && n.isEmpty ? "" : (
|
|
66
|
-
}, []),
|
|
66
|
+
return n != null && n.isEmpty ? "" : (i = m[a]) == null ? void 0 : i.call(m);
|
|
67
|
+
}, []), H = u((a) => {
|
|
67
68
|
n == null || n.commands.setContent(a);
|
|
68
69
|
}, []);
|
|
69
|
-
return
|
|
70
|
-
resetContent:
|
|
71
|
-
setContent:
|
|
72
|
-
getContent:
|
|
73
|
-
|
|
70
|
+
return O(r, () => ({
|
|
71
|
+
resetContent: d,
|
|
72
|
+
setContent: H,
|
|
73
|
+
getContent: S,
|
|
74
|
+
editor: n
|
|
75
|
+
}), [d]), p(() => {
|
|
74
76
|
n == null || n.commands.setContent(e || "");
|
|
75
|
-
}, [e]),
|
|
76
|
-
n == null || n.setEditable(!!
|
|
77
|
-
}, [
|
|
77
|
+
}, [e]), p(() => {
|
|
78
|
+
n == null || n.setEditable(!!o);
|
|
79
|
+
}, [o]), p(() => {
|
|
78
80
|
s && (n == null || n.commands.focus("end"));
|
|
79
|
-
}, [s]), /* @__PURE__ */
|
|
80
|
-
n && y && /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
81
|
+
}, [s]), /* @__PURE__ */ l("div", { className: C("scribe-wrapper", N), style: v, id: "scribe-wrapper", children: /* @__PURE__ */ k("div", { className: C("bg-white", o && "rounded-lg border"), children: [
|
|
82
|
+
n && y && /* @__PURE__ */ l(B, { editor: n }),
|
|
83
|
+
/* @__PURE__ */ l(
|
|
82
84
|
"div",
|
|
83
85
|
{
|
|
84
|
-
className:
|
|
85
|
-
style:
|
|
86
|
-
children: /* @__PURE__ */
|
|
86
|
+
className: C("prose max-w-none", o && "w-full p-[16px]", E),
|
|
87
|
+
style: x,
|
|
88
|
+
children: /* @__PURE__ */ l(T, { editor: n, onKeyDown: j })
|
|
87
89
|
}
|
|
88
90
|
)
|
|
89
91
|
] }) });
|
|
90
92
|
});
|
|
91
93
|
export {
|
|
92
|
-
|
|
94
|
+
G as Scribe
|
|
93
95
|
};
|