admin管理员组文章数量:1277887
So I have literally copied the "get started" code from ACE and then tried to add a marker. I copied the syntax from ACE's website which is the same as remended here: How can I highlight multiple lines with Ace?
All I get is an error in the console saying Undefined is not a function.
My goal is to add a marker so I can highlight a line of text. Any ideas why this is not working?
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");
editor.getSession().addMarker(new Range(1,0,1,200),"ace_active_line","background");
So I have literally copied the "get started" code from ACE and then tried to add a marker. I copied the syntax from ACE's website which is the same as remended here: How can I highlight multiple lines with Ace?
All I get is an error in the console saying Undefined is not a function.
My goal is to add a marker so I can highlight a line of text. Any ideas why this is not working?
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");
editor.getSession().addMarker(new Range(1,0,1,200),"ace_active_line","background");
Share
Improve this question
edited May 23, 2017 at 12:23
CommunityBot
11 silver badge
asked May 18, 2014 at 20:02
RyanYRyanY
6651 gold badge8 silver badges21 bronze badges
1 Answer
Reset to default 14Looks like you forgot to import Range
var Range = ace.require("ace/range").Range
var editor = ace.edit("editor");
editor.session.addMarker(new Range(1,0,1,200),"ace_active-line","fullLine");
also class name for active line marker have changed.
Generally when asking questions like this it is a good idea to create a jsbin like http://jsbin./ojijeb/570/edit, since it helps answering a lot
本文标签: javascriptAce Editor addMarker throwing erroStack Overflow
版权声明:本文标题:javascript - Ace Editor addMarker throwing erro - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741248589a2365362.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论