fix(desktop): make file-preview source + markdown selectable (#44648)
body sets user-select:none for native feel and opts text back in only via [data-selectable-text='true']; the preview's source and rendered-markdown panes never set it, so code couldn't be selected or copied. Tag the Shiki code column and the markdown root. The attribute stays off the SourceView grid root so the gutter keeps its select-none and line numbers don't bleed into copied text.
This commit is contained in:
parent
6e41ca956b
commit
24f74eb888
1 changed files with 5 additions and 2 deletions
|
|
@ -287,7 +287,7 @@ const MARKDOWN_COMPONENTS = {
|
|||
|
||||
function MarkdownPreview({ text }: { text: string }) {
|
||||
return (
|
||||
<div className="preview-markdown mx-auto max-w-3xl px-4 py-3 text-sm text-foreground">
|
||||
<div className="preview-markdown mx-auto max-w-3xl px-4 py-3 text-sm text-foreground" data-selectable-text="true">
|
||||
<Streamdown components={MARKDOWN_COMPONENTS} controls={false} mode="static" parseIncompleteMarkdown={false}>
|
||||
{text}
|
||||
</Streamdown>
|
||||
|
|
@ -383,7 +383,10 @@ function SourceView({ filePath, language, text }: { filePath: string; language:
|
|||
)
|
||||
})}
|
||||
</div>
|
||||
<div className="relative [&_pre]:m-0 [&_pre]:px-3 [&_pre]:py-3 [&_pre]:bg-transparent!">
|
||||
<div
|
||||
className="relative [&_pre]:m-0 [&_pre]:px-3 [&_pre]:py-3 [&_pre]:bg-transparent!"
|
||||
data-selectable-text="true"
|
||||
>
|
||||
{selection && (
|
||||
<div
|
||||
aria-hidden
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue