diff --git a/src/components/editor/WechatEditor.tsx b/src/components/editor/WechatEditor.tsx index 96b5be0..71a9dba 100644 --- a/src/components/editor/WechatEditor.tsx +++ b/src/components/editor/WechatEditor.tsx @@ -15,7 +15,7 @@ import { MarkdownToolbar } from './components/MarkdownToolbar' import { type PreviewSize } from './constants' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { WechatStylePicker } from '@/components/template/WechatStylePicker' -import { Copy, Clock, Type } from 'lucide-react' +import { Copy, Clock, Type, Trash2 } from 'lucide-react' // 计算阅读时间(假设每分钟阅读300字) const calculateReadingTime = (text: string): string => { @@ -395,6 +395,19 @@ export default function WechatEditor() { const isScrolling = useRef(false) + // 清除编辑器内容 + const handleClear = useCallback(() => { + if (window.confirm('确定要清除所有内容吗?')) { + setValue('') + handleEditorChange('') + toast({ + title: "已清除", + description: "编辑器内容已清除", + duration: 2000 + }) + } + }, [handleEditorChange, toast]) + return (
@@ -426,13 +439,23 @@ export default function WechatEditor() { onSelect={handleTemplateSelect} />
- +
+ + +