mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-19 00:09:21 +11:00
Cmd+Enter form submit
This commit is contained in:
parent
7f7a53aa62
commit
b362cd2ef6
3 changed files with 20 additions and 0 deletions
|
@ -80,6 +80,13 @@ h1, h2, h3, h4 {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
.shortcut {
|
||||
color: #AAA;
|
||||
font-size: 13px;
|
||||
font-weight: 300;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
Snippet Details
|
||||
---------------------------------------------------------------------------- */
|
||||
|
|
|
@ -29,6 +29,17 @@
|
|||
|
||||
{% block script_footer %}
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
$('.autofocus textarea:first').focus();
|
||||
$('.superenter textarea').on('keydown', function(e){
|
||||
if(e.keyCode == 13 && e.metaKey) {
|
||||
$(this).closest('form').submit();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
</body>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<div class="
|
||||
control-group
|
||||
form-content
|
||||
superenter
|
||||
{% if is_new %}autofocus{% endif %}
|
||||
{% if snippet_form.content.errors %}error{% endif %}
|
||||
">
|
||||
|
@ -41,5 +42,6 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<input tabindex="0" type="submit"class="btn btn-primary" value="{% trans "Paste it" %}">
|
||||
<span class="shortcut">⌘ + ⏎</span>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue