伙计们,我最近一直在使用 cloud9 ide,我想将 ace 编辑器添加到我的网站。查看ace编辑器,这里是链接:http : //ace.c9.io/#nav=about
有人可以告诉我如何将它嵌入我的网站。ace编辑器首页给的教程看不懂
感谢所有帮助。
嵌入到您的网站上清楚地显示在网站上: http://ace.c9.io/#nav=embedding
例子:
<!DOCTYPE html>
<html lang="en">
<head>
<title>ACE in Action</title>
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<div id="editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}</div>
<script src="/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Cloud9 IDE
如果您使用cloud9 IDE,您可以通过以下方式下载编辑器。
git clone git://github.com/ajaxorg/ace.gitbower install --save git clone git://github.com/ajaxorg/ace.git注意:您将需要构建该项目。
如果您想使用预构建的,请使用以下命令:
https://github.com/ajaxorg/ace-builds.git
示例 这是我对 ace-editor 的设置: https://ide.c9.io/anik786/cloud-9-sandbox