]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/controllers.js
Trying to make the tests green.
[bookstack] / resources / assets / js / controllers.js
index c5baecf16601dda404b3a2406943fb4cd4bf0682..ac1c3487c8351b45d81eb7d2b1fa526499fe43c0 100644 (file)
@@ -259,39 +259,6 @@ module.exports = function (ngApp, events) {
 
         }]);
 
-
-    ngApp.controller('BookShowController', ['$scope', '$http', '$attrs', '$sce', function ($scope, $http, $attrs, $sce) {
-        $scope.searching = false;
-        $scope.searchTerm = '';
-        $scope.searchResults = '';
-
-        $scope.searchBook = function (e) {
-            e.preventDefault();
-            let term = $scope.searchTerm;
-            if (term.length == 0) return;
-            $scope.searching = true;
-            $scope.searchResults = '';
-            let searchUrl = window.baseUrl('/search/book/' + $attrs.bookId);
-            searchUrl += '?term=' + encodeURIComponent(term);
-            $http.get(searchUrl).then((response) => {
-                $scope.searchResults = $sce.trustAsHtml(response.data);
-            });
-        };
-
-        $scope.checkSearchForm = function () {
-            if ($scope.searchTerm.length < 1) {
-                $scope.searching = false;
-            }
-        };
-
-        $scope.clearSearch = function () {
-            $scope.searching = false;
-            $scope.searchTerm = '';
-        };
-
-    }]);
-
-
     ngApp.controller('PageEditController', ['$scope', '$http', '$attrs', '$interval', '$timeout', '$sce',
         function ($scope, $http, $attrs, $interval, $timeout, $sce) {
 
@@ -403,14 +370,8 @@ module.exports = function (ngApp, events) {
             saveDraft();
         };
 
-        // Listen to shortcuts coming via events
-        $scope.$on('editor-keydown', (event, data) => {
-            // Save shortcut (ctrl+s)
-            if (data.keyCode == 83 && (navigator.platform.match("Mac") ? data.metaKey : data.ctrlKey)) {
-                data.preventDefault();
-                saveDraft();
-            }
-        });
+        // Listen to save draft events from editor
+        $scope.$on('save-draft', saveDraft);
 
         /**
          * Discard the current draft and grab the current page