AlloyUI Ace-Editor主题变化

时间:2017-07-19 14:14:39

标签: ace-editor alloy-ui

我无法找到更改AllouUI小部件内置的Ace-Editor的方法。下面的例子是我想用theme属性实现的。

YUI().use( 'aui-ace-autocomplete-base', function(Y) { var editor = new Y.AceEditor( { boundingBox: '#myEditor', height: '200', mode: 'python', value: 'print("Hello there!!!")', width: '700', theme: 'chaos' } ).render(); 可悲的是,在代码中没有我预见到的改变主题的方式。

是否有办法将主题更改为Alloyui的小部件的ace编辑器?

2 个答案:

答案 0 :(得分:0)

不确定Y.AceEditor组件是否公开了所需的api,但你可以尝试获取真正的ace编辑器对象,它允许动态更改主题

document.getElementById('#myEditor').env.editor.setTheme("ace/theme/chtome")

答案 1 :(得分:0)

您应该可以致电AceEditor.getEditor() .setTheme()

editor.getEditor().setTheme('ace/theme/twilight');
相关问题