| ... | @@ -54,7 +54,7 @@ import { resolveDiffThemeName, type DiffThemeName } from "../lib/diffRendering"; | ... | @@ -54,7 +54,7 @@ import { resolveDiffThemeName, type DiffThemeName } from "../lib/diffRendering"; |
| 54 | import { fnv1a32 } from "../lib/diffRendering"; | 54 | import { fnv1a32 } from "../lib/diffRendering"; |
| 55 | import { LRUCache } from "../lib/lruCache"; | 55 | import { LRUCache } from "../lib/lruCache"; |
| 56 | import { useTheme } from "../hooks/useTheme"; | 56 | import { useTheme } from "../hooks/useTheme"; |
| 57 | import { useClientSettings } from "../hooks/useSettings"; | 57 | import { getClientSettings } from "../hooks/useSettings"; |
| 58 | import { | 58 | import { |
| 59 | chatMarkdownClipboardPayload, | 59 | chatMarkdownClipboardPayload, |
| 60 | serializeTableElementToCsv, | 60 | serializeTableElementToCsv, |
| ... | @@ -293,10 +293,14 @@ function getHighlighterPromise(language: string): Promise<DiffsHighlighter> { | ... | @@ -293,10 +293,14 @@ function getHighlighterPromise(language: string): Promise<DiffsHighlighter> { |
| 293 | return promise; | 293 | return promise; |
| 294 | } | 294 | } |
| 295 | | 295 | |
| | 296 | function readInitialWordWrapSetting(): boolean { |
| | 297 | return getClientSettings().wordWrap; |
| | 298 | } |
| | 299 | |
| 296 | function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) { | 300 | function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) { |
| 297 | const containerRef = useRef<HTMLDivElement | null>(null); | 301 | const containerRef = useRef<HTMLDivElement | null>(null); |
| 298 | const tableRef = useRef<HTMLTableElement | null>(null); | 302 | const tableRef = useRef<HTMLTableElement | null>(null); |
| 299 | const [expanded, setExpanded] = useState(useClientSettings((settings) => settings.wordWrap)); | 303 | const [expanded, setExpanded] = useState(readInitialWordWrapSetting); |
| 300 | const [copied, setCopied] = useState(false); | 304 | const [copied, setCopied] = useState(false); |
| 301 | const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); | 305 | const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); |
| 302 | const expandLabel = expanded ? "Collapse table cells" : "Expand table cells"; | 306 | const expandLabel = expanded ? "Collapse table cells" : "Expand table cells"; |
| ... | @@ -526,7 +530,7 @@ function MarkdownCodeBlock({ | ... | @@ -526,7 +530,7 @@ function MarkdownCodeBlock({ |
| 526 | children: ReactNode; | 530 | children: ReactNode; |
| 527 | }) { | 531 | }) { |
| 528 | const [copied, setCopied] = useState(false); | 532 | const [copied, setCopied] = useState(false); |
| 529 | const [wrapped, setWrapped] = useState(useClientSettings((settings) => settings.wordWrap)); | 533 | const [wrapped, setWrapped] = useState(readInitialWordWrapSetting); |
| 530 | const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); | 534 | const copiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null); |
| 531 | const wrapLabel = wrapped ? "Disable line wrap" : "Wrap lines"; | 535 | const wrapLabel = wrapped ? "Disable line wrap" : "Wrap lines"; |
| 532 | const copyLabel = copied ? "Copied" : "Copy code"; | 536 | const copyLabel = copied ? "Copied" : "Copy code"; |