Shortcuts settings

This commit is contained in:
benweet 2013-09-28 17:34:29 +01:00
parent 7317281b5d
commit 82581cfd36
5 changed files with 57 additions and 15 deletions

View File

@ -34,6 +34,7 @@ define([
"extensions/buttonHtmlCode", "extensions/buttonHtmlCode",
"extensions/buttonViewer", "extensions/buttonViewer",
"extensions/welcomeTour", "extensions/welcomeTour",
"extensions/shortcutRecorder",
"extensions/userCustom", "extensions/userCustom",
"bootstrap", "bootstrap",
"jquery-waitforimages" "jquery-waitforimages"

View File

@ -0,0 +1,24 @@
define([
"jquery",
"underscore",
"classes/Extension",
"mousetrap",
"mousetrap-record",
], function($, _, Extension, mousetrap) {
var shortcutRecorder = new Extension("shortcutRecorder", "Shortcut recorder");
shortcutRecorder.onReady = function() {
$('.button-record-shortcut').click(function() {
var $button = $(this);
Mousetrap.record(function(sequence) {
$button.before(['<div class="alert alert-dismissable">',
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>',
sequence.join(' '),
'</div>'].join());
});
});
};
return shortcutRecorder;
});

View File

@ -885,6 +885,8 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a class="action-load-settings" <li class="active"><a class="action-load-settings"
href="#tabpane-settings-editor" data-toggle="tab">Editor</a></li> href="#tabpane-settings-editor" data-toggle="tab">Editor</a></li>
<li><a class="action-load-settings"
href="#tabpane-settings-shortcuts" data-toggle="tab">Shortcuts</a></li>
<li><a class="action-load-settings" <li><a class="action-load-settings"
href="#tabpane-settings-publish" data-toggle="tab">Publish</a></li> href="#tabpane-settings-publish" data-toggle="tab">Publish</a></li>
<li><a class="action-load-settings" <li><a class="action-load-settings"
@ -967,6 +969,17 @@
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane" id="tabpane-settings-shortcuts">
<div class="form-horizontal">
<div class="form-group">
<label class="col-lg-4 control-label"
for="input-settings-shortcut">Shortcut</label>
<div class="col-lg-7">
<button class="btn btn-default button-record-shortcut">Click to record</button>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tabpane-settings-publish"> <div class="tab-pane" id="tabpane-settings-publish">
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group"> <div class="form-group">

View File

@ -24,6 +24,7 @@ requirejs.config({
crel: 'bower-libs/crel/crel', crel: 'bower-libs/crel/crel',
jgrowl: 'bower-libs/jgrowl/jquery.jgrowl', jgrowl: 'bower-libs/jgrowl/jquery.jgrowl',
mousetrap: 'bower-libs/mousetrap/mousetrap', mousetrap: 'bower-libs/mousetrap/mousetrap',
'mousetrap-record': 'bower-libs/mousetrap/plugins/record/mousetrap-record',
toMarkdown: 'bower-libs/to-markdown/src/to-markdown', toMarkdown: 'bower-libs/to-markdown/src/to-markdown',
text: 'bower-libs/requirejs-text/text', text: 'bower-libs/requirejs-text/text',
mathjax: '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML', mathjax: '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML',
@ -68,6 +69,9 @@ requirejs.config({
mousetrap: { mousetrap: {
exports: 'Mousetrap' exports: 'Mousetrap'
}, },
'bootstrap-record': [
'mousetrap'
],
toMarkdown: { toMarkdown: {
deps: [ deps: [
'jquery' 'jquery'

View File

@ -362,7 +362,7 @@ body {
.menu-panel { .menu-panel {
width: @menu-panel-width !important; width: @menu-panel-width !important;
margin-left: (-@menu-panel-width - 23); margin-left: (-@menu-panel-width - 25);
-webkit-transition: margin-left 0.35s ease; -webkit-transition: margin-left 0.35s ease;
-moz-transition: margin-left 0.35s ease; -moz-transition: margin-left 0.35s ease;
-o-transition: margin-left 0.35s ease; -o-transition: margin-left 0.35s ease;
@ -372,22 +372,24 @@ body {
} }
&.in { &.in {
margin-left: 0; margin-left: 0;
}
&.in, &.collapsing {
.collapse-button { .collapse-button {
padding-right: 16px; padding-right: 17px;
} }
} }
.collapse-button { .collapse-button {
right: -75px; right: -80px;
position: absolute; position: absolute;
margin-top: 6px; margin-top: 6px;
z-index: -1; z-index: -1;
padding: 2px 24px 2px 16px; padding: 2px 27px 2px 50px;
-webkit-transition: padding-right 0.35s ease; -webkit-transition: padding-right 0.35s ease;
-moz-transition: padding-right 0.35s ease; -moz-transition: padding-right 0.35s ease;
-o-transition: padding-right 0.35s ease; -o-transition: padding-right 0.35s ease;
transition: padding-right 0.35s ease; transition: padding-right 0.35s ease;
&:hover { &:hover {
padding-right: 16px; padding-right: 17px;
} }
} }
.panel-content { .panel-content {
@ -400,22 +402,24 @@ body {
.document-panel { .document-panel {
right: 0; right: 0;
width: @document-panel-width !important; width: @document-panel-width !important;
margin-right: (-@document-panel-width - 27); margin-right: (-@document-panel-width - 30);
-webkit-transition: margin-right 0.35s ease; -webkit-transition: margin-right 0.35s ease;
-moz-transition: margin-right 0.35s ease; -moz-transition: margin-right 0.35s ease;
-o-transition: margin-right 0.35s ease; -o-transition: margin-right 0.35s ease;
transition: margin-right 0.35s ease; transition: margin-right 0.35s ease;
&.in { &.in {
margin-right: 0; margin-right: 0;
}
&.in, &.collapsing {
.collapse-button { .collapse-button {
padding-left: 10px; padding-left: 10px;
} }
} }
.collapse-button { .collapse-button {
left: -75px; left: -80px;
position: absolute; position: absolute;
margin-top: 6px; margin-top: 6px;
padding: 7px 10px 7px 18px; padding: 7px 50px 7px 20px;
z-index: -1; z-index: -1;
-webkit-transition: padding-left 0.35s ease; -webkit-transition: padding-left 0.35s ease;
-moz-transition: padding-left 0.35s ease; -moz-transition: padding-left 0.35s ease;
@ -1106,10 +1110,6 @@ div.dropdown-menu textarea {
padding-right: 2px; padding-right: 2px;
} }
.icon-trash {
font-size: 95%;
}
.icon-folder { .icon-folder {
margin-top: -2px; margin-top: -2px;
} }