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, }; onChange = (value) => { this.props.onChange && this.props.onChange(value); }; render() { const { value, readOnly, fileExt } = this.props; const extensions = [...getLanguageExtensions(fileExt).filter(item => item !== null)]; return (