Explorar o código

fix: 优化cherry-markdown快捷键 ctrl+s进行保存 (#969)

zhanzhenping hai 1 ano
pai
achega
cd9667bba7
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      static/js/cherry_markdown.js

+ 7 - 0
static/js/cherry_markdown.js

@@ -637,6 +637,13 @@ $(function () {
         }
         $("#documentTemplateModal").modal('hide');
     });
+
+    document.addEventListener('keydown', function(event) {
+        if (event.ctrlKey && event.key === 's') {
+            event.preventDefault();
+            saveDocument(true, null);
+        }
+    });
 });
 
 function myFileUpload(file, callback) {