【发布时间】:2014-01-18 23:58:35
【问题描述】:
这是 Ace Editor 的 GitHub 存储库:
https://github.com/ajaxorg/ace
我猜需要的文件是:
JS
https://github.com/ajaxorg/ace-builds/blob/master/src-noconflict/ace.js
一个主题
https://github.com/ajaxorg/ace-builds/blob/master/src-noconflict/theme-tomorrow.js
A 模式
https://github.com/ajaxorg/ace-builds/blob/master/src-noconflict/mode-javascript.js
一个工人
https://raw.github.com/ajaxorg/ace-builds/master/src-noconflict/worker-javascript.js
实现如下:
HTML
<script src="/static/js/ace/ace.js"></script>
<div class="my_ace_editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}
</div>
CSS
#my_ace_editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
jQuery
$(document).ready(function() {
var editor = ace.edit("my_ace_editor");
editor.setTheme("ace/theme/tomorrow");
editor.getSession().setMode("ace/mode/javascript");
});
瓶装路线
@route('/static/js/ace/<filename>')
def server_static_js(filename):
return static_file(filename, root='/static/js/ace')
我没有收到任何 Firebug 错误,但 Ace 编辑器没有显示。
让 Ace 编辑器在 Bottle 环境中工作所需的最少文件是什么?它们需要放在哪里?
编辑:在上面添加 CSS 规则后显示 Ace 编辑器。
【问题讨论】:
标签: python-2.7 bottle ace-editor