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

View File

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

View File

@@ -12,10 +12,9 @@
.count {{ctrl.noteCount(ctrl.allTag)}} .count {{ctrl.noteCount(ctrl.allTag)}}
.tag{"ng-repeat" => "tag in ctrl.tags", "ng-click" => "ctrl.selectTag(tag)", "ng-class" => "{'selected' : ctrl.selectedTag == tag}"} .tag{"ng-repeat" => "tag in ctrl.tags", "ng-click" => "ctrl.selectTag(tag)", "ng-class" => "{'selected' : ctrl.selectedTag == tag}"}
.info .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-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)", "ng-change" => "ctrl.tagTitleDidChange(tag)", "ng-blur" => "ctrl.saveTag($event, tag)", "spellcheck" => "false"}
"spellcheck" => "false"}
.count {{ctrl.noteCount(tag)}} .count {{ctrl.noteCount(tag)}}
.menu{"ng-if" => "ctrl.selectedTag == tag"} .menu{"ng-if" => "ctrl.selectedTag == tag"}
%a.item{"ng-click" => "ctrl.selectedRenameTag($event, tag)", "ng-if" => "!ctrl.editingTag"} Rename %a.item{"ng-click" => "ctrl.selectedRenameTag($event, tag)", "ng-if" => "!ctrl.editingTag"} Rename