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

Pasting unformatted text in TinyMCE

Discussion in 'Off Topic' started by Rudy, Mar 7, 2011.

  1. Rudy

    Rudy Well-Known Member

    My "issue" is unrelated (and could be split off from this thread, if anyone feels it's worthy), but I may poke around and see if I can find a solution to my own problem with TinyMCE. I just left a post in their forum to see if I can turn off the formatted pasting. It is very annoying, and extra work for most visitors.
    jmurrayhead and Alien like this.
  2. Alien

    Alien Well-Known Member

    I wouldn't mind that as well, especially in our news forum where we don't need all the off-site links from a news blurb.
  3. Rudy

    Rudy Well-Known Member


    It's not only links--it's odd formatting. Some other forums and news sites have tiny text, in an odd color (light grey) or font, which means that a lot of what I post needs to be sanitized in some way or another. Adding a "paste formatted" button would be helpful for those very few times I want to paste formatted text, but for the most part, I want to paste unformatted text. I even have my MS Word set up this way. Sad to see TinyMCE followed their lead.

    Edit: if a moderator wouldn't mind splitting my issue out of the bug report the OP posted, I'm all for it. Hopefully I'll get an answer from the TinyMCE forum, which we can apply to our copies of XF if we'd like to.
  4. Brogan

    Brogan XenForo Moderator Staff Member

    I've split the posts off as requested but as it's not really a XenForo related issue, Off Topic is about the only place for them.
  5. Rudy

    Rudy Well-Known Member

    It will be XF related, once we "fix" this problem. Somehow, we have to alter XF code once we untangle this mess. :D

    Anyway, an answer was posted to my thread, and apparently there is a "paste" plugin that might take care of this.


    I can't say that solution sits well with me. Why should I have to worry about adding something to TinyMCE to remove a feature that should make it a simple text pasting operation? IOW, why is TinyMCE even trying to post text with styles in the first place?
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Mike mentioned that earlier but he said he had problems trying to get it to work automatically.
    dieketzer likes this.
  7. dieketzer

    dieketzer Well-Known Member

    you can disable pasted text formatting, but it will be at the expense of that formatting being available full stop.
    for a quick example, look at this: disable text colour-formatting in editor.

    this is correct. he said that the paste plugin created more problems than it solved.
  8. Rudy

    Rudy Well-Known Member

    Will this strip all formatting from posted text, or just the color? We're getting text pasted in with different colors, fonts, sizes, bold or italics, etc. that we don't want.


    I ran into TinyMCE a few years ago on another project and got frustrated by it. I see things haven't changed. It is very "backwards" to have to add a plugin to remove functionality. Almost feels like the "M" in TinyMCE stands for Microsoft--adding bloat where it isn't wanted.
  9. dieketzer

    dieketzer Well-Known Member

    that particular modification will only strip colour. that being said, the edits should be able to be used as a guide for disabling other tinymce functionality as well.
    bear in mind though that any formatting you disable in paste will also be disabled when creating/editing a post, and i do not believe there is a way to work around that.
  10. MYstIC G

    MYstIC G Active Member

    Copy, paste into notepad/gedit/text editor of your choice, copy from said text editor, paste into xenforo?
  11. Brogan

    Brogan XenForo Moderator Staff Member

    Or switch to plain text editor.

    That's what I do.
  12. Rudy

    Rudy Well-Known Member

    That's crazy. (Not you...TinyMCE. :D ) It shouldn't be pasting formatted text in the first place. And I should never be asking visitors to have to paste text elsewhere first before pasting into the editor. Members use the editor buttons for inserting images, media and links, so I'm hesitant to turn it off. Having this editor in Quick Reply is something the others don't have to this extent (other than the most basic of formatting tools).

    Think I'll pester them and enter it in the bug tracker. I see it as broken functionality, especially if you can't turn it off like you can in other types of software. Installing more bloat via a plugin is not the answer, even if the bugs could be worked out of it. The paste functionality has to be written deep into the code (which converts it to HTML or BBCode in the editor)--I am thinking it is bringing over formatting in possibly some kind of rich text format, or maybe even grabbing the underlying HTML if it is pasted from a web page. There should be a way to turn it off or even eliminate the code. I'm still going through their documentation in what little spare time I have, to figure out what we can do to solve this. If anything.
  13. dieketzer

    dieketzer Well-Known Member

    you can disable aspects of the editor without affecting things like images, media and links.
    look at the two pages that are associated with the colour-stripping hack. the first edit listed removes the functionality. the second edit removes the button from the editor. using that as a guide, look for the elements you want to remove and comment them out.
  14. Rudy

    Rudy Well-Known Member

    The problem I have is that we used bold and italics quite often, and those are also two of the offenders when it comes to pasting in text, especially bold. Italics are used quite a bit as we are often discussing things with titles.

    I would not mind getting rid of the colors, though. I had a couple of members on an older forum make their entire posts in a very dark red (maroon) color, and I kept warning them that their posts were unreadable when using a black theme. Or using yellow text on a white background. Some innocently did not realize that, but others persisted...it's like the old saying that you can lead a horse to water... ;)
  15. dieketzer

    dieketzer Well-Known Member

    chrome will paste colour formatting in addition to the other formatting, and it was a huge issue on my xf. i have two theme options available, dark and light. people using light would paste something from some news site which would carry 'black text' formatting and it would be invisible to users of the dark theme. and people using the dark theme would copy/paste stuff from the board and it would be invisible to users of the light theme :(
    it was so pervasive and so annoying i completely stripped all colour functionality from the editor. it seemed to be the only way to deal with the problem.
    i cant imagine not having bold myself. italics i could live without. i think, however, that getting rid of font-sizing would eliminate much of the annoyance of pasted formatting.
  16. Rudy

    Rudy Well-Known Member

    I'm with you on stripping color functionality--I have had the same issues myself over the years in various forums.

Share This Page