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
First, you have to add the scrollpastend. js file (https://cdnjs.cloudflare.com/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.
About. CodeMirror is open source under a permissive license (MIT). It is being developed on GitHub. Contributions are welcome.
First, you have to add the scrollpastend.js
file (https://cdnjs.cloudflare.com/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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With