@clevertask/scribe 0.0.1 → 0.0.3
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/{SlashCommandList-DYKFukY8.js → SlashCommandList-D_Ndw6pj.js} +272 -273
- package/dist/browser-D3_ToIiA.js +2110 -0
- 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 +1 -1
- package/dist/components/Scribe/extension/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.js +2768 -566
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +4 -5
- 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 -3
- package/dist/components/Scribe/index.js +66 -66
- package/dist/{index-CzwFCNeI.js → index-CUP7vhu5.js} +15 -12
- package/dist/{index-Cu10LNOZ.js → index-ggVAwdRQ.js} +1 -1
- package/dist/main.css +9 -0
- package/dist/main.d.ts +1 -0
- package/dist/turndown.browser.es-CeowJDZ0.js +1168 -0
- package/dist/utils/html-to-markdown.js +4 -5
- package/dist/utils/markdown-to-html.js +3 -4
- package/package.json +8 -4
- package/dist/marked.esm-DIt7dqAB.js +0 -1574
- package/dist/purify.es-Bzg5nW_L.js +0 -524
- package/dist/turndown.browser.es-DwgPoVx0.js +0 -646
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import { S } from "../../../../SlashCommandList-
|
|
2
|
+
import { S as s } from "../../../../SlashCommandList-D_Ndw6pj.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../../../../
|
|
5
|
-
import "../../../../
|
|
6
|
-
import "../../../../marked.esm-DIt7dqAB.js";
|
|
4
|
+
import "../../../../turndown.browser.es-CeowJDZ0.js";
|
|
5
|
+
import "../../../../browser-D3_ToIiA.js";
|
|
7
6
|
import "../../../../utils/is-in-viewport.js";
|
|
8
7
|
export {
|
|
9
|
-
|
|
8
|
+
s as SlashCommandList
|
|
10
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as O, a as L, D as U, b as j, e as T, E as z } from "../../../../index-
|
|
1
|
+
import { P as O, a as L, D as U, b as j, e as T, E as z } from "../../../../index-CUP7vhu5.js";
|
|
2
2
|
function G(f) {
|
|
3
3
|
var a;
|
|
4
4
|
const { char: v, allowSpaces: c, allowedPrefixes: m, startOfLine: R, $position: d } = f, u = T(v), D = new RegExp(`\\s${u}$`), I = R ? "^" : "", $ = c ? new RegExp(`${I}${u}.*?(?=\\s${u}|$)`, "gm") : new RegExp(`${I}(?:^)?${u}[^\\s${u}]*`, "gm"), p = ((a = d.nodeBefore) === null || a === void 0 ? void 0 : a.isText) && d.nodeBefore.text;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as l, t as c } from "../../../../index-
|
|
2
|
-
import { l as a, S as d } from "../../../../SlashCommandList-
|
|
1
|
+
import { R as l, t as c } from "../../../../index-ggVAwdRQ.js";
|
|
2
|
+
import { l as a, S as d } from "../../../../SlashCommandList-D_Ndw6pj.js";
|
|
3
3
|
const m = () => {
|
|
4
4
|
let n, t = [], r, i = !a.isEmpty(t);
|
|
5
5
|
return {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Content, Extension } from '@tiptap/react';
|
|
2
|
-
import { EditorProps } from '@tiptap/pm/view';
|
|
1
|
+
import { Content, Extension, JSONContent, UseEditorOptions } from '@tiptap/react';
|
|
3
2
|
import { KeyboardEventHandler } from 'react';
|
|
4
3
|
import { ClassValue } from 'clsx';
|
|
5
4
|
export type ScribeOnChangeContents = {
|
|
@@ -9,6 +8,8 @@ export type ScribeOnChangeContents = {
|
|
|
9
8
|
};
|
|
10
9
|
export interface ScribeRef {
|
|
11
10
|
resetContent: () => void;
|
|
11
|
+
getContent: (contentType: "html" | "json" | "markdown") => string | JSONContent | undefined;
|
|
12
|
+
setContent: (content: Content) => void;
|
|
12
13
|
}
|
|
13
14
|
export interface ScribeProps {
|
|
14
15
|
onContentChange?: (content: ScribeOnChangeContents) => void;
|
|
@@ -16,7 +17,7 @@ export interface ScribeProps {
|
|
|
16
17
|
editable?: boolean;
|
|
17
18
|
autoFocus?: boolean;
|
|
18
19
|
extensions?: Extension[];
|
|
19
|
-
editorProps?:
|
|
20
|
+
editorProps?: UseEditorOptions;
|
|
20
21
|
showBarMenu?: boolean;
|
|
21
22
|
placeholderText?: string;
|
|
22
23
|
editorContentStyle?: React.CSSProperties;
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { u as
|
|
3
|
-
import { initExtensions as
|
|
4
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as i, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { u as H, E as k } from "../../index-ggVAwdRQ.js";
|
|
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
5
|
import A from "../Menu/BarMenu.js";
|
|
6
|
-
import { html2md as
|
|
7
|
-
import "../../
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var r, o, e = "";
|
|
6
|
+
import { html2md as b } from "../../utils/html-to-markdown.js";
|
|
7
|
+
import "../../browser-D3_ToIiA.js";
|
|
8
|
+
function d(t) {
|
|
9
|
+
var o, s, e = "";
|
|
11
10
|
if (typeof t == "string" || typeof t == "number") e += t;
|
|
12
11
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
13
|
-
var
|
|
14
|
-
for (
|
|
15
|
-
} else for (
|
|
12
|
+
var r = t.length;
|
|
13
|
+
for (o = 0; o < r; o++) t[o] && (s = d(t[o])) && (e && (e += " "), e += s);
|
|
14
|
+
} else for (s in t) t[s] && (e && (e += " "), e += s);
|
|
16
15
|
return e;
|
|
17
16
|
}
|
|
18
|
-
function
|
|
19
|
-
for (var t,
|
|
17
|
+
function p() {
|
|
18
|
+
for (var t, o, s = 0, e = "", r = arguments.length; s < r; s++) (t = arguments[s]) && (o = d(t)) && (e && (e += " "), e += o);
|
|
20
19
|
return e;
|
|
21
20
|
}
|
|
22
|
-
const R =
|
|
21
|
+
const R = L((t, o) => {
|
|
23
22
|
const {
|
|
24
|
-
autoFocus:
|
|
23
|
+
autoFocus: s = !1,
|
|
25
24
|
content: e,
|
|
26
|
-
editable:
|
|
27
|
-
editorProps:
|
|
28
|
-
extensions:
|
|
29
|
-
onContentChange:
|
|
30
|
-
showBarMenu:
|
|
31
|
-
editorContentStyle:
|
|
32
|
-
editorContentClassName:
|
|
33
|
-
mainContainerStyle:
|
|
34
|
-
mainContainerClassName:
|
|
35
|
-
onKeyDown:
|
|
36
|
-
} = t, n =
|
|
25
|
+
editable: r = !0,
|
|
26
|
+
editorProps: c,
|
|
27
|
+
extensions: h,
|
|
28
|
+
onContentChange: C,
|
|
29
|
+
showBarMenu: y = !0,
|
|
30
|
+
editorContentStyle: w,
|
|
31
|
+
editorContentClassName: x,
|
|
32
|
+
mainContainerStyle: v,
|
|
33
|
+
mainContainerClassName: E,
|
|
34
|
+
onKeyDown: N
|
|
35
|
+
} = t, n = H(
|
|
37
36
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
l
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
...c,
|
|
38
|
+
extensions: [...B(t), ...h ?? []],
|
|
39
|
+
onUpdate({ editor: a }) {
|
|
40
|
+
const m = a.getHTML(), l = a.getJSON();
|
|
41
|
+
C && C({
|
|
42
|
+
jsonContent: l,
|
|
43
|
+
htmlContent: m,
|
|
44
|
+
markdownContent: b(m)
|
|
45
45
|
});
|
|
46
46
|
},
|
|
47
47
|
editorProps: {
|
|
48
48
|
attributes: {
|
|
49
49
|
class: "scribe"
|
|
50
50
|
},
|
|
51
|
-
...
|
|
51
|
+
...c == null ? void 0 : c.editorProps
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
[]
|
|
55
|
-
),
|
|
55
|
+
), g = f(() => {
|
|
56
56
|
n == null || n.commands.setContent("");
|
|
57
|
+
}, []), j = f((a) => {
|
|
58
|
+
var l;
|
|
59
|
+
const m = {
|
|
60
|
+
html: () => n == null ? void 0 : n.getHTML(),
|
|
61
|
+
json: () => n == null ? void 0 : n.getJSON(),
|
|
62
|
+
markdown: () => b((n == null ? void 0 : n.getHTML()) || "")
|
|
63
|
+
};
|
|
64
|
+
return n != null && n.isEmpty ? "" : (l = m[a]) == null ? void 0 : l.call(m);
|
|
65
|
+
}, []), M = f((a) => {
|
|
66
|
+
n == null || n.commands.setContent(a);
|
|
57
67
|
}, []);
|
|
58
|
-
return
|
|
59
|
-
resetContent:
|
|
60
|
-
|
|
68
|
+
return T(o, () => ({
|
|
69
|
+
resetContent: g,
|
|
70
|
+
setContent: M,
|
|
71
|
+
getContent: j
|
|
72
|
+
}), [g]), u(() => {
|
|
61
73
|
n == null || n.commands.setContent(e || "");
|
|
62
|
-
}, [e]),
|
|
63
|
-
n == null || n.setEditable(!!
|
|
64
|
-
}, [
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
className: m(
|
|
78
|
-
"prose max-w-none",
|
|
79
|
-
s && "w-full p-[16px]",
|
|
80
|
-
h
|
|
81
|
-
),
|
|
82
|
-
style: g,
|
|
83
|
-
children: /* @__PURE__ */ a(j, { editor: n, onKeyDown: x })
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
] })
|
|
87
|
-
}
|
|
88
|
-
);
|
|
74
|
+
}, [e]), u(() => {
|
|
75
|
+
n == null || n.setEditable(!!r);
|
|
76
|
+
}, [r]), u(() => {
|
|
77
|
+
s && (n == null || n.commands.focus("end"));
|
|
78
|
+
}, [s]), /* @__PURE__ */ i("div", { className: p("scribe-wrapper", E), style: v, id: "scribe-wrapper", children: /* @__PURE__ */ S("div", { className: p("bg-white", r && "rounded-lg border"), children: [
|
|
79
|
+
n && y && /* @__PURE__ */ i(A, { editor: n }),
|
|
80
|
+
/* @__PURE__ */ i(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
className: p("prose max-w-none", r && "w-full p-[16px]", x),
|
|
84
|
+
style: w,
|
|
85
|
+
children: /* @__PURE__ */ i(k, { editor: n, onKeyDown: N })
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] }) });
|
|
89
89
|
});
|
|
90
90
|
export {
|
|
91
91
|
R as Scribe
|
|
@@ -12077,6 +12077,9 @@ function id(r) {
|
|
|
12077
12077
|
return r.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
12078
12078
|
}
|
|
12079
12079
|
export {
|
|
12080
|
+
$s as A,
|
|
12081
|
+
Xf as B,
|
|
12082
|
+
Zf as C,
|
|
12080
12083
|
v as D,
|
|
12081
12084
|
re as E,
|
|
12082
12085
|
b as F,
|
|
@@ -12094,21 +12097,21 @@ export {
|
|
|
12094
12097
|
Yf as g,
|
|
12095
12098
|
Ks as h,
|
|
12096
12099
|
pf as i,
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
+
$o as j,
|
|
12101
|
+
Ia as k,
|
|
12102
|
+
k as l,
|
|
12100
12103
|
ic as m,
|
|
12101
|
-
|
|
12104
|
+
ed as n,
|
|
12102
12105
|
S as o,
|
|
12103
|
-
|
|
12106
|
+
Ki as p,
|
|
12104
12107
|
w as q,
|
|
12105
12108
|
x as r,
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12109
|
+
df as s,
|
|
12110
|
+
Qf as t,
|
|
12111
|
+
td as u,
|
|
12112
|
+
vo as v,
|
|
12110
12113
|
nd as w,
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
+
lt as x,
|
|
12115
|
+
_f as y,
|
|
12116
|
+
ar as z
|
|
12114
12117
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as $r, P as kr, E as Ur,
|
|
1
|
+
import { a as $r, P as kr, E as Ur, A as Fr, y as qr, B as zr, C as Kr } from "./index-CUP7vhu5.js";
|
|
2
2
|
import P, { forwardRef as Gr, useRef as Yr, useState as At, useDebugValue as cr, useEffect as _t, createContext as lr, useContext as dr, useLayoutEffect as Xr } from "react";
|
|
3
3
|
import Jr, { flushSync as Qr } from "react-dom";
|
|
4
4
|
var k = "top", G = "bottom", Y = "right", U = "left", Rt = "auto", Ue = [k, G, Y, U], Te = "start", He = "end", Zr = "clippingParents", fr = "viewport", je = "popper", en = "reference", Ht = /* @__PURE__ */ Ue.reduce(function(t, e) {
|
package/dist/main.css
CHANGED
package/dist/main.d.ts
CHANGED