admin管理员组文章数量:1291519
I am trying to add the scroll past end
add-on for codemirror but I cannot add it to my codemirror instance.
I tried calling it like this scrollPastEnd: true
in the options but that didn't work. I also tried using the defineOption
function but the console says it is undefined
.
Thanks for the help
I am trying to add the scroll past end
add-on for codemirror but I cannot add it to my codemirror instance.
I tried calling it like this scrollPastEnd: true
in the options but that didn't work. I also tried using the defineOption
function but the console says it is undefined
.
Thanks for the help
Share asked Oct 22, 2016 at 5:27 Corentin CaerCorentin Caer 3313 silver badges10 bronze badges1 Answer
Reset to default 9First, you have to add the scrollpastend.js
file (https://cdnjs.cloudflare./ajax/libs/codemirror/5.32.0/addon/scroll/scrollpastend.min.js) to your HTML document and not to the editor.
As the following code from scrollpastend.js
file says, the scrollPastEnd
option is off by default:
CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) {..});
Then It only remains to activate your add-on by setting new option like this:
editor.setOption("scrollPastEnd", true);
or adding scrollPastEnd
option to the object option list:
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "html",
lineNumbers: true,
scrollPastEnd: true
});
Hoping to help you, I wish you a good day.
本文标签: javascriptCodemirrorhow to add addonsStack Overflow
版权声明:本文标题:javascript - Codemirror, how to add add-ons - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741534633a2383957.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论