diff --git a/app/assets/javascripts/app/frontend/controllers/editor.js b/app/assets/javascripts/app/frontend/controllers/editor.js index b57f2e1ea..c9e8c9016 100644 --- a/app/assets/javascripts/app/frontend/controllers/editor.js +++ b/app/assets/javascripts/app/frontend/controllers/editor.js @@ -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() { diff --git a/app/assets/javascripts/app/frontend/controllers/notes.js b/app/assets/javascripts/app/frontend/controllers/notes.js index 0ddf86061..579d3e1d0 100644 --- a/app/assets/javascripts/app/frontend/controllers/notes.js +++ b/app/assets/javascripts/app/frontend/controllers/notes.js @@ -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