与Sublime,Vim和TextMate等本机编辑器的功能和性能相匹配
可以轻松地嵌入任何网页和JavaScript应用程序中
React-Ace是Ace 的react 封装版本,使用简单,方便配合form表单使用
代码提示自动补全
修改代码补全内容、获取代码
获取代码格式报错信息
高亮并且添加自定义补全代码
设置代码内容(json)
import AceEditor from 'react-ace'; // 引用实例import 'brace/mode/twilight'; // 引用自定义主题import 'brace/mode/c_cpp'; // 定义为c_cpp代码高亮import 'brace/ext/language_tools'; // 增加代码提示// 增加需要自定义的代码提示const completers = [{name: 'word',value: 'word',score: 100,meta: 'keyword'}];function App() {const complete = editor => {editor.completers.push({getCompletions: function (editors, session, pos, prefix, callback) {callback(null, completers);}});};return (<AceEditorclassName={styles.codeEditor}mode="c_cpp"name="UNIQUE_ID_OF_DIV"setOptions={{enableBasicAutocompletion: false,enableLiveAutocompletion: true,enableSnippets: false,showLineNumbers: true,tabSize: 4}}style={{ height: '98%', fontSize: '12px', border: '1px solid #d9d9d9' }}theme={theme}value={code}width={width === 0 ? '100%' : `${width}px`}onLoad={complete}/>);}
https://blog.csdn.net/wsh2467991332/article/details/90904332
https://blog.csdn.net/chenlincc/article/details/106789070
https://blog.csdn.net/qq_36598097/article/details/105700261
