我正在尝试加载ace http://ace.c9.io来自带有 requirejs 的 CDN 的主题。
Here http://plnkr.co/edit/CqQo6VDr0MyuyBkMIyQ4?p=preview是一个plunkr,它说明了我的问题。以下情况找不到主题:
requirejs.config({
paths: { ace: ['//cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/'] }
})
$('h1').text("loading ace...");
requirejs([ 'ace/ace'], function(ace) {
$('h1').text("ace loaded.")
console.log(ace)
editor = ace.edit('editor')
editor.setTheme("ace/theme/monokai")
return
})
Note: I asked 这个问题 https://stackoverflow.com/q/30888155/719276使用 CDN 的 requirejs 加载 ace 编辑器,但它没有解释如何加载 ace 主题。
ace 好像有 bug,需要调用
ace.config.set("packaged", true)
ace.config.set("basePath", require.toUrl("ace"))
before ace.edit
配置路径。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)