257 lines
9.5 KiB
JavaScript
257 lines
9.5 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 244263
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(462214),
|
|
n = e.i(358379),
|
|
i = e.i(616777),
|
|
r = e.i(41671);
|
|
e.i(713118);
|
|
let a = `
|
|
.markdown-content p { margin: 0 0 0.5em; }
|
|
.markdown-content h1 { font-size: 1.5em; font-weight: 700; margin: 0 0 0.5em; }
|
|
.markdown-content h2 { font-size: 1.25em; font-weight: 600; margin: 0 0 0.5em; }
|
|
.markdown-content h3 { font-size: 1.1em; font-weight: 600; margin: 0 0 0.5em; }
|
|
.markdown-content ul { padding-left: 1.5em; margin: 0 0 0.5em; list-style-type: disc; }
|
|
.markdown-content ol { padding-left: 1.5em; margin: 0 0 0.5em; list-style-type: decimal; }
|
|
.markdown-content li { margin: 0.15em 0; }
|
|
.markdown-content li p { margin: 0; }
|
|
.markdown-content hr { border: none; border-top: 1px solid var(--border-muted); margin: 0.75em 0; }
|
|
.markdown-content strong { font-weight: 700; }
|
|
.markdown-content em { font-style: italic; }
|
|
.markdown-content code { background: var(--bg-surface-secondary); padding: 0.15em 0.4em; border-radius: 3px; font-size: 0.9em; font-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace; }
|
|
.markdown-content pre { background: var(--bg-surface-secondary); padding: 0.75em 1em; border-radius: 6px; margin: 0.5em 0; overflow-x: auto; }
|
|
.markdown-content pre code { background: none; padding: 0; }
|
|
.markdown-content blockquote { border-left: 3px solid var(--border-muted); padding-left: 1em; margin: 0.5em 0; color: var(--fg-muted); }
|
|
.markdown-content a { color: #74C0FC; text-decoration: underline; }
|
|
.markdown-content table { border-collapse: collapse; width: 100%; margin: 0.5em 0; }
|
|
.markdown-content th, .markdown-content td { border: 1px solid var(--border-muted); padding: 0.4em 0.8em; text-align: left; }
|
|
.markdown-content th { background: var(--bg-surface-secondary); font-weight: 600; }
|
|
.markdown-content del { text-decoration: line-through; opacity: 0.6; }
|
|
.markdown-content .is-editor-empty:first-child::before {
|
|
content: attr(data-placeholder);
|
|
float: left;
|
|
color: var(--fg-disabled);
|
|
pointer-events: none;
|
|
height: 0;
|
|
}
|
|
.ProseMirror:focus { outline: none; }
|
|
.ProseMirror { min-height: 100px; }
|
|
`;
|
|
function o({ size: e = 14, className: n = "" }) {
|
|
return (0, t.jsx)(r.Icons.TextFile, {
|
|
width: e,
|
|
height: e,
|
|
className: n,
|
|
});
|
|
}
|
|
function s({ size: e = 14, className: n = "" }) {
|
|
return (0, t.jsx)(r.Icons.ListDetail, {
|
|
width: e,
|
|
height: e,
|
|
className: n,
|
|
});
|
|
}
|
|
let c = {
|
|
padding: "8px",
|
|
borderRadius: 12,
|
|
border: "0.5px solid var(--canvas-controls-border)",
|
|
background: "var(--canvas-controls-bg)",
|
|
boxShadow:
|
|
"0 4px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.2)",
|
|
backdropFilter: "blur(16px)",
|
|
},
|
|
l =
|
|
"flex h-8 w-8 min-w-8 items-center justify-center rounded-lg bg-transparent p-2 text-[13px] select-none transition-colors hover:bg-canvas-controls-hover",
|
|
u = "bg-canvas-controls-active text-canvas-controls-text",
|
|
h = "text-canvas-controls-text opacity-70",
|
|
f = { width: 0, borderLeft: "0.5px solid var(--canvas-controls-border)" };
|
|
function d() {
|
|
return (0, t.jsx)("div", { className: "h-4 flex-shrink-0", style: f });
|
|
}
|
|
function p(e) {
|
|
let { state: t, view: n } = e,
|
|
i = t.tr,
|
|
r = !1;
|
|
for (; i.doc.childCount > 1; ) {
|
|
let e = i.doc.lastChild;
|
|
if (
|
|
!e ||
|
|
!(e.isTextblock && "" === e.textContent.trim() && 0 === e.childCount)
|
|
)
|
|
break;
|
|
let t = i.doc.content.size,
|
|
n = t - e.nodeSize;
|
|
(i = i.delete(n, t)), (r = !0);
|
|
}
|
|
r && n.dispatch(i);
|
|
}
|
|
function g({ editor: e, onCopy: a, onExpand: o, variant: s = "floating" }) {
|
|
let f = (0, i.useEditorState)({
|
|
editor: e,
|
|
selector: ({ editor: e }) =>
|
|
e
|
|
? {
|
|
isBold: e.isActive("bold"),
|
|
isItalic: e.isActive("italic"),
|
|
isH1: e.isActive("heading", { level: 1 }),
|
|
isH2: e.isActive("heading", { level: 2 }),
|
|
isH3: e.isActive("heading", { level: 3 }),
|
|
isHeading: e.isActive("heading"),
|
|
isOrderedList: e.isActive("orderedList"),
|
|
isBulletList: e.isActive("bulletList"),
|
|
isBlockquote: e.isActive("blockquote"),
|
|
}
|
|
: {
|
|
isBold: !1,
|
|
isItalic: !1,
|
|
isH1: !1,
|
|
isH2: !1,
|
|
isH3: !1,
|
|
isHeading: !1,
|
|
isOrderedList: !1,
|
|
isBulletList: !1,
|
|
isBlockquote: !1,
|
|
},
|
|
}),
|
|
g = (0, n.useCallback)(() => {
|
|
e &&
|
|
(e.isActive("heading")
|
|
? e.chain().focus().setParagraph().toggleBulletList().run()
|
|
: e.chain().focus().toggleBulletList().run());
|
|
}, [e]),
|
|
b = (0, n.useCallback)(() => {
|
|
e &&
|
|
(e.isActive("heading")
|
|
? e.chain().focus().setParagraph().toggleOrderedList().run()
|
|
: e.chain().focus().toggleOrderedList().run());
|
|
}, [e]);
|
|
if (!e || !f) return null;
|
|
let m = [f.isH1, f.isH2, f.isH3],
|
|
w = "inline" === s;
|
|
return (0, t.jsx)("div", {
|
|
className: w
|
|
? "flex items-center"
|
|
: "nodrag nowheel z-50 flex items-center",
|
|
onMouseDown: (e) => e.preventDefault(),
|
|
children: (0, t.jsxs)("div", {
|
|
className: "relative flex items-center gap-2",
|
|
style: c,
|
|
children: [
|
|
[1, 2, 3].map((n, i) =>
|
|
(0, t.jsxs)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${l} ${m[i] ? u : h}`,
|
|
onClick: () => {
|
|
e.chain().focus().setHeading({ level: n }).run(), p(e);
|
|
},
|
|
title: `标题 ${n}`,
|
|
children: [
|
|
1 === n &&
|
|
(0, t.jsx)(r.Icons.Heading1, { width: 14, height: 14 }),
|
|
2 === n &&
|
|
(0, t.jsx)(r.Icons.Heading2, { width: 14, height: 14 }),
|
|
3 === n &&
|
|
(0, t.jsx)(r.Icons.Heading3, { width: 14, height: 14 }),
|
|
],
|
|
},
|
|
n,
|
|
),
|
|
),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${!f.isHeading ? u : h}`,
|
|
onClick: () => {
|
|
e.chain().focus().setParagraph().run(), p(e);
|
|
},
|
|
title: "正文",
|
|
children: (0, t.jsx)(r.Icons.Pilcrow, { width: 12, height: 12 }),
|
|
}),
|
|
(0, t.jsx)(d, {}),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${f.isBold ? u : h}`,
|
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
title: "粗体",
|
|
children: (0, t.jsx)(r.Icons.Bold, { width: 12, height: 12 }),
|
|
}),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${f.isItalic ? u : h}`,
|
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
title: "斜体",
|
|
children: (0, t.jsx)(r.Icons.Italic, { width: 12, height: 12 }),
|
|
}),
|
|
(0, t.jsx)(d, {}),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${f.isBulletList ? u : h}`,
|
|
onClick: g,
|
|
title: "无序列表",
|
|
children: (0, t.jsx)(r.Icons.List, { width: 14, height: 14 }),
|
|
}),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${f.isOrderedList ? u : h}`,
|
|
onClick: b,
|
|
title: "有序列表",
|
|
children: (0, t.jsx)(r.Icons.ListOrdered, {
|
|
width: 12,
|
|
height: 12,
|
|
}),
|
|
}),
|
|
(0, t.jsx)(d, {}),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${h}`,
|
|
onClick: () => e.chain().focus().setHorizontalRule().run(),
|
|
title: "分割线",
|
|
children: (0, t.jsx)(r.Icons.minus, { width: 12, height: 12 }),
|
|
}),
|
|
(0, t.jsx)(d, {}),
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${h}`,
|
|
onClick: a,
|
|
title: "复制内容",
|
|
children: (0, t.jsx)(r.Icons.Copy, { width: 12, height: 12 }),
|
|
}),
|
|
!w &&
|
|
(0, t.jsx)("button", {
|
|
type: "button",
|
|
className: `${l} ${h}`,
|
|
onClick: o,
|
|
title: "展开编辑",
|
|
children: (0, t.jsx)(r.Icons.BroadPicture, {
|
|
width: 12,
|
|
height: 12,
|
|
}),
|
|
}),
|
|
],
|
|
}),
|
|
});
|
|
}
|
|
e.s([
|
|
"MARKDOWN_CONTENT_STYLES",
|
|
0,
|
|
a,
|
|
"MarkdownToolbar",
|
|
() => g,
|
|
"NODE_HEIGHT_TEXT",
|
|
0,
|
|
200,
|
|
"Text2Icon",
|
|
() => s,
|
|
"TextIcon",
|
|
() => o,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|