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,100 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { useEditor as f, EditorBubbleItem as n } from "novel";
|
|
4
|
-
import { Popover as h, PopoverTrigger as u, PopoverContent as x } from "../ui/popover.js";
|
|
5
|
-
import { Button as v } from "../ui/button.js";
|
|
6
|
-
import { TEXT_COLORS as c, HIGHLIGHT_COLORS as m } from "../lib/colors.js";
|
|
7
|
-
import { RiArrowDropDownLine as g, RiCheckLine as a } from "@remixicon/react";
|
|
8
|
-
import y from "../ui/tooltip.js";
|
|
9
|
-
const j = ({ open: p, onOpenChange: s }) => {
|
|
10
|
-
const { editor: t } = f();
|
|
11
|
-
if (!t) return null;
|
|
12
|
-
const l = c.find(
|
|
13
|
-
({ color: r }) => t.isActive("textStyle", { color: r })
|
|
14
|
-
), d = m.find(
|
|
15
|
-
({ color: r }) => t.isActive("highlight", { color: r })
|
|
16
|
-
);
|
|
17
|
-
return /* @__PURE__ */ o(h, { modal: !0, open: p, onOpenChange: s, children: [
|
|
18
|
-
/* @__PURE__ */ e(y, { overlay: "文本颜色", placement: "top", children: /* @__PURE__ */ e(u, { asChild: !0, children: /* @__PURE__ */ o(v, { size: "sm", className: "gap-1 rounded-md pr-0", variant: "ghost", children: [
|
|
19
|
-
/* @__PURE__ */ e(
|
|
20
|
-
"span",
|
|
21
|
-
{
|
|
22
|
-
className: "rounded-sm px-1",
|
|
23
|
-
style: {
|
|
24
|
-
color: l == null ? void 0 : l.color,
|
|
25
|
-
backgroundColor: d == null ? void 0 : d.color
|
|
26
|
-
},
|
|
27
|
-
children: "A"
|
|
28
|
-
}
|
|
29
|
-
),
|
|
30
|
-
/* @__PURE__ */ e(g, {})
|
|
31
|
-
] }) }) }),
|
|
32
|
-
/* @__PURE__ */ o(
|
|
33
|
-
x,
|
|
34
|
-
{
|
|
35
|
-
sideOffset: 5,
|
|
36
|
-
className: "my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl ",
|
|
37
|
-
align: "start",
|
|
38
|
-
children: [
|
|
39
|
-
/* @__PURE__ */ o("div", { className: "flex flex-col", children: [
|
|
40
|
-
/* @__PURE__ */ e("div", { className: "my-1 px-2 text-sm font-semibold text-muted-foreground", children: "颜色" }),
|
|
41
|
-
c.map(({ name: r, color: i }) => /* @__PURE__ */ o(
|
|
42
|
-
n,
|
|
43
|
-
{
|
|
44
|
-
onSelect: () => {
|
|
45
|
-
t.commands.unsetColor(), r !== "Default" && t.chain().focus().setColor(i || "").run(), s(!1);
|
|
46
|
-
},
|
|
47
|
-
className: "flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
className: "rounded-sm border px-2 py-px font-medium",
|
|
54
|
-
style: { color: i },
|
|
55
|
-
children: "A"
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ e("span", { children: r })
|
|
59
|
-
] }),
|
|
60
|
-
t.isActive("textStyle", { color: i }) && /* @__PURE__ */ e(a, { size: 14 })
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
r
|
|
64
|
-
))
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ o("div", { children: [
|
|
67
|
-
/* @__PURE__ */ e("div", { className: "my-1 px-2 text-sm font-semibold text-muted-foreground", children: "背景 " }),
|
|
68
|
-
m.map(({ name: r, color: i }) => /* @__PURE__ */ o(
|
|
69
|
-
n,
|
|
70
|
-
{
|
|
71
|
-
onSelect: () => {
|
|
72
|
-
t.commands.unsetHighlight(), r !== "Default" && t.chain().focus().setHighlight({ color: i }).run(), s(!1);
|
|
73
|
-
},
|
|
74
|
-
className: "flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",
|
|
75
|
-
children: [
|
|
76
|
-
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
77
|
-
/* @__PURE__ */ e(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
className: "rounded-sm border px-2 py-px font-medium",
|
|
81
|
-
style: { backgroundColor: i },
|
|
82
|
-
children: "A"
|
|
83
|
-
}
|
|
84
|
-
),
|
|
85
|
-
/* @__PURE__ */ e("span", { children: r })
|
|
86
|
-
] }),
|
|
87
|
-
t.isActive("highlight", { color: i }) && /* @__PURE__ */ e(a, { size: 14 })
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
r
|
|
91
|
-
))
|
|
92
|
-
] })
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
] });
|
|
97
|
-
};
|
|
98
|
-
export {
|
|
99
|
-
j as ColorSelector
|
|
100
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { Popover as u, PopoverTrigger as f } from "@radix-ui/react-popover";
|
|
4
|
-
import { useEditor as d } from "novel";
|
|
5
|
-
import { useRef as p, useEffect as h } from "react";
|
|
6
|
-
import { Button as s } from "../ui/button.js";
|
|
7
|
-
import { PopoverContent as g } from "../ui/popover.js";
|
|
8
|
-
import { cx as v } from "@emotion/css";
|
|
9
|
-
import { getUrlFromString as x } from "../lib/url-utils.js";
|
|
10
|
-
import { RiLink as b, RiDeleteBinLine as k, RiCheckLine as N } from "@remixicon/react";
|
|
11
|
-
import L from "../ui/tooltip.js";
|
|
12
|
-
const D = ({ open: a, onOpenChange: i }) => {
|
|
13
|
-
const o = p(null), { editor: r } = d();
|
|
14
|
-
return h(() => {
|
|
15
|
-
var t;
|
|
16
|
-
(t = o.current) == null || t.focus();
|
|
17
|
-
}), r ? /* @__PURE__ */ n(u, { modal: !0, open: a, onOpenChange: i, children: [
|
|
18
|
-
/* @__PURE__ */ e(L, { overlay: "添加链接", placement: "top", children: /* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ n(
|
|
19
|
-
s,
|
|
20
|
-
{
|
|
21
|
-
size: "sm",
|
|
22
|
-
variant: "ghost",
|
|
23
|
-
className: "gap-2 rounded-md border-none",
|
|
24
|
-
children: [
|
|
25
|
-
/* @__PURE__ */ e("p", { className: "text-base", children: /* @__PURE__ */ e(b, { size: 16 }) }),
|
|
26
|
-
/* @__PURE__ */ e(
|
|
27
|
-
"p",
|
|
28
|
-
{
|
|
29
|
-
className: v(
|
|
30
|
-
"underline decoration-stone-400 underline-offset-4",
|
|
31
|
-
{
|
|
32
|
-
"text-blue-500": r.isActive("link")
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
children: "链接 "
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
) }) }),
|
|
41
|
-
/* @__PURE__ */ e(g, { align: "start", className: "w-60 p-0", sideOffset: 10, children: /* @__PURE__ */ n(
|
|
42
|
-
"form",
|
|
43
|
-
{
|
|
44
|
-
onSubmit: (t) => {
|
|
45
|
-
const c = t.currentTarget;
|
|
46
|
-
t.preventDefault();
|
|
47
|
-
const m = c[0], l = x(m.value);
|
|
48
|
-
l && (r.chain().focus().setLink({ href: l }).run(), i(!1));
|
|
49
|
-
},
|
|
50
|
-
className: "flex p-1 ",
|
|
51
|
-
children: [
|
|
52
|
-
/* @__PURE__ */ e(
|
|
53
|
-
"input",
|
|
54
|
-
{
|
|
55
|
-
ref: o,
|
|
56
|
-
type: "text",
|
|
57
|
-
placeholder: "粘贴链接",
|
|
58
|
-
className: "flex-1 bg-background p-1 text-sm outline-none",
|
|
59
|
-
defaultValue: r.getAttributes("link").href || ""
|
|
60
|
-
}
|
|
61
|
-
),
|
|
62
|
-
r.getAttributes("link").href ? /* @__PURE__ */ e(
|
|
63
|
-
s,
|
|
64
|
-
{
|
|
65
|
-
size: "icon",
|
|
66
|
-
variant: "outline",
|
|
67
|
-
type: "button",
|
|
68
|
-
className: "flex h-8 items-center rounded-sm p-1 text-red-600 transition-all hover:bg-red-100 dark:hover:bg-red-800",
|
|
69
|
-
onClick: () => {
|
|
70
|
-
r.chain().focus().unsetLink().run(), o.current.value = "", i(!1);
|
|
71
|
-
},
|
|
72
|
-
children: /* @__PURE__ */ e(k, { className: "h-4 w-4" })
|
|
73
|
-
}
|
|
74
|
-
) : /* @__PURE__ */ e(s, { size: "icon", className: "h-8", children: /* @__PURE__ */ e(N, { className: "h-4 w-4" }) })
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
) })
|
|
78
|
-
] }) : null;
|
|
79
|
-
};
|
|
80
|
-
export {
|
|
81
|
-
D as LinkSelector
|
|
82
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { SigmaIcon as s } from "lucide-react";
|
|
4
|
-
import { useEditor as n } from "novel";
|
|
5
|
-
import { Button as m } from "../ui/button.js";
|
|
6
|
-
import { cx as c } from "@emotion/css";
|
|
7
|
-
import a from "../ui/tooltip.js";
|
|
8
|
-
const v = () => {
|
|
9
|
-
const { editor: t } = n();
|
|
10
|
-
return t ? /* @__PURE__ */ e(a, { overlay: "标记为公式", placement: "top", children: /* @__PURE__ */ e(
|
|
11
|
-
m,
|
|
12
|
-
{
|
|
13
|
-
variant: "ghost",
|
|
14
|
-
size: "sm",
|
|
15
|
-
className: "rounded-md w-12",
|
|
16
|
-
onClick: () => {
|
|
17
|
-
if (t.isActive("math"))
|
|
18
|
-
t.chain().focus().unsetLatex().run();
|
|
19
|
-
else {
|
|
20
|
-
const { from: r, to: i } = t.state.selection, o = t.state.doc.textBetween(r, i);
|
|
21
|
-
if (!o) return;
|
|
22
|
-
t.chain().focus().setLatex({ latex: o }).run();
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
children: /* @__PURE__ */ e(
|
|
26
|
-
s,
|
|
27
|
-
{
|
|
28
|
-
className: c("size-4", { "text-blue-500": t.isActive("math") }),
|
|
29
|
-
strokeWidth: 2.3
|
|
30
|
-
}
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
) }) : null;
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
v as MathSelector
|
|
37
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { useEditor as c, EditorBubbleItem as l } from "novel";
|
|
4
|
-
import { Popover as d } from "@radix-ui/react-popover";
|
|
5
|
-
import { PopoverTrigger as p, PopoverContent as f } from "../ui/popover.js";
|
|
6
|
-
import { Button as h } from "../ui/button.js";
|
|
7
|
-
import { NODE_SELECTOR_ITEMS as i } from "../lib/nodes.js";
|
|
8
|
-
import { RiArrowDropDownLine as u, RiCheckLine as v } from "@remixicon/react";
|
|
9
|
-
import x from "../ui/tooltip.js";
|
|
10
|
-
const C = ({ open: m, onOpenChange: t }) => {
|
|
11
|
-
const { editor: n } = c();
|
|
12
|
-
if (!n) return null;
|
|
13
|
-
const s = i.filter(
|
|
14
|
-
(r) => r.isActive(n)
|
|
15
|
-
).pop() ?? {
|
|
16
|
-
name: "多个选中"
|
|
17
|
-
// Multiple
|
|
18
|
-
};
|
|
19
|
-
return /* @__PURE__ */ o(d, { modal: !0, open: m, onOpenChange: t, children: [
|
|
20
|
-
/* @__PURE__ */ e(x, { overlay: "转换成", placement: "top", children: /* @__PURE__ */ e(
|
|
21
|
-
p,
|
|
22
|
-
{
|
|
23
|
-
asChild: !0,
|
|
24
|
-
className: "rounded-md border-none hover:bg-accent focus:ring-0 pr-0",
|
|
25
|
-
children: /* @__PURE__ */ o(h, { size: "sm", variant: "ghost", children: [
|
|
26
|
-
/* @__PURE__ */ e("span", { className: "whitespace-nowrap text-sm", children: s.name }),
|
|
27
|
-
/* @__PURE__ */ e(u, {})
|
|
28
|
-
] })
|
|
29
|
-
}
|
|
30
|
-
) }),
|
|
31
|
-
/* @__PURE__ */ o(f, { sideOffset: 5, align: "start", className: "w-48 p-1", children: [
|
|
32
|
-
/* @__PURE__ */ e("p", { className: "mb-2 text-sm text-secondary-foreground", children: "转换成" }),
|
|
33
|
-
" ",
|
|
34
|
-
i.map((r) => /* @__PURE__ */ o(
|
|
35
|
-
l,
|
|
36
|
-
{
|
|
37
|
-
onSelect: (a) => {
|
|
38
|
-
r.command(a), t(!1);
|
|
39
|
-
},
|
|
40
|
-
className: "flex cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent",
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
|
|
43
|
-
/* @__PURE__ */ e("div", { className: "rounded-sm border p-1", children: /* @__PURE__ */ e(r.icon, { className: "h-3 w-3" }) }),
|
|
44
|
-
/* @__PURE__ */ e("span", { children: r.name })
|
|
45
|
-
] }),
|
|
46
|
-
s.name === r.name && /* @__PURE__ */ e(v, { size: 14 })
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
r.name
|
|
50
|
-
))
|
|
51
|
-
] })
|
|
52
|
-
] });
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
C as NodeSelector
|
|
56
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
-
import { BoldIcon as c, ItalicIcon as t, UnderlineIcon as r, StrikethroughIcon as m, CodeIcon as s } from "lucide-react";
|
|
4
|
-
import { useEditor as a, EditorBubbleItem as l } from "novel";
|
|
5
|
-
import { Button as d } from "../ui/button.js";
|
|
6
|
-
import { cx as u } from "@emotion/css";
|
|
7
|
-
import v from "../ui/tooltip.js";
|
|
8
|
-
const B = () => {
|
|
9
|
-
const { editor: e } = a();
|
|
10
|
-
return e ? /* @__PURE__ */ i("div", { className: "flex", children: [
|
|
11
|
-
{
|
|
12
|
-
name: "粗体",
|
|
13
|
-
// bold
|
|
14
|
-
isActive: (o) => o.isActive("bold"),
|
|
15
|
-
command: (o) => o.chain().focus().toggleBold().run(),
|
|
16
|
-
icon: c
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "斜体",
|
|
20
|
-
// italic
|
|
21
|
-
isActive: (o) => o.isActive("italic"),
|
|
22
|
-
command: (o) => o.chain().focus().toggleItalic().run(),
|
|
23
|
-
icon: t
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "下划线",
|
|
27
|
-
// underline
|
|
28
|
-
isActive: (o) => o.isActive("underline"),
|
|
29
|
-
command: (o) => o.chain().focus().toggleUnderline().run(),
|
|
30
|
-
icon: r
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "删除线",
|
|
34
|
-
// strike
|
|
35
|
-
isActive: (o) => o.isActive("strike"),
|
|
36
|
-
command: (o) => o.chain().focus().toggleStrike().run(),
|
|
37
|
-
icon: m
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "代码",
|
|
41
|
-
// code
|
|
42
|
-
isActive: (o) => o.isActive("code"),
|
|
43
|
-
command: (o) => o.chain().focus().toggleCode().run(),
|
|
44
|
-
icon: s
|
|
45
|
-
}
|
|
46
|
-
].map((o) => /* @__PURE__ */ i(
|
|
47
|
-
l,
|
|
48
|
-
{
|
|
49
|
-
onSelect: (n) => {
|
|
50
|
-
o.command(n);
|
|
51
|
-
},
|
|
52
|
-
children: /* @__PURE__ */ i(v, { overlay: o.name, placement: "top", children: /* @__PURE__ */ i(
|
|
53
|
-
d,
|
|
54
|
-
{
|
|
55
|
-
size: "sm",
|
|
56
|
-
className: "rounded-md",
|
|
57
|
-
variant: "ghost",
|
|
58
|
-
type: "button",
|
|
59
|
-
children: /* @__PURE__ */ i(
|
|
60
|
-
o.icon,
|
|
61
|
-
{
|
|
62
|
-
className: u("h-4 w-4", {
|
|
63
|
-
"text-blue-500": o.isActive(e)
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
) })
|
|
69
|
-
},
|
|
70
|
-
o.name
|
|
71
|
-
)) }) : null;
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
B as TextButtons
|
|
75
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { Command as a, createSuggestionItems as d, renderItems as l } from "novel";
|
|
4
|
-
import { RiText as m, RiH1 as g, RiH2 as u, RiH3 as h, RiListCheck as p, RiListUnordered as f, RiListOrdered as R, RiQuoteText as T, RiCodeLine as k, RiImageLine as z } from "@remixicon/react";
|
|
5
|
-
const L = ({ uploadFn: n }) => d([
|
|
6
|
-
{
|
|
7
|
-
title: "文本",
|
|
8
|
-
// "Text",
|
|
9
|
-
description: "从纯文本开始编写。",
|
|
10
|
-
// "Just start typing with plain text.",
|
|
11
|
-
searchTerms: ["p", "paragraph"],
|
|
12
|
-
icon: /* @__PURE__ */ t(m, { size: 18 }),
|
|
13
|
-
command: ({ editor: e, range: i }) => {
|
|
14
|
-
e.chain().focus().deleteRange(i).toggleNode("paragraph", "paragraph").run();
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
title: "标题1",
|
|
19
|
-
// "Heading 1",
|
|
20
|
-
description: "大标题。",
|
|
21
|
-
// "Big section heading.",
|
|
22
|
-
searchTerms: ["title", "big", "large"],
|
|
23
|
-
icon: /* @__PURE__ */ t(g, { size: 18 }),
|
|
24
|
-
command: ({ editor: e, range: i }) => {
|
|
25
|
-
e.chain().focus().deleteRange(i).setNode("heading", { level: 1 }).run();
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
title: "标题2",
|
|
30
|
-
// "Heading 2",
|
|
31
|
-
description: "中标题。",
|
|
32
|
-
// "Medium section heading.",
|
|
33
|
-
searchTerms: ["subtitle", "medium"],
|
|
34
|
-
icon: /* @__PURE__ */ t(u, { size: 18 }),
|
|
35
|
-
command: ({ editor: e, range: i }) => {
|
|
36
|
-
e.chain().focus().deleteRange(i).setNode("heading", { level: 2 }).run();
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: "标题3",
|
|
41
|
-
// "Heading 3",
|
|
42
|
-
description: "小标题。",
|
|
43
|
-
// "Small section heading.",
|
|
44
|
-
searchTerms: ["subtitle", "small"],
|
|
45
|
-
icon: /* @__PURE__ */ t(h, { size: 18 }),
|
|
46
|
-
command: ({ editor: e, range: i }) => {
|
|
47
|
-
e.chain().focus().deleteRange(i).setNode("heading", { level: 3 }).run();
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
title: "待办清单",
|
|
52
|
-
// "To-do List",
|
|
53
|
-
description: "使用待办清单追踪任务。",
|
|
54
|
-
// "Track tasks with a to-do list.",
|
|
55
|
-
searchTerms: ["todo", "task", "list", "check", "checkbox"],
|
|
56
|
-
icon: /* @__PURE__ */ t(p, { size: 18 }),
|
|
57
|
-
command: ({ editor: e, range: i }) => {
|
|
58
|
-
e.chain().focus().deleteRange(i).toggleTaskList().run();
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
title: "项目符号列表",
|
|
63
|
-
// "Bullet List",
|
|
64
|
-
description: "创建一个简单的项目符号列表。",
|
|
65
|
-
// "Create a simple bullet list.",
|
|
66
|
-
searchTerms: ["unordered", "point"],
|
|
67
|
-
icon: /* @__PURE__ */ t(f, { size: 18 }),
|
|
68
|
-
command: ({ editor: e, range: i }) => {
|
|
69
|
-
e.chain().focus().deleteRange(i).toggleBulletList().run();
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
title: "有序列表",
|
|
74
|
-
// "Numbered List",
|
|
75
|
-
description: "创建一个带有序号的列表。",
|
|
76
|
-
// "Create a list with numbering.",
|
|
77
|
-
searchTerms: ["ordered"],
|
|
78
|
-
icon: /* @__PURE__ */ t(R, { size: 18 }),
|
|
79
|
-
command: ({ editor: e, range: i }) => {
|
|
80
|
-
e.chain().focus().deleteRange(i).toggleOrderedList().run();
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
title: "引用",
|
|
85
|
-
// "Quote",
|
|
86
|
-
description: "摘取引用。",
|
|
87
|
-
// "Capture a quote.",
|
|
88
|
-
searchTerms: ["blockquote"],
|
|
89
|
-
icon: /* @__PURE__ */ t(T, { size: 18 }),
|
|
90
|
-
command: ({ editor: e, range: i }) => e.chain().focus().deleteRange(i).toggleNode("paragraph", "paragraph").toggleBlockquote().run()
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
title: "代码",
|
|
94
|
-
// "Code",
|
|
95
|
-
description: "捕获代码段。",
|
|
96
|
-
// "Capture a code snippet.",
|
|
97
|
-
searchTerms: ["codeblock"],
|
|
98
|
-
icon: /* @__PURE__ */ t(k, { size: 18 }),
|
|
99
|
-
command: ({ editor: e, range: i }) => e.chain().focus().deleteRange(i).toggleCodeBlock().run()
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
title: "图片",
|
|
103
|
-
// "Image",
|
|
104
|
-
description: "从您的计算机上传图像。",
|
|
105
|
-
// "Upload an image from your computer.",
|
|
106
|
-
searchTerms: ["photo", "picture", "media"],
|
|
107
|
-
icon: /* @__PURE__ */ t(z, { size: 18 }),
|
|
108
|
-
command: ({ editor: e, range: i }) => {
|
|
109
|
-
e.chain().focus().deleteRange(i).run();
|
|
110
|
-
const o = document.createElement("input");
|
|
111
|
-
o.type = "file", o.accept = "image/*", o.onchange = async () => {
|
|
112
|
-
var s;
|
|
113
|
-
if ((s = o.files) != null && s.length) {
|
|
114
|
-
const c = o.files[0], r = e.view.state.selection.from;
|
|
115
|
-
n(c, e.view, r);
|
|
116
|
-
}
|
|
117
|
-
}, o.click();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
]), N = (n) => a.configure({
|
|
121
|
-
suggestion: {
|
|
122
|
-
items: () => L(n),
|
|
123
|
-
render: l
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
export {
|
|
127
|
-
N as slashCommand,
|
|
128
|
-
L as suggestionItems
|
|
129
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import * as s from "react";
|
|
4
|
-
import { Slot as d } from "@radix-ui/react-slot";
|
|
5
|
-
import { cva as c } from "class-variance-authority";
|
|
6
|
-
import { cx as u } from "@emotion/css";
|
|
7
|
-
const f = c(
|
|
8
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
15
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
16
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
17
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
18
|
-
},
|
|
19
|
-
size: {
|
|
20
|
-
default: "h-10 px-4 py-2",
|
|
21
|
-
sm: "h-7 rounded-md px-3",
|
|
22
|
-
lg: "h-11 rounded-md px-8",
|
|
23
|
-
icon: "h-10 w-10"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
variant: "default",
|
|
28
|
-
size: "default"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
), m = s.forwardRef(
|
|
32
|
-
({ className: e, variant: r, size: t, asChild: o = !1, ...n }, i) => /* @__PURE__ */ a(
|
|
33
|
-
o ? d : "button",
|
|
34
|
-
{
|
|
35
|
-
className: u(f({ variant: r, size: t, className: e })),
|
|
36
|
-
ref: i,
|
|
37
|
-
...n
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
m.displayName = "Button";
|
|
42
|
-
export {
|
|
43
|
-
m as Button
|
|
44
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
3
|
-
import { Command as e } from "cmdk";
|
|
4
|
-
import * as d from "react";
|
|
5
|
-
import "./dialog.js";
|
|
6
|
-
import { cx as m } from "@emotion/css";
|
|
7
|
-
import { RiSparklingFill as p } from "@remixicon/react";
|
|
8
|
-
const n = d.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ t(
|
|
9
|
-
e,
|
|
10
|
-
{
|
|
11
|
-
ref: r,
|
|
12
|
-
className: m(
|
|
13
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
14
|
-
a
|
|
15
|
-
),
|
|
16
|
-
...o
|
|
17
|
-
}
|
|
18
|
-
));
|
|
19
|
-
n.displayName = e.displayName;
|
|
20
|
-
const l = d.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ s("div", { className: "flex items-center border-b px-4", "cmdk-input-wrapper": "", children: [
|
|
21
|
-
/* @__PURE__ */ t(p, { size: 14, className: "mr-2 shrink-0 text-purple-500 " }),
|
|
22
|
-
/* @__PURE__ */ t(
|
|
23
|
-
e.Input,
|
|
24
|
-
{
|
|
25
|
-
ref: r,
|
|
26
|
-
className: m(
|
|
27
|
-
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
28
|
-
a
|
|
29
|
-
),
|
|
30
|
-
...o
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
] }));
|
|
34
|
-
l.displayName = e.Input.displayName;
|
|
35
|
-
const i = d.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ t(
|
|
36
|
-
e.List,
|
|
37
|
-
{
|
|
38
|
-
ref: r,
|
|
39
|
-
className: m("max-h-[300px] overflow-y-auto overflow-x-hidden", a),
|
|
40
|
-
...o
|
|
41
|
-
}
|
|
42
|
-
));
|
|
43
|
-
i.displayName = e.List.displayName;
|
|
44
|
-
const c = d.forwardRef((a, o) => /* @__PURE__ */ t(
|
|
45
|
-
e.Empty,
|
|
46
|
-
{
|
|
47
|
-
ref: o,
|
|
48
|
-
className: "py-6 text-center text-sm",
|
|
49
|
-
...a
|
|
50
|
-
}
|
|
51
|
-
));
|
|
52
|
-
c.displayName = e.Empty.displayName;
|
|
53
|
-
const f = d.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ t(
|
|
54
|
-
e.Group,
|
|
55
|
-
{
|
|
56
|
-
ref: r,
|
|
57
|
-
className: m(
|
|
58
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
59
|
-
a
|
|
60
|
-
),
|
|
61
|
-
...o
|
|
62
|
-
}
|
|
63
|
-
));
|
|
64
|
-
f.displayName = e.Group.displayName;
|
|
65
|
-
const u = d.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ t(
|
|
66
|
-
e.Separator,
|
|
67
|
-
{
|
|
68
|
-
ref: r,
|
|
69
|
-
className: m("-mx-1 h-px bg-border", a),
|
|
70
|
-
...o
|
|
71
|
-
}
|
|
72
|
-
));
|
|
73
|
-
u.displayName = e.Separator.displayName;
|
|
74
|
-
const x = d.forwardRef(({ className: a, ...o }, r) => /* @__PURE__ */ t(
|
|
75
|
-
e.Item,
|
|
76
|
-
{
|
|
77
|
-
ref: r,
|
|
78
|
-
className: m(
|
|
79
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50",
|
|
80
|
-
a
|
|
81
|
-
),
|
|
82
|
-
...o
|
|
83
|
-
}
|
|
84
|
-
));
|
|
85
|
-
x.displayName = e.Item.displayName;
|
|
86
|
-
export {
|
|
87
|
-
n as Command,
|
|
88
|
-
c as CommandEmpty,
|
|
89
|
-
f as CommandGroup,
|
|
90
|
-
l as CommandInput,
|
|
91
|
-
x as CommandItem,
|
|
92
|
-
i as CommandList,
|
|
93
|
-
u as CommandSeparator
|
|
94
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
|
-
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
3
|
-
import * as i from "react";
|
|
4
|
-
import * as a from "@radix-ui/react-dialog";
|
|
5
|
-
import { X as m } from "lucide-react";
|
|
6
|
-
import { cx as n } from "@emotion/css";
|
|
7
|
-
const c = a.Portal, l = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ s(
|
|
8
|
-
a.Overlay,
|
|
9
|
-
{
|
|
10
|
-
ref: o,
|
|
11
|
-
className: n(
|
|
12
|
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
13
|
-
t
|
|
14
|
-
),
|
|
15
|
-
...e
|
|
16
|
-
}
|
|
17
|
-
));
|
|
18
|
-
l.displayName = a.Overlay.displayName;
|
|
19
|
-
const p = i.forwardRef(({ className: t, children: e, ...o }, r) => /* @__PURE__ */ d(c, { children: [
|
|
20
|
-
/* @__PURE__ */ s(l, {}),
|
|
21
|
-
/* @__PURE__ */ d(
|
|
22
|
-
a.Content,
|
|
23
|
-
{
|
|
24
|
-
ref: r,
|
|
25
|
-
className: n(
|
|
26
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
27
|
-
t
|
|
28
|
-
),
|
|
29
|
-
...o,
|
|
30
|
-
children: [
|
|
31
|
-
e,
|
|
32
|
-
/* @__PURE__ */ d(a.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
33
|
-
/* @__PURE__ */ s(m, { className: "h-4 w-4" }),
|
|
34
|
-
/* @__PURE__ */ s("span", { className: "sr-only", children: "Close" })
|
|
35
|
-
] })
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
] }));
|
|
40
|
-
p.displayName = a.Content.displayName;
|
|
41
|
-
const f = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ s(
|
|
42
|
-
a.Title,
|
|
43
|
-
{
|
|
44
|
-
ref: o,
|
|
45
|
-
className: n(
|
|
46
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
47
|
-
t
|
|
48
|
-
),
|
|
49
|
-
...e
|
|
50
|
-
}
|
|
51
|
-
));
|
|
52
|
-
f.displayName = a.Title.displayName;
|
|
53
|
-
const g = i.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ s(
|
|
54
|
-
a.Description,
|
|
55
|
-
{
|
|
56
|
-
ref: o,
|
|
57
|
-
className: n("text-sm text-muted-foreground", t),
|
|
58
|
-
...e
|
|
59
|
-
}
|
|
60
|
-
));
|
|
61
|
-
g.displayName = a.Description.displayName;
|
|
62
|
-
export {
|
|
63
|
-
p as DialogContent,
|
|
64
|
-
g as DialogDescription,
|
|
65
|
-
l as DialogOverlay,
|
|
66
|
-
c as DialogPortal,
|
|
67
|
-
f as DialogTitle
|
|
68
|
-
};
|