fix(TextFilePreview): make editor read-only but can be copied

This commit is contained in:
Tristan Zhang 2025-10-02 19:34:38 +08:00
parent 53e38ed1aa
commit a6c2441156

View File

@ -1,3 +1,4 @@
import { EditorState } from '@codemirror/state'
import { Modal } from 'antd'
import { useState } from 'react'
import styled from 'styled-components'
@ -55,12 +56,12 @@ const PopupContainer: React.FC<Props> = ({ text, title, extension, resolve }) =>
footer={null}>
{extension !== undefined ? (
<Editor
editable={false}
expanded={false}
height="100%"
style={{ height: '100%' }}
value={text}
language={extension}
extensions={[EditorState.readOnly.of(true)]}
/>
) : (
<Text>{text}</Text>