Does anybody know how to make a codemirror textarea resizable like text-area ?
So that the codemirror textarea can be resized by dragging their bottom down grabber corner.
I know it's possible for html divs (see div resizable like text-area) but I have not managed to achieve the same thing on code mirror.
CodeMirror is a code editor component for the web. It can be used in websites to implement a text input field with support for many editing features, and has a rich programming interface to allow further extension.
If you don't want to kill the CodeMirror instance, just change the entire document holding the text, data on markers etc. This can be done by calling cm. swapDoc(doc: CodeMirror. Doc) .
WITHOUT JQUERY , CSS only
.CodeMirror { resize: vertical; overflow: auto !important; }
After some struggle, this simple code actually worked for me. I got a resizable Codemirror Instance vertically with scroll working properly.
Some Googling suggests that it is not supported in CodeMirror but you can achieve it with jQuery UI:
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, }); $('.CodeMirror').resizable({ resize: function() { editor.setSize($(this).width(), $(this).height()); } });
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