mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +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;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.shortcut {
|
||||||
|
color: #AAA;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Snippet Details
|
Snippet Details
|
||||||
---------------------------------------------------------------------------- */
|
---------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -29,6 +29,17 @@
|
||||||
|
|
||||||
{% block script_footer %}
|
{% block script_footer %}
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
|
<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 %}
|
{% endblock %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<div class="
|
<div class="
|
||||||
control-group
|
control-group
|
||||||
form-content
|
form-content
|
||||||
|
superenter
|
||||||
{% if is_new %}autofocus{% endif %}
|
{% if is_new %}autofocus{% endif %}
|
||||||
{% if snippet_form.content.errors %}error{% endif %}
|
{% if snippet_form.content.errors %}error{% endif %}
|
||||||
">
|
">
|
||||||
|
@ -41,5 +42,6 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input tabindex="0" type="submit"class="btn btn-primary" value="{% trans "Paste it" %}">
|
<input tabindex="0" type="submit"class="btn btn-primary" value="{% trans "Paste it" %}">
|
||||||
|
<span class="shortcut">⌘ + ⏎</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue