admin管理员组文章数量:1335854
I am trying to make use of this Syntax highlighter. I have tried to implement their example and I always seem to get this error in firebug:
place is not a function else place(div);
Here is my code, I thought it was a path issue, but everything looks right:
<textarea id="code1" rows="20" cols="20">
select * from where this = done
</textarea>
<script type="text/javascript" src="codemirror/js/codemirror.js"></script>
<script type="text/javascript">
var editor = new CodeMirror('code1', {
height: "150px",
parserfile: "codemirror/contrib/sql/js/parsesql.js",
stylesheet: "css/sqlcolors.css",
textWrapping: true
});
</script>
If you look at the source code of that example page, its similar to mine yet, the text in the text area doesn't get highlighted and I always get that error.
Thanks all for any help
I am trying to make use of this Syntax highlighter. I have tried to implement their example and I always seem to get this error in firebug:
place is not a function else place(div);
Here is my code, I thought it was a path issue, but everything looks right:
<textarea id="code1" rows="20" cols="20">
select * from where this = done
</textarea>
<script type="text/javascript" src="codemirror/js/codemirror.js"></script>
<script type="text/javascript">
var editor = new CodeMirror('code1', {
height: "150px",
parserfile: "codemirror/contrib/sql/js/parsesql.js",
stylesheet: "css/sqlcolors.css",
textWrapping: true
});
</script>
If you look at the source code of that example page, its similar to mine yet, the text in the text area doesn't get highlighted and I always get that error.
Thanks all for any help
Share Improve this question edited Oct 14, 2012 at 21:50 jack 1,2631 gold badge11 silver badges7 bronze badges asked Apr 26, 2010 at 13:57 AbsAbs 58k103 gold badges282 silver badges417 bronze badges1 Answer
Reset to default 4Change the code that initializes CodeMirror to the following and I think it will work:
var editor = CodeMirror.fromTextArea('code1', {
height: "150px",
parserfile: "codemirror/contrib/sql/js/parsesql.js",
path: "codemirror/js/",
stylesheet: "css/sqlcolors.css",
textWrapping: true
});
The important parts are using CodeMirror.fromTextArea
rather than new CodeMirror
and providing a value for path
in the object passed into CodeMirror.fromTextArea
.
本文标签: javascriptImplementing CodeMirror Syntax HighlighterStack Overflow
版权声明:本文标题:javascript - Implementing CodeMirror Syntax Highlighter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742398282a2467368.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论