aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-20 10:45:35 +0000
committerMario <mario@mariovavti.com>2020-11-20 10:45:35 +0000
commit4c0a26dbf9fca5358320ad11911aac1d5cc530b3 (patch)
treed7c2e09d537257b8a63fe3b0f19770d926c95502
parent885edd6261256ddb0308a5e32d5e6a96704f2a39 (diff)
downloadvolse-hubzilla-4c0a26dbf9fca5358320ad11911aac1d5cc530b3.tar.gz
volse-hubzilla-4c0a26dbf9fca5358320ad11911aac1d5cc530b3.tar.bz2
volse-hubzilla-4c0a26dbf9fca5358320ad11911aac1d5cc530b3.zip
move post_comment() handling via ctrl-enter out of handle_comment_form() - to many issues with multiple triggers
-rw-r--r--view/js/main.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 380b2bbf7..bd595dbb3 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -56,7 +56,7 @@ $.ajaxSetup({cache: false});
$(document).ready(function() {
- $(document).on('click', '.comment-edit-form', handle_comment_form);
+ $(document).on('click focus', '.comment-edit-form', handle_comment_form);
$(document).on('click', '.conversation-settings-link', getConversationSettings);
$(document).on('click', '#settings_module_ajax_submit', postConversationSettings);
@@ -69,6 +69,13 @@ $(document).ready(function() {
this.autocomplete_handled = true;
}
+
+ });
+
+ $(document).on('keydown', '.comment-edit-form textarea.expanded', function (e) {
+ if (e.ctrlKey && e.keyCode === 13) {
+ post_comment(this.id.replace('comment-edit-text-',''));
+ }
});
var tf = new Function('n', 's', 'var k = s.split("/")['+aStr['plural_func']+']; return (k ? k : s);');
@@ -280,6 +287,7 @@ function handle_comment_form(e) {
// handle clicked form
var form = $(this);
+
var fields = form.find(':input[type=text], textarea');
var fields_empty = true;
@@ -294,9 +302,9 @@ function handle_comment_form(e) {
form.find(':not(:visible)').show();
}
+
// handle click outside of form (close empty forms)
$(document).one('click', function(e) {
-
fields.each(function() {
if($(this).val() != '')
fields_empty = false;
@@ -333,12 +341,6 @@ function handle_comment_form(e) {
},10000);
});
- $('#' + emptyCommentElm).on('keydown', function (e) {
- if (e.ctrlKey && e.keyCode === 13) {
- post_comment(convId);
- }
- });
-
function commentSaveChanges(convId, isFinal) {
if(typeof isFinal === 'undefined')
@@ -1174,7 +1176,7 @@ function doreply(parent, ident, owner, hint) {
var sel = 'wall-item-body-' + ident.toString();
var quote = window.getSelection().toString().trim();
form.find('textarea').val("@{" + owner + "}" + ((($(window.getSelection().anchorNode).closest("#" + sel).attr("id") != sel) || (quote.length === 0))? " " : "\n[quote]" + quote + "[/quote]\n"));
- $('#comment-edit-text-' + parent.toString()).focus().trigger('click');
+ $('#comment-edit-text-' + parent.toString()).focus();
}
function doscroll(parent, hidden) {