Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
Almost fixed #5
Browse files Browse the repository at this point in the history
  • Loading branch information
aurbano committed Apr 17, 2015
1 parent 93128ff commit 57e5db4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions dist/smart-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ angular.module('smartArea', [])
position = getCharacterPosition();

$scope.fakeArea = $sce.trustAsHtml(text.substring(0, position) + '<span class="sa-tracking"></span>' + text.substring(position));

// Tracking span
$timeout(function(){
var span = $scope.fakeAreaElement.find('span.sa-tracking');
Expand Down Expand Up @@ -411,6 +411,15 @@ angular.module('smartArea', [])
}
});
}

/**
* Set the scroll on the fake area
*/
function resetScroll(){
$timeout(function(){
$scope.fakeAreaElement.scrollTop($element.scrollTop());
}, 5);
}

/**
* Trigger a simple autocomplete, this checks the last word and determines
Expand Down Expand Up @@ -479,7 +488,10 @@ angular.module('smartArea', [])
}, 0);
});

$element.bind('keydown', $scope.keyboardEvents);
$element.bind('keydown', function(event){
resetScroll();
$scope.keyboardEvents(event);
});
}]
};
});
4 changes: 2 additions & 2 deletions dist/smart-area.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57e5db4

Please sign in to comment.