bbPress Enable TinyMCE Visual Tab
[resolved] Breaks nested replies - disable for those? (4 posts)

  1. crowinck
    Posted 1 year ago #

    With this plugin activated, nested replies are no longer possible, the user can't click in the TinyMCE window. That's understandable, I know TinyMCE doesn't tolerate DOM changes, so popping in a new place dynamically is unlikely to work.(Let me know if I'm wrong about that).

    I was wondering if there is a simple way to disable the visual editor for nested replies, so visitors could still do nested replies if they wanted, they just wouldn't have all the visual options.


  2. dsteeler
    Posted 1 year ago #

    I've encountered the same issue. A fix would be great, but even a short-term workaround would help.

  3. Jared Atchison
    Plugin Author

    Posted 1 year ago #

    Sorry, I have no plans to support bbPress nested replies.

    Because of how things work behind the scenes of TinyMCE, the editor WordPress and bbPress uses, it would require a lot of time and resources to add that compatibility.

    This plugin was never intended to do a bunch of custom stuff, but rather simply turn back on the editor. I do not support issues that come with the editor itself.

  4. Wesley
    Posted 1 year ago #

    I also encountered this problem. After some research and experimentation, I found a fix that seems to work for me (I have not tested the fix extensively so I have no idea if this fix will work for you.)

    Unfortunately, it involves modifying a bbPress core file, which should be avoided wherever possible. However, if you really need this to work, feel free to give it a try!

    Problem: At a really high level, when bbPress moves the editor, it's not moving the event bindings properly.

    Solution: Destroy and recreate the Visual Editor so that the event bindings are re-initiated.

    Replace all the code in /wp-content/plugins/bbpress/templates/default/js/reply.js with the following:

    addReply = {
    	moveForm : function(replyId, parentId, respondId, postId) {
    		var t = this, div, reply = t.I(replyId), respond = t.I(respondId), cancel = t.I('bbp-cancel-reply-to-link'), parent = t.I('bbp_reply_to'), post = t.I('bbp_topic_id');
    		if ( ! reply || ! respond || ! cancel || ! parent )
    		t.respondId = respondId;
    		postId = postId || false;
    		if ( ! t.I('bbp-temp-form-div') ) {
    			div = document.createElement('div');
    			div.id = 'bbp-temp-form-div';
    			div.style.display = 'none';
    			respond.parentNode.insertBefore(div, respond);
    		if ( post && postId )
    			post.value = postId;
    		parent.value = parentId;
    		cancel.style.display = '';
    		cancel.onclick = function() {
    			var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId);
    			if ( ! temp || ! respond )
    			t.I('bbp_reply_to').value = '0';
    			temp.parentNode.insertBefore(respond, temp);
    			this.style.display = 'none';
    			this.onclick = null;
    			return false;
    		try { t.I('bbp_reply_content').focus(); }
    		catch(e) {}
    		return false;
    	I : function(e) {
    		return document.getElementById(e);
    	removeEditor : function() {
    		try {
    			tinyMCE.EditorManager.execCommand('mceFocus', false,'bbp_reply_content');
    			tinymce.EditorManager.execCommand('mceRemoveEditor',false, 'bbp_reply_content');
    		} catch(el) {}
    	addEditor : function() {
    		try {
    			tinymce.EditorManager.execCommand('mceAddEditor',false, 'bbp_reply_content');
    		} catch (e) {}

    Note: In my experience, Firefox doesn't seem able to correctly insert the editor div underneath the nested reply regardless if this plugin is enabled or not. The editor will also appear at the bottom of the page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • bbPress Enable TinyMCE Visual Tab
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic