Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Mixup between textareas
Steps to reproduce:
1. Open an existing discussion that contains comments from you.
2. Click "Edit" on one of the existing comments.
3. Click WYSIWYG above the bottom textarea.
Effect: The TinyMCE window is opened for the upper textarea.
Second version:
1. Open an existing discussion that contains comments from you.
2. Click WYSIWYG above the bottom textarea and enter some text.
3. Click "Edit" on one of the existing comments.
4. Click the red "x" symbol ("Disable WYSIWYG") on the TinyMCE header.
Effect: The text entered in TinyMCE is stored in the upper textarea of the old comment.
The reason for this bug is probably that all textareas have the same ID "Form_Body".
see https://github.com/vanillaforums/Garden/issues/647
1. Open an existing discussion that contains comments from you.
2. Click "Edit" on one of the existing comments.
3. Click WYSIWYG above the bottom textarea.
Effect: The TinyMCE window is opened for the upper textarea.
Second version:
1. Open an existing discussion that contains comments from you.
2. Click WYSIWYG above the bottom textarea and enter some text.
3. Click "Edit" on one of the existing comments.
4. Click the red "x" symbol ("Disable WYSIWYG") on the TinyMCE header.
Effect: The text entered in TinyMCE is stored in the upper textarea of the old comment.
The reason for this bug is probably that all textareas have the same ID "Form_Body".
see https://github.com/vanillaforums/Garden/issues/647
Tagged:
0
Answers
I'll dive deeper in TinyMCE api, and I'll try to fix bug this later.
Just before TinyMCE is opened, change the ID of the textarea: Register the fadein/fadeout routines that display the WYSIWYG button for all textareas: Add z-index to the CSS of the WYSIWYG button, so that it is visible when old messages are edited: The fadein/fadeout is not optimal with this version and there is still the problem with the textarea that remains visible after the comment is posted.
There was an error rendering this rich post.
(function($){ $(document).ready(function() { function loadMCE(that){ $('.TextBox').not(that).parents('div.Comment').each(function(){ $(this).parent().removeClass('Editing'); $(this).children('.Message').show(); if(typeof tinyMCE!='undefined'){ for (var i=0; i<tinymce.editors.length; i++) { if($(this).eq(tinymce.editors[i])){ tinyMCE.execCommand('mceRemoveControl',false, tinymce.editors[i].id); } } } $(this).children('.CommentForm').remove(); }); $(that).tinymce({ script_url : tny_path, theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft"+ ",justifycenter,justifyright,justifyfull,|,formatselect,|,sub,sup", theme_advanced_buttons2 : "bullist,numlist,|,blockquote,|,undo,redo,|,cut,copy,"+ "paste,pastetext,pasteword,|,link,unlink,|,image,media,|,cleanup,code,|preview,|,removeformat,|,help", theme_advanced_buttons3 :"", remove_linebreaks : true, theme : "advanced", plugins : "media" }); } $('.TextBox,.MessageBox').livequery(function(){ var that = this; if($(that).parents('form').is('.Activity')) return; $(that).ready(function(){loadMCE(that);}); $(that).bind('loadMCE',function(){loadMCE(that);}); }); }); })(jQuery);
grep is your friend.
The submission needs to be handled. There an event handlers triggered is in post.js and discussion.js that you could put in the init code. Although I just put the code in directly.
Removal of newlines that result in erroneous <br />'s
var postValues = $(frm).serialize(); postValues= postValues.replace(/\%0A/g,'');
removal of editor, (this should be automatic)
if(typeof tinyMCE!='undefined'){
for (var i=0; i
The discussion.js code is the most interesting. I had no problem with the comments dynamically loading. As you can see in init.js it make sure that only one comment is edited at time. The problem lies after editing a comment, the new comment editor despite being associated with a textarea get dis-coupled (it is not through not unloading correctly). I tried all the obvious. The solution is a little odd but the hack works with no quirks.
var newImput = $('#Content > .MessageForm .TextBox:last').clone(); if(typeof tinyMCE!='undefined'){ for (var i=0; i .MessageForm .TextBox:last').replaceWith(newImput); $('#Content > .MessageForm .mceEditor:last').remove();
The old textarea is replaced, triggering an init. The dis-coupled editor is removed, leaving a working editor.grep is your friend.
grep is your friend.
grep is your friend.
grep is your friend.