ace是一款优秀的开源在线代码编辑器
github下载地址:https://github.com/ajaxorg/ace
下载源码>打开命令行窗口- git clone https://github.com/ajaxorg/ace.git
2.进入ace-demo目录,每个html页面有不同的功能,可以自己测试看一下。
但是打开autocompletion.html页面时,报错如下
couldn't find ace.js file,
to build it run node Makefile.dryice.js full
是因为我们需要编译ace源码。
3.编译ace源码。查看ace根目录下的Readme.md文件,按如下方式进行编译。
Building Ace
-----------
You do not generally need to build ACE. The [ace-builds repository](https://github.com/ajaxorg/ace-builds/) endeavours to maintain the latest build, and you can just copy one of _src*_ subdirectories somewhere into your project.
However, all you need is Node.js and npm installed to package ACE. Just run `npm install` in the ace folder to install dependencies:
```bash
npm install
node ./Makefile.dryice.js
4.更改autocompletion.html(自动提示+联想)文件
ACE Autocompletion demobody {
overflow: hidden;
}
#editor {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
// trigger extension
ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.session.setMode("ace/mode/html");
editor.setTheme("ace/theme/tomorrow");
// enable autocompletion and snippets
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
标签:github,自定义,ace,js,编辑器,html,editor,源码
来源: https://blog.csdn.net/kongxingxing/article/details/98481023