From 2891f2c0680d4c0becb6d806f36881dbe2acfd47 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Mon, 19 Jan 2026 14:10:29 +0800 Subject: [PATCH] feat(web): markdown support copy --- web/src/components/Markdown/index.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/src/components/Markdown/index.tsx b/web/src/components/Markdown/index.tsx index d16b72e4..58650207 100644 --- a/web/src/components/Markdown/index.tsx +++ b/web/src/components/Markdown/index.tsx @@ -150,9 +150,19 @@ const RbMarkdown: FC = ({ ) } + // 处理键盘快捷键 + const handleKeyDown = (e: React.KeyboardEvent) => { + if ((e.ctrlKey || e.metaKey) && e.key === 'c') { + const selection = window.getSelection() + if (selection && selection.toString()) { + navigator.clipboard.writeText(selection.toString()) + } + } + } + // 预览模式 return ( -
+