Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
chore(build): Updated build files [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mbenford committed Dec 1, 2013
1 parent 84bb916 commit 30c2d21
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 68 deletions.
136 changes: 68 additions & 68 deletions build/ng-tags-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ angular.module('tags-input').directive('tagsInput', ["configuration", function(c
},
trigger: function(name, args) {
angular.forEach(events[name], function(handler) {
handler(args);
handler.call(null, args);
});
}
};
Expand Down Expand Up @@ -126,6 +126,7 @@ angular.module('tags-input').directive('tagsInput', ["configuration", function(c
}

$scope.newTag = '';
events.trigger('input-changed', '');
changed = true;
}
return changed;
Expand Down Expand Up @@ -168,23 +169,27 @@ angular.module('tags-input').directive('tagsInput', ["configuration", function(c
shouldRemoveLastTag = false;
});

$scope.newTagChange = angular.noop;

this.registerAutocomplete = function() {
var input = $element.find('input');
input.changeValue = function(value) {
$scope.newTag = value;
};
input.on('keydown', function(e) {
events.trigger('input-keydown', e);
});

input.change = function(handler) {
$scope.newTagChange = function() {
handler($scope.newTag);
};
$scope.newTagChange = function() {
events.trigger('input-changed', $scope.newTag);
};

return {
input: input,
events: events
changeInputValue: function(value) {
$scope.newTag = value;
},
focusInput: function() {
input[0].focus();
},
on: function(name, handler) {
events.on(name, handler);
return this;
}
};
};
}],
Expand Down Expand Up @@ -324,7 +329,7 @@ angular.module('tags-input').directive('autoComplete', ["$document","$timeout","
'</div>',
link: function(scope, element, attrs, tagsInputCtrl) {
var hotkeys = [KEYS.enter, KEYS.tab, KEYS.escape, KEYS.up, KEYS.down],
suggestionList, tagsInput, input, highlight;
suggestionList, tagsInput, highlight;

configuration.load(scope, attrs, {
debounceDelay: { type: Number, defaultValue: 100 },
Expand All @@ -335,7 +340,6 @@ angular.module('tags-input').directive('autoComplete', ["$document","$timeout","

suggestionList = new SuggestionList(scope.source, scope.options);
tagsInput = tagsInputCtrl.registerAutocomplete();
input = tagsInput.input;

if (scope.options.highlightMatchedText) {
highlight = function(item, text) {
Expand All @@ -355,9 +359,9 @@ angular.module('tags-input').directive('autoComplete', ["$document","$timeout","
var added = false;

if (suggestionList.selected) {
input.changeValue(suggestionList.selected);
tagsInput.changeInputValue(suggestionList.selected);
suggestionList.reset();
input[0].focus();
tagsInput.focusInput();

added = true;
}
Expand All @@ -368,71 +372,67 @@ angular.module('tags-input').directive('autoComplete', ["$document","$timeout","
return $sce.trustAsHtml(highlight(item, suggestionList.query));
};

input.change(function(value) {
if (value) {
suggestionList.load(value);
} else {
suggestionList.reset();
}
});

input.on('keydown', function(e) {
var key, handled;
tagsInput
.on('input-changed', function(value) {
if (value) {
suggestionList.load(value);
} else {
suggestionList.reset();
}
})
.on('input-keydown', function(e) {
var key, handled;

if (hotkeys.indexOf(e.keyCode) === -1) {
return;
}
if (hotkeys.indexOf(e.keyCode) === -1) {
return;
}

// This hack is needed because jqLite doesn't implement stopImmediatePropagation properly.
// I've sent a PR to Angular addressing this issue and hopefully it'll be fixed soon.
// https://github.com/angular/angular.js/pull/4833
var immediatePropagationStopped = false;
e.stopImmediatePropagation = function() {
immediatePropagationStopped = true;
e.stopPropagation();
};
e.isImmediatePropagationStopped = function() {
return immediatePropagationStopped;
};
// This hack is needed because jqLite doesn't implement stopImmediatePropagation properly.
// I've sent a PR to Angular addressing this issue and hopefully it'll be fixed soon.
// https://github.com/angular/angular.js/pull/4833
var immediatePropagationStopped = false;
e.stopImmediatePropagation = function() {
immediatePropagationStopped = true;
e.stopPropagation();
};
e.isImmediatePropagationStopped = function() {
return immediatePropagationStopped;
};

if (suggestionList.visible) {
key = e.keyCode;
handled = false;
if (suggestionList.visible) {
key = e.keyCode;
handled = false;

if (key === KEYS.down) {
suggestionList.selectNext();
handled = true;
}
else if (key === KEYS.up) {
suggestionList.selectPrior();
handled = true;
}
else if (key === KEYS.escape) {
suggestionList.reset();
handled = true;
}
else if (key === KEYS.enter || key === KEYS.tab) {
handled = scope.addSuggestion();
}
if (key === KEYS.down) {
suggestionList.selectNext();
handled = true;
}
else if (key === KEYS.up) {
suggestionList.selectPrior();
handled = true;
}
else if (key === KEYS.escape) {
suggestionList.reset();
handled = true;
}
else if (key === KEYS.enter || key === KEYS.tab) {
handled = scope.addSuggestion();
}

if (handled) {
e.preventDefault();
e.stopImmediatePropagation();
scope.$apply();
if (handled) {
e.preventDefault();
e.stopImmediatePropagation();
scope.$apply();
}
}
}
});
});

$document.on('click', function() {
if (suggestionList.visible) {
suggestionList.reset();
scope.$apply();
}
});

tagsInput.events.on('tag-added', function() {
suggestionList.reset();
});
}
};
}]);
Expand Down
Binary file modified build/ng-tags-input.min.zip
Binary file not shown.
Binary file modified build/ng-tags-input.zip
Binary file not shown.

0 comments on commit 30c2d21

Please sign in to comment.