diff --git a/web/screens/Chat/SimpleTextMessage/index.tsx b/web/screens/Chat/SimpleTextMessage/index.tsx index 7ebc0ebb1..8754664aa 100644 --- a/web/screens/Chat/SimpleTextMessage/index.tsx +++ b/web/screens/Chat/SimpleTextMessage/index.tsx @@ -85,11 +85,10 @@ const SimpleTextMessage: React.FC = (props) => { const codeBlockCopyEvent = useRef((e: Event) => { const target: HTMLElement = e.target as HTMLElement if (typeof target.className !== 'string') return null - const isCopyActionClassName = target?.className.includes('copy-action') - const isCodeBlockParent = - target.parentElement?.parentElement?.className.includes('code-block') - if (isCopyActionClassName || isCodeBlockParent) { + const isCopyActionClassName = target?.className.includes('copy-action') + + if (isCopyActionClassName) { const content = target?.parentNode?.querySelector('code')?.innerText ?? '' clipboard.copy(content) }