Editor debouncer

This commit is contained in:
Mo Bitar
2018-07-05 15:50:40 -05:00
parent 5a1d13f28e
commit 0a85469b2f
4 changed files with 8 additions and 9 deletions

View File

@@ -323,7 +323,8 @@ angular.module('app')
}
this.contentChanged = function() {
this.changesMade();
// content changes should bypass manual debouncer as we use the built in ng-model-options debouncer
this.changesMade(true);
}
this.nameChanged = function() {

View File

@@ -174,11 +174,12 @@ angular.module('app')
}
this.setNotes = function(notes) {
notes.forEach(function(note){
note.visible = true;
})
var createNew = notes.length == 0;
var createNew = this.visibleNotes().length == 0;
this.selectFirstNote(createNew);
}
@@ -218,7 +219,7 @@ angular.module('app')
}
this.createNewNote = function() {
var title = "New Note" + (this.tag.notes ? (" " + (this.tag.notes.length + 1)) : "");
var title = "New Note" + (this.tag.notes ? (" " + (this.visibleNotes().length + 1)) : "");
let newNote = modelManager.createItem({content_type: "Note", content: {text: "", title: title}});
newNote.dummy = true;
this.newNote = newNote;
@@ -253,10 +254,6 @@ angular.module('app')
note.visible = matchesTitle || matchesBody;
}
// if(this.tag.archiveTag) {
// note.visible = note.visible && note.archived;
// }
return note.visible;
}.bind(this)

View File

@@ -35,8 +35,9 @@ angular.module('app')
}
items = items || [];
return items.sort(function(a, b){
var result = items.sort(function(a, b){
return sortValueFn(a, b);
})
return result;
};
});