import LiveEditor from "../../components/Live/LiveEditor"; import LiveError from "../../components/Live/LiveError"; import LivePreview from "../../components/Live/LivePreview"; import LiveProvider from "../../components/Live/LiveProvider"; import { ThemeProvider } from "../../components/Theme/ThemePrivider"; import { useState } from "react"; import { functionBlockList } from "../../data/functionBlocks"; import ClickContextProvider from "../../components/Selected/ClickContext"; const editor = (setShowEdit: React.Dispatch>) => { return (
{functionBlockList.map((func, index) => { return (
{ functionBlockList[index].code = code }} /> {/* 插入按钮 */} {/* 删除按钮 */}
); })}
); }; export const Editor = () => { const [theme, setTheme] = useState<"system" | "dark" | "light">("system"); const [showEdit, setShowEdit] = useState(false); return (
{showEdit && editor(setShowEdit)} {!showEdit && ( <>
)} {functionBlockList.map((func, index) => { return ( { if (selected) { navigator.clipboard.writeText(selected.outerHTML); } }, }, { key: "delete", text: "删除", handler: ({ selected }) => { if (selected) { selected.remove(); } }, }, ]} > ); })}
); };