From d686b57c72c574bca7349a7ddfe0425f50a0122a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Fri, 12 Feb 2016 03:34:59 -0500 Subject: [PATCH] Fix bug where contacts widget in compose could be incorrectly initialized with treelist widget (T998) Fix typo in command name (list-adresses -> list-addresses) --- program/js/editor.js | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/program/js/editor.js b/program/js/editor.js index 50ba03d..200d8c8 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -71,6 +71,9 @@ tinymce.registered_request_token = true; tinymce.util.XHR.on('beforeSend', function(e) { e.xhr.setRequestHeader('X-Roundcube-Request', rcmail.env.request_token); + // Fix missing lang parameter on addToDictionary request (#1490634) + if (e.settings && e.settings.data && /^method=addToDictionary/.test(e.settings.data) && !/&lang=/.test(e.settings.data)) + e.settings.data += '&lang=' + ref.editor.plugins.spellchecker.getLanguage(); }); } @@ -547,20 +550,19 @@ // Append the signature as a div within the body if (!sigElem) { - var body = this.editor.getBody(), - doc = this.editor.getDoc(); + var body = this.editor.getBody(); - sigElem = doc.createElement('div'); - sigElem.setAttribute('id', '_rc_sig'); + sigElem = $('<div id="_rc_sig"></div>').get(0); - if (rcmail.env.top_posting && !rcmail.env.sig_below) { + // insert at start or at cursor position in top-posting mode + // (but not if the content is empty) + if (rcmail.env.top_posting && !rcmail.env.sig_below && (body.childNodes.length > 1 || $(body).text())) { this.editor.getWin().focus(); // correct focus in IE & Chrome var node = this.editor.selection.getNode(); - // insert at start or at cursor position if found - body.insertBefore(sigElem, node.nodeName == 'BODY' ? body.firstChild : node.nextSibling); - body.insertBefore(doc.createElement('p'), sigElem); + $(sigElem).insertBefore(node.nodeName == 'BODY' ? body.firstChild : node.nextSibling); + $('<p>').append($('<br>')).insertBefore(sigElem); } else { body.appendChild(sigElem); -- Gitblit v1.9.1