mirror of
https://github.com/siteboon/claudecodeui.git
synced 2025-12-16 14:59:33 +00:00
fix: fix the violation by moving useState to the top
This commit is contained in:
@@ -197,6 +197,7 @@ const safeLocalStorage = {
|
|||||||
// Common markdown components to ensure consistent rendering (tables, inline code, links, etc.)
|
// Common markdown components to ensure consistent rendering (tables, inline code, links, etc.)
|
||||||
const markdownComponents = {
|
const markdownComponents = {
|
||||||
code: ({ node, inline, className, children, ...props }) => {
|
code: ({ node, inline, className, children, ...props }) => {
|
||||||
|
const [copied, setCopied] = React.useState(false);
|
||||||
const raw = Array.isArray(children) ? children.join('') : String(children ?? '');
|
const raw = Array.isArray(children) ? children.join('') : String(children ?? '');
|
||||||
const looksMultiline = /[\r\n]/.test(raw);
|
const looksMultiline = /[\r\n]/.test(raw);
|
||||||
const inlineDetected = inline || (node && node.type === 'inlineCode');
|
const inlineDetected = inline || (node && node.type === 'inlineCode');
|
||||||
@@ -213,7 +214,6 @@ const markdownComponents = {
|
|||||||
</code>
|
</code>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const [copied, setCopied] = React.useState(false);
|
|
||||||
const textToCopy = raw;
|
const textToCopy = raw;
|
||||||
|
|
||||||
const handleCopy = () => {
|
const handleCopy = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user