Desktop markdown wiki app. Built with node, Electron Framework and AngularJS.

note-edit-ctrl.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @ngdoc function
  3. * @name domainManagerApp.controller:AboutCtrl
  4. * @description
  5. * # AboutCtrl
  6. * Controller of the domainManagerApp
  7. */
  8. angular.module('codexApp.noteEdit', [])
  9. .controller('NoteEditCtrl',['$scope', '$rootScope', '$state', 'FileService', function ($scope, $rootScope, $state, FileService) {
  10. $scope.note = FileService.getCurrentNote();
  11. $scope.container = "note-container";
  12. $scope.raw_data = $scope.note.data;
  13. $scope.savedBeforeQuit = false;
  14. console.log('-> Editing File: ' + $scope.note.path)
  15. $rootScope.$on('window-view:change', function() {
  16. if($scope.raw_data != "" && $scope.raw_data != undefined) {
  17. if($scope.savedBeforeQuit == false) {
  18. $scope.savedBeforeQuit = true;
  19. FileService.saveFile($scope.note.path, $scope.raw_data)
  20. }
  21. }
  22. });
  23. $scope.aceLoaded = function(_editor) {
  24. _editor.setReadOnly(false);
  25. //console.log($scope.raw_data);
  26. };
  27. $scope.aceChanged = function(e) {
  28. console.log("-> Note data changed.");
  29. };
  30. }]);