admin管理员组文章数量:1295692
I am Implementing ace into my site for the first time and I have some noob questions. I have only been programming for about a year so bear with me.
I have downloaded the code from . I am assuming (could be wrong) the code I need lies in /lib/ace/ so I copied the ace folder to my /lib/js/ in my dev environment. I imported the ace.js per the instructions on the github wiki.
<script type="text/javascript" src="lib/js/ace/ace.js" charset="utf-8"></script>
I have my HTML code also:
<script>
window.onload = function() {
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
var JavaScriptMode = require("ace/mode/javascript").Mode;
editor.getSession().setMode(new JavaScriptMode())
};
</script>
<div id="editor"></div>
CSS:
#editor {
width: 800px;
height: 690px;
}
Firebug tells me ace is not defined where I am declaring my variable "editor" and also gives me this output:
missing variable name
const function (require, exports, module) {
that is from the ace.js. So I am missing something with getting this basic Implementation working.
I am Implementing ace into my site for the first time and I have some noob questions. I have only been programming for about a year so bear with me.
I have downloaded the code from https://github./ajaxorg/ace. I am assuming (could be wrong) the code I need lies in /lib/ace/ so I copied the ace folder to my /lib/js/ in my dev environment. I imported the ace.js per the instructions on the github wiki.
<script type="text/javascript" src="lib/js/ace/ace.js" charset="utf-8"></script>
I have my HTML code also:
<script>
window.onload = function() {
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
var JavaScriptMode = require("ace/mode/javascript").Mode;
editor.getSession().setMode(new JavaScriptMode())
};
</script>
<div id="editor"></div>
CSS:
#editor {
width: 800px;
height: 690px;
}
Firebug tells me ace is not defined where I am declaring my variable "editor" and also gives me this output:
missing variable name
const function (require, exports, module) {
that is from the ace.js. So I am missing something with getting this basic Implementation working.
Share edited Nov 27, 2012 at 7:02 HostileFork says dont trust SE 33.6k13 gold badges102 silver badges174 bronze badges asked Apr 18, 2012 at 20:37 JBurlisonJBurlison 6733 gold badges14 silver badges25 bronze badges4 Answers
Reset to default 7You downloaded the source which requires require.js.
You should download one of the builds from https://github./ajaxorg/ace-builds to get started without additional requirements.
You must position your editor-div, either use "position:relative;" or "position:absolute;" in your css too.
Have you tried removing the window.load action?
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
</script>
<div id="editor"></div>
It's described on their official website pletely clear.
Just clone ace-builds github repository
and then create html file as described on ace official website.
HTML file should load this js script /ace-builds/src-noconflict/ace.js
本文标签: javascriptImplementing and working with ace for the first timeStack Overflow
版权声明:本文标题:javascript - Implementing and working with ace for the first time - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741622568a2388895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论