1. 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

Discussion in 'Styling and Customization Questions' started by Gossamer, Jul 10, 2013.

  1. Gossamer

    Gossamer Active Member

    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?
  2. Amaury

    Amaury Well-Known Member

    Preferences -> Options -> Use the rich text editor to create and edit messages

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

    AndyB Well-Known Member

    Which code formatting do you want to removed when pasting into the Rich Text Editor?
  4. Jeremy

    Jeremy Well-Known Member

    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.
  5. Gossamer

    Gossamer Active Member

    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:
    [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:
    [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.
  6. Jeremy

    Jeremy Well-Known Member

    If you add the following code into /library/XenForo/ViewPublic/Helper/Editor.php around line 30 (in function getEditorTemplate):
            $params $view->getParams();
    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.
    W1zzard and Tracy Perry like this.
  7. W1zzard

    W1zzard Well-Known Member

    might want to use
    if ((isset($params['forum'])) && (in_array($params['forum']['node_id'], array("2"))))

Share This Page