()
| 91 | * Take us into edit mode |
| 92 | */ |
| 93 | var activateEditMode = function() { |
| 94 | $scope.editMode = true; |
| 95 | |
| 96 | if ($scope.note._id) |
| 97 | $scope.showDeleteButton = true; |
| 98 | |
| 99 | $rootScope.buttons = []; |
| 100 | |
| 101 | attachWindowUnload(); |
| 102 | |
| 103 | //Add new buttons |
| 104 | $rootScope.buttons.push(saveButton()); |
| 105 | $rootScope.buttons.push(clearButton()); |
| 106 | |
| 107 | $timeout(function() { //trick to wait for page to rerender with text area |
| 108 | $scope.editor = CodeMirror.fromTextArea(document.getElementById("note-editor"), { |
| 109 | mode: "markdown", |
| 110 | theme: "material", |
| 111 | lineNumbers: true, |
| 112 | indentUnit: 4 |
| 113 | }); |
| 114 | }); |
| 115 | |
| 116 | }; |
| 117 | |
| 118 | /** |
| 119 | * Save a note |
no test coverage detected