Add support of shortcut keys for changeMode

This commit is contained in:
Wu Cheng-Han 2016-09-18 16:30:08 +08:00
parent b708a72873
commit 9d71adc05c
3 changed files with 15 additions and 1 deletions

View file

@ -57,7 +57,8 @@
"string": "^3.3.1", "string": "^3.3.1",
"visibilityjs": "^1.2.3", "visibilityjs": "^1.2.3",
"pdfobject": "pdfobject2#*", "pdfobject": "pdfobject2#*",
"gist-embed": "*" "gist-embed": "*",
"keymaster": "^1.6.3"
}, },
"resolutions": { "resolutions": {
"jquery": "~3.1.0" "jquery": "~3.1.0"

View file

@ -805,6 +805,18 @@ $(document).ready(function () {
}); });
//tooltip //tooltip
$('[data-toggle="tooltip"]').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 //when page resize
$(window).resize(function () { $(window).resize(function () {

View file

@ -70,6 +70,7 @@
<script src="<%- url %>/vendor/md-toc.js" defer></script> <script src="<%- url %>/vendor/md-toc.js" defer></script>
<script src="<%- url %>/vendor/showup/showup.js" defer></script> <script src="<%- url %>/vendor/showup/showup.js" defer></script>
<script src="<%- url %>/vendor/randomcolor/randomColor.js" defer></script> <script src="<%- url %>/vendor/randomcolor/randomColor.js" defer></script>
<script src="<%- url %>/vendor/keymaster/keymaster.js" defer></script>
<script src="<%- url %>/js/google-drive-upload.js" defer></script> <script src="<%- url %>/js/google-drive-upload.js" defer></script>
<script src="<%- url %>/js/google-drive-picker.js" defer></script> <script src="<%- url %>/js/google-drive-picker.js" defer></script>
<script src="<%- url %>/js/common.js" defer></script> <script src="<%- url %>/js/common.js" defer></script>