diff options
author | friendica <info@friendica.com> | 2013-11-11 17:50:36 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-11-11 17:50:36 -0800 |
commit | 54438be7c2c402e4a897a2534f0f465dea5f068b (patch) | |
tree | 21f1dbf5dc93dc18c5693902d66e4615f16f45ee | |
parent | d9013f43110a6474a8e52b72492bc490d50b7972 (diff) | |
download | volse-hubzilla-54438be7c2c402e4a897a2534f0f465dea5f068b.tar.gz volse-hubzilla-54438be7c2c402e4a897a2534f0f465dea5f068b.tar.bz2 volse-hubzilla-54438be7c2c402e4a897a2534f0f465dea5f068b.zip |
make e2ee work on tinymce
-rw-r--r-- | js/crypto.js | 16 | ||||
-rwxr-xr-x | view/tpl/jot-header.tpl | 7 |
2 files changed, 19 insertions, 4 deletions
diff --git a/js/crypto.js b/js/crypto.js index e9ab6961b..50282d18f 100644 --- a/js/crypto.js +++ b/js/crypto.js @@ -31,6 +31,9 @@ function red_encrypt(alg, elem,text) { var enc_text = ''; var newdiv = ''; + if(typeof tinyMCE !== "undefined") + tinyMCE.triggerSave(false,true); + var text = $(elem).val(); // key and hint need to be localised @@ -63,7 +66,18 @@ function red_encrypt(alg, elem,text) { // alert(newdiv); - $(elem).val(newdiv); + // This might be a comment box on a page with a tinymce editor + // so check if there is a tinymce editor but also check the display + // property of our source element - because a tinymce instance + // will have display "none". If a normal textarea such as in a comment + // box has display "none" you wouldn't be able to type in it. + + if($(elem).css('display') == 'none' && typeof tinyMCE !== "undefined") { + tinyMCE.activeEditor.setContent(newdiv); + } + else { + $(elem).val(newdiv); + } // textarea = document.getElementById(elem); // if (document.selection) { diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index eb7c5abdb..ce29443f7 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -299,12 +299,13 @@ function enableOnUser(){ function addeditortext(data) { - if(plaintext == 'none') { + if(typeof tinyMCE !== "undefined") { + tinyMCE.execCommand('mceInsertRawHTML',false,data); + } + else { var currentText = $("#profile-jot-text").val(); $("#profile-jot-text").val(currentText + data); } - else - tinyMCE.execCommand('mceInsertRawHTML',false,data); } function h2b(s) { |