Merge pull request #36 from levlaz/tab_key

Insert 4 spaces when tab key is pressed
This commit is contained in:
Mo Bitar
2017-01-19 10:30:32 -06:00
committed by GitHub

View File

@@ -16,6 +16,15 @@ angular.module('app.frontend')
link:function(scope, elem, attrs, ctrl) {
var handler = function(event) {
// Handle Tab Key
if (event.which == 9) {
event.preventDefault();
var start = event.target.selectionStart;
var end = event.target.selectionEnd;
var spaces = " ";
event.target.value = event.target.value.substring(0, start)
+ spaces + event.target.value.substring(end);
}
if (event.ctrlKey || event.metaKey) {
switch (String.fromCharCode(event.which).toLowerCase()) {
case 's':