jgm/CommonMark-site — pull request #1 by svincent (2014-12-21 00:13:40+00:00)
Title: Improve dingus' tab key behavior

This PR modifies tab behavior to more closely match user exceptions. When a user presses the tab key, the dingus in the playground text area, a tab will be inserted at the current cursor position rather than at the end of the text box. It also correctly places the caret after the tab that was just inserted.

This PR **DOES NOT** significantly change behavior of selections. Tabbing every new line in a selection is a potential area of improvement.

NOTE: I've tested this locally on Mac OS 10.10.1 with Chrome 39, Firefox 32, and Safari 8.0.2. I left in fallback behavior in case old versions of IE don't support `element.selectionStart`, though this can be removed if necessary. I've also normalized spacing and styling of the JS in the dingus.