Skip to content

Commit

Permalink
fix(taBind.keyevents): Attempted fix for polish character issues
Browse files Browse the repository at this point in the history
Fixes #518
  • Loading branch information
SimeonC authored and SimeonC committed Apr 1, 2015
1 parent b2c7886 commit 26226dd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/textAngular.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/taBind.js
Expand Up @@ -460,9 +460,8 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
/* istanbul ignore else: this is for catching the jqLite testing*/
if(eventData) angular.extend(event, eventData);
/* istanbul ignore else: readonly check */
var ctrlKey = event.keyCode === 17; /* bugFix: in Polish Programmer keyboard event.ctrlKey === true when altKey is pressed */
if(!_isReadonly){
if(!event.altKey && event.metaKey || ctrlKey){
if(!event.altKey && (event.metaKey || event.ctrlKey)){
// covers ctrl/command + z
if((event.keyCode === 90 && !event.shiftKey)){
_undo();
Expand Down
2 changes: 1 addition & 1 deletion src/textAngular.js
Expand Up @@ -1444,7 +1444,7 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
if(eventData) angular.extend(event, eventData);
/* istanbul ignore else: readonly check */
if(!_isReadonly){
if(!event.altKey && event.metaKey || event.ctrlKey){
if(!event.altKey && (event.metaKey || event.ctrlKey)){
// covers ctrl/command + z
if((event.keyCode === 90 && !event.shiftKey)){
_undo();
Expand Down
6 changes: 4 additions & 2 deletions test/taBind/taBind.undoManager.spec.js
Expand Up @@ -214,16 +214,18 @@ describe('taBind.undoManager', function () {
expect($rootScope.html).toBe(second);
}));

it('not alt+z', inject(function($timeout){
it('not alt+ctrl+z #518', inject(function($timeout){
if(angular.element === jQuery) {
event = jQuery.Event('keydown');
event.keyCode = 90;
event.altKey = true;
event.ctrlKey = true;
element.triggerHandler(event);
}else{
event = {
keyCode: 90,
altKey: true
altKey: true,
ctrlKey: true
};
element.triggerHandler('keydown', event);
}
Expand Down

0 comments on commit 26226dd

Please sign in to comment.