CodeMirror: Set Focus at End of Line
CodeMirror is a WYSIWYG-like editor that allows for rich text editing on a small scale, oftentimes used to allow Markdown editing, much like ReviewBoard uses it for. One problem I've found, however, is that calling a CodeMirror instance's
focus method put the cursor at the beginning of the input, which is annoying when there is input in the field. In theory you'd always want to put the cursor at the end so that the user can continue adding to the text that's already there.
Here's a snippet that will set the cursor to the end of existing input:
// Set the cursor at the end of existing content
You would think that there would be a method which would accomplish this task, or even have
focus set the cursor to the end of input by default if the instance has existing text. Anyways, this is the code that will put the cursor at the end of your CodeMirror input instance!
Back in late 2012 it was not easy to find open source projects using
Two years ago I documented my struggles with Imposter Syndrome and the response was immense. I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions. I've even caught myself reading the post...
There you have it. Opacity is a very simple but effective...
I was recently working on a project which featured tables that were keyboard navigable so obviously using cell outlining via traditional
tabIndex=0 and element outlines was a big part of allowing the user navigate quickly and intelligently. Unfortunately I ran into a Firefox 3.6 bug...