From b5ab77908e357b027a9298e0258f3c0737f3c721 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 17 Nov 2020 09:09:36 +0000 Subject: implement submit on ctrl-enter for post editor and comments --- view/tpl/jot-header.tpl | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'view/tpl/jot-header.tpl') diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index d519fd666..d78907b38 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -61,13 +61,11 @@ var activeCommentText = ''; $('#jot-add-option').on('click', jotAddOption); $(document).on('click', '.poll-option-close', jotRemoveOption); - function jotSetMime() { - var mtype = $('#id_mimetype').val(); - if(mtype == 'text/bbcode') - $('#profile-jot-submit-left').show(); - else - $('#profile-jot-submit-left').hide(); - } + $('#profile-jot-form').keydown(function(e) { + if (e.ctrlKey && e.keyCode === 13) { + $(this).trigger('submit'); + } + }); $('#invisible-wall-file-upload').fileupload({ url: 'wall_attach/{{$nickname}}', @@ -91,11 +89,10 @@ var activeCommentText = ''; $('#wall-file-upload').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;}); $('#wall-file-upload-sub').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;}); - // call initialization file - if (window.File && window.FileList && window.FileReader) { - DragDropUploadInit(); - } - + // call initialization file + if (window.File && window.FileList && window.FileReader) { + DragDropUploadInit(); + } $('#invisible-comment-upload').fileupload({ url: 'wall_attach/{{$nickname}}', @@ -128,6 +125,14 @@ var activeCommentText = ''; }); + function jotSetMime() { + var mtype = $('#id_mimetype').val(); + if(mtype == 'text/bbcode') + $('#profile-jot-submit-left').show(); + else + $('#profile-jot-submit-left').hide(); + } + function deleteCheckedItems() { var checkedstr = ''; -- cgit v1.2.3