insert tags by sorted titles

This commit is contained in:
Foster Hoff
2017-01-18 13:07:06 -08:00
parent 13e397a4ed
commit c258f18667

View File

@@ -117,7 +117,7 @@ class ModelManager {
items.forEach(function(item){ items.forEach(function(item){
if(item.content_type == "Tag") { if(item.content_type == "Tag") {
if(!_.find(this.tags, {uuid: item.uuid})) { if(!_.find(this.tags, {uuid: item.uuid})) {
this.tags.unshift(item); this.tags.splice(_.sortedIndexBy(this.tags, item, 'title'), 0, item);
} }
} else if(item.content_type == "Note") { } else if(item.content_type == "Note") {
if(!_.find(this.notes, {uuid: item.uuid})) { if(!_.find(this.notes, {uuid: item.uuid})) {
@@ -128,7 +128,7 @@ class ModelManager {
this._extensions.unshift(item); this._extensions.unshift(item);
} }
} }
}.bind(this)) }.bind(this));
} }
addItem(item) { addItem(item) {