Merge pull request #791 from ArthurHoaro/feature/ctrl-enter-submit

Submit editlink textarea using CTRL+Enter shortcut
This commit is contained in:
ArthurHoaro 2017-03-09 19:14:10 +01:00 committed by GitHub
commit 1e38df6606
2 changed files with 8 additions and 1 deletions

View file

@ -59,7 +59,7 @@ <h2 class="window-title">{'Shaare'|t}</h2>
<div class="submit-buttons center"> <div class="submit-buttons center">
<input type="submit" value="{'Save'|t}" name="save_edit" class=""> <input type="submit" value="{'Save'|t}" name="save_edit" class="" id="button-save-edit">
{if="!$link_is_new"} {if="!$link_is_new"}
<a href="?delete_link&amp;lf_linkdate={$link.id}&amp;token={$token}" <a href="?delete_link&amp;lf_linkdate={$link.id}&amp;token={$token}"
title="" name="delete_link" class="button button-red confirm-delete"> title="" name="delete_link" class="button button-red confirm-delete">

View file

@ -256,7 +256,14 @@ window.onload = function () {
resize(); resize();
} }
if (description != null) { if (description != null) {
init(); init();
// Submit editlink form with CTRL + Enter in the text area.
description.addEventListener('keydown', function (event) {
if (event.ctrlKey && event.keyCode === 13) {
document.getElementById('button-save-edit').click();
}
});
} }
}; };