From 54438be7c2c402e4a897a2534f0f465dea5f068b Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 11 Nov 2013 17:50:36 -0800 Subject: make e2ee work on tinymce --- js/crypto.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'js/crypto.js') 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) { -- cgit v1.2.3