您的位置:首页 > Web前端 > HTML5

无IDE时,使用支持HTML5的浏览器作编辑器的方法

2015-02-06 09:12 387 查看
1、样例

在任务栏中输入以下内容后将开启c/c++ 模式

data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/c_cpp");</script>


2、模式切换

想要使用其它模式的话,将代码中的ace/mode/c_cpp,替换为如下一种模式即可

Python -> ace/mode/python
C/C++ -> ace/mode/c_cpp
Java -> ace/mode/java


其它还支持 javascript, scala, coffeescript, css, html, php, latex, tex, sh, sql, lua, clojure, dart, typescript, go, groovy, json, jsp, less, lisp, lucene, perl, powershell, scss, textile, xml, yaml, xquery, liquid, diff

3、主题切换

将代码中的ace/theme/monokai,替换为如下一种主题

Eclipse -> ace/theme/eclipse
TextMate -> ace/theme/textmate


其它还支持github, ambiance, dawn, chaos, chrome, dreamweaver, xcode, vibrant_ink, solarized_dark, solarized_light, tomorrow, tomorrow_night, tomorrow_night_blue, twilight, tomorrow_night_eighties, pastel_on_dark
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: