Merge pull request #67 from amtsh/after-delete-select-first

After deleting a note, it should select the first note on top
This commit is contained in:
Mo Bitar
2017-03-01 17:37:20 -06:00
committed by GitHub
2 changed files with 16 additions and 0 deletions

View File

@@ -224,9 +224,21 @@ angular.module('app.frontend')
if(confirm("Are you sure you want to delete this note?")) {
this.remove()(this.note);
this.showMenu = false;
this.notifyDelete();
}
}
this.notifyDelete = function() {
$timeout(function() {
$rootScope.$broadcast("noteDeleted");
}.bind(this), 500);
}
this.clickedEditNote = function() {
this.editorMode = 'edit';
this.focusEditor(100);
}
/* Tags */
this.loadTagsString = function() {

View File

@@ -41,6 +41,10 @@ angular.module('app.frontend')
this.showMenu = false;
}.bind(this))
$rootScope.$on("noteDeleted", function() {
this.selectFirstNote(false);
}.bind(this))
this.notesToDisplay = 20;
this.paginate = function() {
this.notesToDisplay += 20