NOW MANAGED ON CODEBERG
Added (Ctrl+s) draft force save
Dan Brown5b9362ab0b7b
diff --git a/resources/assets/js/controllers.js b/resources/assets/js/controllers.jsindex 8f434bf7e..406fd7e77 100644--- a/resources/assets/js/controllers.js+++ b/resources/assets/js/controllers.js@@ -379,6 +379,15 @@ 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();+ }+ });+/*** Discard the current draft and grab the current page* content from the system via an AJAX request.diff --git a/resources/assets/js/directives.js b/resources/assets/js/directives.jsindex f5cf7569b..d41fdd83b 100644--- a/resources/assets/js/directives.js+++ b/resources/assets/js/directives.js@@ -185,6 +185,10 @@ module.exports = function (ngApp, events) {scope.mceChange(content);});+ editor.on('keydown', (event) => {+ scope.$emit('editor-keydown', event);+ });+editor.on('init', (e) => {scope.mceModel = editor.getContent();});@@ -305,8 +309,9 @@ module.exports = function (ngApp, events) {lastScroll = now;});- // Insert image shortcut+ // Editor key-pressesinput.keydown(event => {+ // Insert image shortcutif (event.which === 73 && event.ctrlKey && event.shiftKey) {event.preventDefault();var caretPos = input[0].selectionStart;@@ -316,7 +321,10 @@ module.exports = function (ngApp, events) {input.focus();input[0].selectionStart = caretPos + (";input[0].selectionEnd = caretPos + (';+ return;}+ // Pass key presses to controller via event+ scope.$emit('editor-keydown', event);});// Insert image from image manager