import React from 'react'; import PropTypes from 'prop-types'; import CodeMirror from '@uiw/react-codemirror'; import { getLanguageExtensions } from './languages'; import { myTheme } from './theme'; const DEFAULT_CODEMIRROR_OPTIONS = { lineNumbers: true, highlightActiveLineGutter: false, highlightActiveLine: false, }; const propTypes = { fileExt: PropTypes.string, value: PropTypes.string, readOnly: PropTypes.bool, onChange: PropTypes.func, }; class SeafileCodeMirror extends React.Component { static defaultProps = { readOnly: true, }; constructor(props) { super(props); this.options = null; } onChange = (value) => { this.props.onChange && this.props.onChange(value); }; render() { const { value, readOnly, fileExt } = this.props; return (