Fixes issue where save tag is called twice because of blur + enter. Make enter blur instead, calls it only once. Calling it twice results in issue where dummy note is deleted, creating invalid interface state
This commit is contained in:
@@ -144,11 +144,11 @@ angular.module('app')
|
||||
}
|
||||
|
||||
$scope.tagsSelectionMade = function(tag) {
|
||||
$scope.selectedTag = tag;
|
||||
|
||||
if($scope.selectedNote && $scope.selectedNote.dummy) {
|
||||
modelManager.removeItemLocally($scope.selectedNote);
|
||||
}
|
||||
|
||||
$scope.selectedTag = tag;
|
||||
}
|
||||
|
||||
$scope.tagsAddNew = function(tag) {
|
||||
|
||||
@@ -129,10 +129,12 @@ angular.module('app')
|
||||
return;
|
||||
}
|
||||
|
||||
this.save()(tag, function(savedTag){
|
||||
this.selectTag(tag);
|
||||
this.newTag = null;
|
||||
}.bind(this));
|
||||
this.save()(tag, (savedTag) => {
|
||||
$timeout(() => {
|
||||
this.selectTag(tag);
|
||||
this.newTag = null;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function inputElementForTag(tag) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
.tag{"ng-repeat" => "tag in ctrl.tags track by tag.uuid", "ng-click" => "ctrl.selectTag(tag)", "ng-class" => "{'selected' : ctrl.selectedTag == tag}"}
|
||||
.info
|
||||
%input.title{"ng-attr-id" => "tag-{{tag.uuid}}", "ng-click" => "ctrl.selectTag(tag)", "ng-model" => "tag.title",
|
||||
"ng-keyup" => "$event.keyCode == 13 && ctrl.saveTag($event, tag)", "sn-autofocus" => "true", "should-focus" => "ctrl.newTag || ctrl.editingTag == tag",
|
||||
"ng-keyup" => "$event.keyCode == 13 && $event.target.blur()", "sn-autofocus" => "true", "should-focus" => "ctrl.newTag || ctrl.editingTag == tag",
|
||||
"ng-change" => "ctrl.tagTitleDidChange(tag)", "ng-blur" => "ctrl.saveTag($event, tag)", "spellcheck" => "false"}
|
||||
.count {{ctrl.noteCount(tag)}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user