实施 CodeMirror 语法荧光笔
我正在尝试使用 this 语法荧光笔。我尝试实现他们的示例我似乎总是在萤火虫中遇到这个错误:
地点不是函数 其他地方(div);
这是我的代码,我认为这是路径问题,但一切看起来都正确:
<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>
如果您查看该示例页面的源代码,它与我的类似,文本区域中的文本不会突出显示,我总是得到那个错误。
感谢大家的帮助
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将初始化 CodeMirror 的代码更改为以下内容,我认为它会起作用:
重要的部分是使用
CodeMirror.fromTextArea
而不是new CodeMirror
并为提供值传递到 CodeMirror.fromTextArea 的对象中的路径
。Change the code that initializes CodeMirror to the following and I think it will work:
The important parts are using
CodeMirror.fromTextArea
rather thannew CodeMirror
and providing a value forpath
in the object passed intoCodeMirror.fromTextArea
.