• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Disable WYSIWYG editor for forum

Gossamer

Active member
#1
Hello! So, I have a particular forum that people are going to be using larger code templates for their new threads. However, when you copy and paste code over, it currently also retains the formatting from the code box you copied from. I only want the code itself to be copied over.

Is there a way for me to disable the WYSIWYG editor for one specific forum? Or otherwise have it defaulted so that the editor is always in the bbcode mode? And people have the option to switch to the WYSIWYG editor?
 

Amaury

Well-known member
#2
Preferences -> Options -> Use the rich text editor to create and edit messages

Do note that is the users' preferences, not in the Admin CP.
 

AndyB

Well-known member
#3
However, when you copy and paste code over, it currently also retains the formatting from the code box you copied from. I only want the code itself to be copied over.
Which code formatting do you want to removed when pasting into the Rich Text Editor?
 

Jeremy

Well-known member
#4
Preferences -> Options -> Use the rich text editor to create and edit messages

Do note that is the users' preferences, not in the Admin CP.
This is a global setting, not per forum as Gossamer is looking for. This can most likely be accomplished via some template edits and conditionals.
 

Gossamer

Active member
#5
I saw that, Amaury, but I'm looking for a way to disable the wysiwyg editor in one specific forum node. I don't mind it being turned on everywhere else.

The code I've been testing with is this:
Code:
[CENTER][SIZE=7][COLOR=#76657d][FONT=Sylfaen][B]CHARACTER NAME[/B][/FONT][/COLOR][/SIZE]
[image here; don't stretch the board]
Played by [COLOR=#76657d]OOC Account[/COLOR][/CENTER]
[B][COLOR=#76657d][FONT=Sylfaen]FANDOM:[/FONT][/COLOR][/B] What series/movie/book/comic/etc is your character from?
[B][COLOR=#76657d][FONT=Sylfaen]AGE:[/FONT][/COLOR][/B] Physical and actual if necessary
[B][COLOR=#76657d][FONT=Sylfaen]RACE:[/FONT][/COLOR][/B] Human, vampire, werewolf, something else?
[B][COLOR=#76657d][FONT=Sylfaen]GENDER:[/FONT][/COLOR][/B] Male, female, something else?
And when I copy and paste that from the code box in a post into a new post window with the wysiwyg editor on, the bbcode gets formatted like this:
Code:
[CENTER][COLOR=#6e6e6e][FONT=Consolas][SIZE=7][COLOR=#76657d][FONT=Sylfaen][B]CHARACTER NAME[/B][/FONT][/COLOR][/SIZE][/FONT][/COLOR]
[COLOR=#6e6e6e][FONT=Consolas][image here; don't stretch the board]
Played by [COLOR=#76657d]OOC Account[/COLOR][/FONT][/COLOR][/CENTER]
[COLOR=#6e6e6e][FONT=Consolas][B][COLOR=#76657d][FONT=Sylfaen]FANDOM:[/FONT][/COLOR][/B] What series/movie/book/comic/etc is your character from?[/FONT][/COLOR]
[COLOR=#6e6e6e][FONT=Consolas][B][COLOR=#76657d][FONT=Sylfaen]AGE:[/FONT][/COLOR][/B] Physical and actual if necessary[/FONT][/COLOR]
[COLOR=#6e6e6e][FONT=Consolas][B][COLOR=#76657d][FONT=Sylfaen]RACE:[/FONT][/COLOR][/B] Human, vampire, werewolf, something else?[/FONT][/COLOR]
[COLOR=#6e6e6e][FONT=Consolas][B][COLOR=#76657d][FONT=Sylfaen]GENDER:[/FONT][/COLOR][/B] Male, female, something else?[/FONT][/COLOR]
So, it effectively changes the font and color of anything that didn't already have special formatting. The new color and font tags are coming from the css of my code block, I believe.
 

Jeremy

Well-known member
#6
If you add the following code into /library/XenForo/ViewPublic/Helper/Editor.php around line 30 (in function getEditorTemplate):
PHP:
        $params = $view->getParams();
        if(in_array($params['forum']['node_id'], array('2'))) {
            $showWysiwyg = false;
        } else
Do this, after the $messageHtml = ''; line. Note, this will remove the option to turn on the editor completely (the Use Rich Text Editor link doesn't appear). Change the '2' to be the node IDs you would like to disable it in.