From 9d71adc05c93577d64f47180e3429bf3cd9a7be0 Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Sun, 18 Sep 2016 16:30:08 +0800
Subject: Add support of shortcut keys for changeMode
---
bower.json | 3 ++-
public/js/index.js | 12 ++++++++++++
public/views/foot.ejs | 1 +
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/bower.json b/bower.json
index 418aeec0..dfa8b364 100644
--- a/bower.json
+++ b/bower.json
@@ -57,7 +57,8 @@
"string": "^3.3.1",
"visibilityjs": "^1.2.3",
"pdfobject": "pdfobject2#*",
- "gist-embed": "*"
+ "gist-embed": "*",
+ "keymaster": "^1.6.3"
},
"resolutions": {
"jquery": "~3.1.0"
diff --git a/public/js/index.js b/public/js/index.js
index dbedd66c..d9e4955f 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -805,6 +805,18 @@ $(document).ready(function () {
});
//tooltip
$('[data-toggle="tooltip"]').tooltip();
+ // shortcuts
+ // allow on all tags
+ key.filter = function (e) { return true; };
+ key('ctrl+alt+e', function (e) {
+ changeMode(modeType.edit);
+ });
+ key('ctrl+alt+v', function (e) {
+ changeMode(modeType.view);
+ });
+ key('ctrl+alt+b', function (e) {
+ changeMode(modeType.both);
+ });
});
//when page resize
$(window).resize(function () {
diff --git a/public/views/foot.ejs b/public/views/foot.ejs
index 728b55e8..c1197605 100644
--- a/public/views/foot.ejs
+++ b/public/views/foot.ejs
@@ -70,6 +70,7 @@
+
--
cgit v1.2.3