zs_library 0.4.12 → 0.4.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/dist/components/desktop/types.d.ts +1 -1
- package/dist/components/desktop/utils.d.ts +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4146 -12
- package/package.json +1 -6
- package/dist/components/desktop/config.js +0 -15
- package/dist/components/desktop/context/config/context.js +0 -14
- package/dist/components/desktop/context/config/hooks.js +0 -7
- package/dist/components/desktop/context/state/context.js +0 -221
- package/dist/components/desktop/context/state/hooks.js +0 -7
- package/dist/components/desktop/context-menu/index.js +0 -312
- package/dist/components/desktop/index.js +0 -40
- package/dist/components/desktop/items/group-item.js +0 -305
- package/dist/components/desktop/items/modal/group-item-modal.js +0 -158
- package/dist/components/desktop/items/modal/info-modal.js +0 -33
- package/dist/components/desktop/items/sortable-item.js +0 -120
- package/dist/components/desktop/sortable.js +0 -272
- package/dist/components/desktop/style.js +0 -18
- package/dist/components/desktop/theme.js +0 -32
- package/dist/components/desktop/utils.js +0 -15
- package/dist/components/dock/dock-desktop.js +0 -83
- package/dist/components/dock/dock-mobile.js +0 -69
- package/dist/components/dock/index.js +0 -24
- package/dist/components/dock/utils.js +0 -9
- package/dist/components/editor/editor.js +0 -199
- package/dist/components/editor/extensions/drag-handle/clipboard-serializer.js +0 -20
- package/dist/components/editor/extensions/drag-handle/index.js +0 -273
- package/dist/components/editor/extensions.js +0 -131
- package/dist/components/editor/generative/ai-completion-command.js +0 -59
- package/dist/components/editor/generative/ai-selector-commands.js +0 -78
- package/dist/components/editor/generative/ai-selector.js +0 -90
- package/dist/components/editor/generative/drag-handle.js +0 -70
- package/dist/components/editor/generative/generative-dropdown-menu.js +0 -55
- package/dist/components/editor/generative/generative-menu-switch.js +0 -59
- package/dist/components/editor/image-upload.js +0 -36
- package/dist/components/editor/index.js +0 -8
- package/dist/components/editor/lib/colors.js +0 -98
- package/dist/components/editor/lib/content.js +0 -8
- package/dist/components/editor/lib/nodes.js +0 -70
- package/dist/components/editor/lib/url-utils.js +0 -21
- package/dist/components/editor/preview.js +0 -12
- package/dist/components/editor/selectors/color-selector.js +0 -100
- package/dist/components/editor/selectors/link-selector.js +0 -82
- package/dist/components/editor/selectors/math-selector.js +0 -37
- package/dist/components/editor/selectors/node-selector.js +0 -56
- package/dist/components/editor/selectors/text-buttons.js +0 -75
- package/dist/components/editor/slash-command.js +0 -129
- package/dist/components/editor/ui/button.js +0 -44
- package/dist/components/editor/ui/command.js +0 -94
- package/dist/components/editor/ui/dialog.js +0 -68
- package/dist/components/editor/ui/dropdown-menu.js +0 -99
- package/dist/components/editor/ui/icons/crazy-spinner.js +0 -10
- package/dist/components/editor/ui/popover.js +0 -24
- package/dist/components/editor/ui/scroll-area.js +0 -39
- package/dist/components/editor/ui/separator.js +0 -25
- package/dist/components/editor/ui/tooltip.js +0 -25
- package/dist/components/md-editor/editor.js +0 -104
- package/dist/components/md-editor/i18n/index.js +0 -12
- package/dist/components/md-editor/i18n/zh_CN.js +0 -122
- package/dist/components/md-editor/index.js +0 -8
- package/dist/components/md-editor/preview.js +0 -81
- package/dist/components/md-editor/style.js +0 -267
- package/dist/components/md-editor/utils.js +0 -8
- package/dist/i18n/index.js +0 -23
- package/dist/i18n/locales/en-US.js +0 -30
- package/dist/i18n/locales/zh-CN.js +0 -30
- package/dist/node_modules/.pnpm/@tiptap_pm@2.11.5/node_modules/@tiptap/pm/view/dist/index.js +0 -3
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as t, Fragment as m, jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import { RefreshCcwDot as p, CheckCheck as d, ArrowDownWideNarrow as u, WrapText as h, StepForward as x } from "lucide-react";
|
|
4
|
-
import { useEditor as v, getPrevText as f } from "novel";
|
|
5
|
-
import { CommandGroup as n, CommandItem as c, CommandSeparator as g } from "../ui/command.js";
|
|
6
|
-
const w = [
|
|
7
|
-
{
|
|
8
|
-
value: "improve",
|
|
9
|
-
label: "改进写作",
|
|
10
|
-
// Improve writing
|
|
11
|
-
icon: p
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
value: "fix",
|
|
15
|
-
label: "修正语法",
|
|
16
|
-
// Fix grammar
|
|
17
|
-
icon: d
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
value: "shorter",
|
|
21
|
-
label: "缩短文本",
|
|
22
|
-
// Make shorter
|
|
23
|
-
icon: u
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
value: "longer",
|
|
27
|
-
label: "扩展文本",
|
|
28
|
-
// Make longer
|
|
29
|
-
icon: h
|
|
30
|
-
}
|
|
31
|
-
], A = ({ onSelect: l }) => {
|
|
32
|
-
const { editor: o } = v();
|
|
33
|
-
return /* @__PURE__ */ t(m, { children: [
|
|
34
|
-
/* @__PURE__ */ t(n, { heading: "编辑或校对选中文本", children: [
|
|
35
|
-
" ",
|
|
36
|
-
w.map((e) => /* @__PURE__ */ t(
|
|
37
|
-
c,
|
|
38
|
-
{
|
|
39
|
-
onSelect: (r) => {
|
|
40
|
-
const s = o.state.selection.content(), i = o.storage.markdown.serializer.serialize(
|
|
41
|
-
s.content
|
|
42
|
-
);
|
|
43
|
-
l(i, r);
|
|
44
|
-
},
|
|
45
|
-
className: "flex gap-2 px-4",
|
|
46
|
-
value: e.value,
|
|
47
|
-
children: [
|
|
48
|
-
/* @__PURE__ */ a(e.icon, { className: "h-4 w-4 text-purple-500" }),
|
|
49
|
-
e.label
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
e.value
|
|
53
|
-
))
|
|
54
|
-
] }),
|
|
55
|
-
/* @__PURE__ */ a(g, {}),
|
|
56
|
-
/* @__PURE__ */ t(n, { heading: "使用 AI 完成更多", children: [
|
|
57
|
-
" ",
|
|
58
|
-
/* @__PURE__ */ t(
|
|
59
|
-
c,
|
|
60
|
-
{
|
|
61
|
-
onSelect: () => {
|
|
62
|
-
const e = o.state.selection.from, r = f(o, e);
|
|
63
|
-
l(r, "continue");
|
|
64
|
-
},
|
|
65
|
-
value: "continue",
|
|
66
|
-
className: "gap-2 px-4",
|
|
67
|
-
children: [
|
|
68
|
-
/* @__PURE__ */ a(x, { className: "h-4 w-4 text-purple-500" }),
|
|
69
|
-
"继续写作"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
] })
|
|
74
|
-
] });
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
A as default
|
|
78
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as i, jsx as e, Fragment as h } from "react/jsx-runtime";
|
|
3
|
-
import { useCompletion as f } from "@ai-sdk/react";
|
|
4
|
-
import { ArrowUp as g } from "lucide-react";
|
|
5
|
-
import { useEditor as x, addAIHighlight as C } from "novel";
|
|
6
|
-
import { useState as v } from "react";
|
|
7
|
-
import A from "react-markdown";
|
|
8
|
-
import { toast as c } from "sonner";
|
|
9
|
-
import { Button as I } from "../ui/button.js";
|
|
10
|
-
import N from "../ui/icons/crazy-spinner.js";
|
|
11
|
-
import { ScrollArea as w } from "../ui/scroll-area.js";
|
|
12
|
-
import y from "./ai-completion-command.js";
|
|
13
|
-
import z from "./ai-selector-commands.js";
|
|
14
|
-
import { Command as S, CommandInput as b } from "../ui/command.js";
|
|
15
|
-
import { RiSparklingFill as k } from "@remixicon/react";
|
|
16
|
-
function K({ onOpenChange: d, options: u }) {
|
|
17
|
-
const { editor: t } = x(), [n, m] = v(""), { completion: r, complete: s, isLoading: p } = f({
|
|
18
|
-
// id: "novel",
|
|
19
|
-
api: "/api/generate",
|
|
20
|
-
onResponse: (o) => {
|
|
21
|
-
if (o.status === 429) {
|
|
22
|
-
c.error("You have reached your request limit for the day.");
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
onError: (o) => {
|
|
27
|
-
c.error(o.message);
|
|
28
|
-
},
|
|
29
|
-
...u
|
|
30
|
-
}), a = r.length > 0;
|
|
31
|
-
return /* @__PURE__ */ i(S, { className: "w-[350px]", children: [
|
|
32
|
-
a && /* @__PURE__ */ e("div", { className: "flex max-h-[400px]", children: /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e("div", { className: "prose p-2 px-4 prose-sm", children: /* @__PURE__ */ e(A, { children: r }) }) }) }),
|
|
33
|
-
p && /* @__PURE__ */ i("div", { className: "flex h-12 w-full items-center px-4 text-sm font-medium text-muted-foreground text-purple-500", children: [
|
|
34
|
-
/* @__PURE__ */ e(k, { size: 14, className: "mr-2 shrink-0" }),
|
|
35
|
-
"AI正在思考",
|
|
36
|
-
/* @__PURE__ */ e("div", { className: "ml-2 mt-1", children: /* @__PURE__ */ e(N, {}) })
|
|
37
|
-
] }),
|
|
38
|
-
!p && /* @__PURE__ */ i(h, { children: [
|
|
39
|
-
/* @__PURE__ */ i("div", { className: "relative", children: [
|
|
40
|
-
/* @__PURE__ */ e(
|
|
41
|
-
b,
|
|
42
|
-
{
|
|
43
|
-
value: n,
|
|
44
|
-
onValueChange: m,
|
|
45
|
-
autoFocus: !0,
|
|
46
|
-
placeholder: a ? "告诉AI下一步该怎么做" : "要求AI编辑或生成……",
|
|
47
|
-
onFocus: () => C(t)
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
I,
|
|
52
|
-
{
|
|
53
|
-
size: "icon",
|
|
54
|
-
className: "absolute right-2 top-1/2 h-6 w-6 -translate-y-1/2 rounded-full bg-purple-500 hover:bg-purple-900",
|
|
55
|
-
onClick: () => {
|
|
56
|
-
if (r)
|
|
57
|
-
return s(r, {
|
|
58
|
-
body: { option: "zap", command: n }
|
|
59
|
-
}).then(() => m(""));
|
|
60
|
-
const o = t.state.selection.content(), l = t.storage.markdown.serializer.serialize(
|
|
61
|
-
o.content
|
|
62
|
-
);
|
|
63
|
-
s(l, {
|
|
64
|
-
body: { option: "zap", command: n }
|
|
65
|
-
}).then(() => m(""));
|
|
66
|
-
},
|
|
67
|
-
children: /* @__PURE__ */ e(g, { className: "h-4 w-4" })
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
] }),
|
|
71
|
-
a ? /* @__PURE__ */ e(
|
|
72
|
-
y,
|
|
73
|
-
{
|
|
74
|
-
onDiscard: () => {
|
|
75
|
-
t.chain().unsetHighlight().focus().run(), d(!1);
|
|
76
|
-
},
|
|
77
|
-
completion: r
|
|
78
|
-
}
|
|
79
|
-
) : /* @__PURE__ */ e(
|
|
80
|
-
z,
|
|
81
|
-
{
|
|
82
|
-
onSelect: (o, l) => s(o, { body: { option: l } })
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
] })
|
|
86
|
-
] });
|
|
87
|
-
}
|
|
88
|
-
export {
|
|
89
|
-
K as AISelector
|
|
90
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { cx as m, css as l } from "@emotion/css";
|
|
4
|
-
import { RiAddLine as p, RiDraggable as u } from "@remixicon/react";
|
|
5
|
-
import { useEditor as h } from "novel";
|
|
6
|
-
import { Button as s } from "../ui/button.js";
|
|
7
|
-
import i from "../ui/tooltip.js";
|
|
8
|
-
import f from "./generative-dropdown-menu.js";
|
|
9
|
-
const P = () => {
|
|
10
|
-
const { editor: t } = h(), c = (d) => {
|
|
11
|
-
if (!t) return;
|
|
12
|
-
const o = d.target.closest(".custom-drag-handle");
|
|
13
|
-
if (!o) return;
|
|
14
|
-
const a = o.dataset.nodePos, n = a !== void 0 ? parseInt(o.dataset.nodePos || "0", 10) : a;
|
|
15
|
-
n !== void 0 && (t.commands.focus(), t.commands.setNodeSelection(n), t.commands.createParagraphNear() ? t.commands.insertContent("/") : t.chain().insertContentAt(n, {
|
|
16
|
-
type: "paragraph",
|
|
17
|
-
content: [{ type: "text", text: "/" }]
|
|
18
|
-
}).run());
|
|
19
|
-
};
|
|
20
|
-
return /* @__PURE__ */ r(
|
|
21
|
-
"div",
|
|
22
|
-
{
|
|
23
|
-
className: m(
|
|
24
|
-
"custom-drag-handle",
|
|
25
|
-
l`
|
|
26
|
-
width: auto;
|
|
27
|
-
background: none;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
`
|
|
31
|
-
),
|
|
32
|
-
children: [
|
|
33
|
-
/* @__PURE__ */ e(
|
|
34
|
-
i,
|
|
35
|
-
{
|
|
36
|
-
placement: "bottom",
|
|
37
|
-
overlay: /* @__PURE__ */ r("div", { children: [
|
|
38
|
-
"点击",
|
|
39
|
-
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "以在下方添加快" })
|
|
40
|
-
] }),
|
|
41
|
-
children: /* @__PURE__ */ e(
|
|
42
|
-
s,
|
|
43
|
-
{
|
|
44
|
-
size: "icon",
|
|
45
|
-
variant: "ghost",
|
|
46
|
-
className: "w-auto h-auto p-0.5",
|
|
47
|
-
onClick: c,
|
|
48
|
-
children: /* @__PURE__ */ e(p, { className: "cursor-pointer", size: 22 })
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
54
|
-
i,
|
|
55
|
-
{
|
|
56
|
-
placement: "bottom",
|
|
57
|
-
overlay: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r("div", { children: [
|
|
58
|
-
"拖动",
|
|
59
|
-
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "以移动" })
|
|
60
|
-
] }) }),
|
|
61
|
-
children: /* @__PURE__ */ e(s, { size: "icon", variant: "ghost", className: "w-auto h-auto p-0.5", children: /* @__PURE__ */ e(u, { size: 22 }) })
|
|
62
|
-
}
|
|
63
|
-
) })
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
export {
|
|
69
|
-
P as default
|
|
70
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import { RiRepeatLine as m, RiFileCopyLine as d, RiDeleteBinLine as f } from "@remixicon/react";
|
|
4
|
-
import { DropdownMenu as p } from "../ui/dropdown-menu.js";
|
|
5
|
-
import { useEditor as u } from "novel";
|
|
6
|
-
import { NodeSelection as o } from "prosemirror-state";
|
|
7
|
-
import { NODE_SELECTOR_ITEMS as y } from "../lib/nodes.js";
|
|
8
|
-
const h = ({ children: i, ...s }) => {
|
|
9
|
-
const { editor: e } = u(), r = () => {
|
|
10
|
-
e && e.state.selection instanceof o && (e.commands.deleteSelection(), e.commands.focus());
|
|
11
|
-
}, c = () => {
|
|
12
|
-
if (e && e.state.selection instanceof o) {
|
|
13
|
-
const t = e.state.selection.node, l = e.state.selection.to;
|
|
14
|
-
e.chain().insertContentAt(l, {
|
|
15
|
-
type: t.type.name,
|
|
16
|
-
attrs: { ...t.attrs },
|
|
17
|
-
content: t.content.toJSON()
|
|
18
|
-
}).focus().run();
|
|
19
|
-
}
|
|
20
|
-
}, a = y.map((t) => ({
|
|
21
|
-
key: `transform-${t.name}`,
|
|
22
|
-
icon: /* @__PURE__ */ n(t.icon, { size: 16 }),
|
|
23
|
-
label: t.name,
|
|
24
|
-
onClick: () => {
|
|
25
|
-
e && e.state.selection instanceof o && t.command(e);
|
|
26
|
-
},
|
|
27
|
-
isActive: t.isActive(e)
|
|
28
|
-
}));
|
|
29
|
-
return /* @__PURE__ */ n(p, { items: [
|
|
30
|
-
{
|
|
31
|
-
key: "transform",
|
|
32
|
-
type: "submenu",
|
|
33
|
-
icon: /* @__PURE__ */ n(m, { size: 16 }),
|
|
34
|
-
label: "转换成",
|
|
35
|
-
children: a
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
key: "duplicate",
|
|
39
|
-
icon: /* @__PURE__ */ n(d, { size: 16 }),
|
|
40
|
-
label: "创建副本",
|
|
41
|
-
onClick: c
|
|
42
|
-
},
|
|
43
|
-
{ key: "divider", type: "divider" },
|
|
44
|
-
{
|
|
45
|
-
key: "delete",
|
|
46
|
-
icon: /* @__PURE__ */ n(f, { size: 16 }),
|
|
47
|
-
label: "删除",
|
|
48
|
-
className: "text-red-500",
|
|
49
|
-
onClick: r
|
|
50
|
-
}
|
|
51
|
-
], ...s, children: i });
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
h as default
|
|
55
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as i, jsx as s } from "react/jsx-runtime";
|
|
3
|
-
import { useEditor as a, removeAIHighlight as d, EditorBubble as f } from "novel";
|
|
4
|
-
import { useEffect as c, Fragment as u } from "react";
|
|
5
|
-
import { Button as p } from "../ui/button.js";
|
|
6
|
-
import { AISelector as n } from "./ai-selector.js";
|
|
7
|
-
import { RiSparklingFill as g } from "@remixicon/react";
|
|
8
|
-
const H = ({
|
|
9
|
-
children: m,
|
|
10
|
-
open: t,
|
|
11
|
-
onOpenChange: r,
|
|
12
|
-
enableAI: o = !1,
|
|
13
|
-
aiOptions: l
|
|
14
|
-
}) => {
|
|
15
|
-
const { editor: e } = a();
|
|
16
|
-
return c(() => {
|
|
17
|
-
t || d(e);
|
|
18
|
-
}, [t]), /* @__PURE__ */ i(
|
|
19
|
-
f,
|
|
20
|
-
{
|
|
21
|
-
tippyOptions: {
|
|
22
|
-
placement: t ? "bottom-start" : "top",
|
|
23
|
-
onHidden: () => {
|
|
24
|
-
r(!1), e.chain().unsetHighlight().run();
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
className: "flex w-fit max-w-[90vw] overflow-hidden rounded-lg border border-muted bg-background shadow-xl p-1 gap-1",
|
|
28
|
-
children: [
|
|
29
|
-
t && o && /* @__PURE__ */ s(
|
|
30
|
-
n,
|
|
31
|
-
{
|
|
32
|
-
open: t,
|
|
33
|
-
onOpenChange: r,
|
|
34
|
-
options: l
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
!t && /* @__PURE__ */ i(u, { children: [
|
|
38
|
-
o && /* @__PURE__ */ i(
|
|
39
|
-
p,
|
|
40
|
-
{
|
|
41
|
-
className: "gap-1 text-purple-500",
|
|
42
|
-
variant: "ghost",
|
|
43
|
-
onClick: () => r(!0),
|
|
44
|
-
size: "sm",
|
|
45
|
-
children: [
|
|
46
|
-
/* @__PURE__ */ s(g, { size: 14 }),
|
|
47
|
-
"询问AI"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
),
|
|
51
|
-
m
|
|
52
|
-
] })
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
H as default
|
|
59
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { createImageUpload as m } from "novel";
|
|
3
|
-
import { toast as o } from "sonner";
|
|
4
|
-
const p = (e) => {
|
|
5
|
-
const s = fetch("/api/upload", {
|
|
6
|
-
method: "POST",
|
|
7
|
-
headers: {
|
|
8
|
-
"content-type": (e == null ? void 0 : e.type) || "application/octet-stream",
|
|
9
|
-
"x-vercel-filename": (e == null ? void 0 : e.name) || "image.png"
|
|
10
|
-
},
|
|
11
|
-
body: e
|
|
12
|
-
});
|
|
13
|
-
return new Promise((a, i) => {
|
|
14
|
-
o.promise(
|
|
15
|
-
s.then(async (r) => {
|
|
16
|
-
if (r.status === 200) {
|
|
17
|
-
const { url: t } = await r.json(), n = new Image();
|
|
18
|
-
n.src = t, n.onload = () => {
|
|
19
|
-
a(t);
|
|
20
|
-
};
|
|
21
|
-
} else throw r.status === 401 ? (a(e), new Error("`BLOB_READ_WRITE_TOKEN` environment variable not found, reading image locally instead.")) : new Error("Error uploading image. Please try again.");
|
|
22
|
-
}),
|
|
23
|
-
{
|
|
24
|
-
loading: "Uploading image...",
|
|
25
|
-
success: "Image uploaded successfully.",
|
|
26
|
-
error: (r) => (i(r), r.message)
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
}, g = m({
|
|
31
|
-
onUpload: p,
|
|
32
|
-
validateFn: (e) => e.type.includes("image/") ? e.size / 1024 / 1024 > 20 ? (o.error("File size too big (max 20MB)."), !1) : !0 : (o.error("File type not supported."), !1)
|
|
33
|
-
});
|
|
34
|
-
export {
|
|
35
|
-
g as uploadFn
|
|
36
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
const l = [
|
|
3
|
-
{
|
|
4
|
-
name: "默认",
|
|
5
|
-
// Default
|
|
6
|
-
color: "var(--novel-black)"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
name: "紫色",
|
|
10
|
-
// Purple
|
|
11
|
-
color: "#9333EA"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "红色",
|
|
15
|
-
// Red
|
|
16
|
-
color: "#E00000"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "黄色",
|
|
20
|
-
// Yellow
|
|
21
|
-
color: "#EAB308"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "蓝色",
|
|
25
|
-
// Blue
|
|
26
|
-
color: "#2563EB"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "绿色",
|
|
30
|
-
// Green
|
|
31
|
-
color: "#008A00"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "橙色",
|
|
35
|
-
// Orange
|
|
36
|
-
color: "#FFA500"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "粉色",
|
|
40
|
-
// Pink
|
|
41
|
-
color: "#BA4081"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "灰色",
|
|
45
|
-
// Gray
|
|
46
|
-
color: "#A8A29E"
|
|
47
|
-
}
|
|
48
|
-
], e = [
|
|
49
|
-
{
|
|
50
|
-
name: "默认背景",
|
|
51
|
-
// Default
|
|
52
|
-
color: "var(--novel-highlight-default)"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "紫色背景",
|
|
56
|
-
// Purple
|
|
57
|
-
color: "var(--novel-highlight-purple)"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: "红色背景",
|
|
61
|
-
// Red
|
|
62
|
-
color: "var(--novel-highlight-red)"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: "黄色背景",
|
|
66
|
-
// Yellow
|
|
67
|
-
color: "var(--novel-highlight-yellow)"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "蓝色背景",
|
|
71
|
-
// Blue
|
|
72
|
-
color: "var(--novel-highlight-blue)"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "绿色背景",
|
|
76
|
-
// Green
|
|
77
|
-
color: "var(--novel-highlight-green)"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "橙色背景",
|
|
81
|
-
// Orange
|
|
82
|
-
color: "var(--novel-highlight-orange)"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "粉色背景",
|
|
86
|
-
// Pink
|
|
87
|
-
color: "var(--novel-highlight-pink)"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "灰色背景",
|
|
91
|
-
// Gray
|
|
92
|
-
color: "var(--novel-highlight-gray)"
|
|
93
|
-
}
|
|
94
|
-
];
|
|
95
|
-
export {
|
|
96
|
-
e as HIGHLIGHT_COLORS,
|
|
97
|
-
l as TEXT_COLORS
|
|
98
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { RiText as i, RiH1 as c, RiH2 as o, RiH3 as n, RiListCheck as s, RiListUnordered as t, RiListOrdered as a, RiQuoteText as l, RiCodeLine as d } from "@remixicon/react";
|
|
3
|
-
const v = [
|
|
4
|
-
{
|
|
5
|
-
name: "正文",
|
|
6
|
-
// Text
|
|
7
|
-
icon: i,
|
|
8
|
-
command: (e) => e.chain().focus().clearNodes().run(),
|
|
9
|
-
isActive: (e) => e.isActive("paragraph") && !e.isActive("bulletList") && !e.isActive("orderedList")
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: "标题 1",
|
|
13
|
-
// Heading 1
|
|
14
|
-
icon: c,
|
|
15
|
-
command: (e) => e.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
|
|
16
|
-
isActive: (e) => e.isActive("heading", { level: 1 })
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "标题 2",
|
|
20
|
-
// Heading 2
|
|
21
|
-
icon: o,
|
|
22
|
-
command: (e) => e.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
|
|
23
|
-
isActive: (e) => e.isActive("heading", { level: 2 })
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "标题 3",
|
|
27
|
-
// Heading 3
|
|
28
|
-
icon: n,
|
|
29
|
-
command: (e) => e.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
|
|
30
|
-
isActive: (e) => e.isActive("heading", { level: 3 })
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "待办列表",
|
|
34
|
-
// To-do List
|
|
35
|
-
icon: s,
|
|
36
|
-
command: (e) => e.chain().focus().clearNodes().toggleTaskList().run(),
|
|
37
|
-
isActive: (e) => e.isActive("taskItem")
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "无序列表",
|
|
41
|
-
// Bullet List
|
|
42
|
-
icon: t,
|
|
43
|
-
command: (e) => e.chain().focus().clearNodes().toggleBulletList().run(),
|
|
44
|
-
isActive: (e) => e.isActive("bulletList")
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "有序列表",
|
|
48
|
-
// Numbered List
|
|
49
|
-
icon: a,
|
|
50
|
-
command: (e) => e.chain().focus().clearNodes().toggleOrderedList().run(),
|
|
51
|
-
isActive: (e) => e.isActive("orderedList")
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "引用",
|
|
55
|
-
// Quote
|
|
56
|
-
icon: l,
|
|
57
|
-
command: (e) => e.chain().focus().clearNodes().toggleBlockquote().run(),
|
|
58
|
-
isActive: (e) => e.isActive("blockquote")
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "代码块",
|
|
62
|
-
// Code
|
|
63
|
-
icon: d,
|
|
64
|
-
command: (e) => e.chain().focus().clearNodes().toggleCodeBlock().run(),
|
|
65
|
-
isActive: (e) => e.isActive("codeBlock")
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
export {
|
|
69
|
-
v as NODE_SELECTOR_ITEMS
|
|
70
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
function r(n) {
|
|
3
|
-
try {
|
|
4
|
-
return new URL(n), !0;
|
|
5
|
-
} catch {
|
|
6
|
-
return !1;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
function e(n) {
|
|
10
|
-
if (r(n)) return n;
|
|
11
|
-
try {
|
|
12
|
-
if (n.includes(".") && !n.includes(" "))
|
|
13
|
-
return new URL(`https://${n}`).toString();
|
|
14
|
-
} catch {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
e as getUrlFromString,
|
|
20
|
-
r as isValidUrl
|
|
21
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { generateHTML as o } from "@tiptap/html";
|
|
4
|
-
import { useMemo as n } from "react";
|
|
5
|
-
import { defaultExtensions as i } from "./extensions.js";
|
|
6
|
-
const u = ({ json: e }) => {
|
|
7
|
-
const t = n(() => o(e ?? {}, i), [e]);
|
|
8
|
-
return /* @__PURE__ */ r("div", { className: "tiptap ProseMirror prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full", children: /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html: t } }) });
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
u as default
|
|
12
|
-
};
|