fixes firefox tag selection issue

This commit is contained in:
Mo Bitar
2017-03-10 15:04:46 -06:00
parent 39e5bbf966
commit ef76db5e7e
3 changed files with 12 additions and 9 deletions

View File

@@ -69,11 +69,6 @@ angular.module('app.frontend')
this.addNew()(this.newTag);
}
var originalTagName = "";
this.onTagTitleFocus = function(tag) {
originalTagName = tag.title;
}
this.tagTitleDidChange = function(tag) {
this.editingTag = tag;
}
@@ -99,10 +94,16 @@ angular.module('app.frontend')
}.bind(this));
}
function inputElementForTag(tag) {
return document.getElementById("tag-" + tag.uuid);
}
var originalTagName = "";
this.selectedRenameTag = function($event, tag) {
originalTagName = tag.title;
this.editingTag = tag;
$timeout(function(){
document.getElementById("tag-" + tag.uuid).focus();
inputElementForTag(tag).focus();
})
}

View File

@@ -42,6 +42,7 @@
> .info {
height: 20px;
> .title {
width: 80%;
background-color: transparent;
@@ -52,6 +53,8 @@
cursor: pointer;
text-overflow: ellipsis;
width: 75%;
pointer-events: none;
}
> .count {

View File

@@ -12,10 +12,9 @@
.count {{ctrl.noteCount(ctrl.allTag)}}
.tag{"ng-repeat" => "tag in ctrl.tags", "ng-click" => "ctrl.selectTag(tag)", "ng-class" => "{'selected' : ctrl.selectedTag == tag}"}
.info
%input.title{"ng-attr-id" => "tag-{{tag.uuid}}", "ng-disabled" => "ctrl.editingTag != tag", "ng-model" => "tag.title",
%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)", "mb-autofocus" => "true", "should-focus" => "ctrl.newTag || ctrl.editingTag == tag",
"ng-change" => "ctrl.tagTitleDidChange(tag)", "ng-focus" => "ctrl.onTagTitleFocus(tag)", "ng-blur" => "ctrl.saveTag($event, tag)",
"spellcheck" => "false"}
"ng-change" => "ctrl.tagTitleDidChange(tag)", "ng-blur" => "ctrl.saveTag($event, tag)", "spellcheck" => "false"}
.count {{ctrl.noteCount(tag)}}
.menu{"ng-if" => "ctrl.selectedTag == tag"}
%a.item{"ng-click" => "ctrl.selectedRenameTag($event, tag)", "ng-if" => "!ctrl.editingTag"} Rename