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

TinyMCE Paste Issue / Configuration

Discussion in 'Closed Suggestions' started by Rudy, Apr 3, 2011.

  1. Rudy

    Rudy Well-Known Member

    Well, I converted yet another forum to XF, and have had another round of complaints about the editor window pasting text in with formatting. The support over at TinyMCE has been less than helpful, but some pitiful little ol' user like me has no clout over there, and other than a few suggestions to start disabling editor features, nothing has materialized. However, they do have an option to add a new button that will paste in your text as plaintext for you. (I feel that if this is possible via a button, it should also be possible as a default configuration value.)

    Basically, I want TinyMCE to paste in text as plaintext by default. It does not seem possible given their configuration values.

    Aha! Now, this brings up an idea that I had earlier today. What if the TinyMCE configuration were put into its own template? That would make it easy to find, and easy to edit if needed. Commented so that we know what we are changing.

    And if I were to take this a step further, it would be a nice feature (even if via an addon) to create an admin interface to allow us to configure some of the default TinyMCE settings and behaviors, without having to dig into the code.

    I realize I could split my own template out and to it myself, but the whole idea is to leave default XF templates untouched. Having an easier method to configure TinyMCE would be most welcomed here at Casa Rudy. :)
    Iversia, Divvens, ankurs and 4 others like this.
  2. Rudy

    Rudy Well-Known Member

    I did find where you could hook into the TinyMCE configuration via a template (it is the hook named "editor_tinymce_init"), but if you want to add any of the plugins, those are outside the hook and you still have to edit the list of plugins above. (I have not yet experimented to see if additional plugins can be added into the main init body for TinyMCE. I would think it's possible. XF creates a variable in JS called "plugins" that is created above the init hook section.)

    For the paste issue, I found that there is a paste plugin which gives additional parameters to configure, but none of them allowed plain text pasting by default. One that looked promising was paste_remove_styles, but setting it to "true" did nothing. Neither did the others. Something must be working, though, as I was able to add a "paste plain text" button from that plugin, and was able to set the paste_text_sticky parameter to "true" which makes the button stay selected while you are working in the editor.

    The one flaw in adding a button is that the tooltip text is incorrect. So, I am guessing some sort of phrase needs to be added to the system...? I tried adding the standard copy/cut/paste buttons, and for the copy button as an example, "xenforo.copy_desc" shows as the tooltip text. For the paste plugin, the button reads "paste.paste_text_desc".

    I realize it would probably add to the JS burden, but having a default XF editor, with easy options to set additional buttons and activate TinyMCE plugins as needed, might be useful down the road a bit.
  3. Jason

    Jason Well-Known Member

    Not really agreeing or disagreeing with your suggestion, but is the "remove formatting" button (found at the top left of the editor) not working for you?
  4. Rudy

    Rudy Well-Known Member

    That is an extra step. Ultimately the editor should be set so it never styles pasted text, and arguably that should be the default. A lot of members on most of the forums I run paste in text from sites, and it is an annoyance even for me. If I'm pasting in even as simple as a product or serial number, why should I have to go back and continually remove formatting from my own post? I even had to do it above--I pasted in the "paste_text_sticky" option from TinyMCE and it was in grey and not very readable. Useless.

    I blame MS Word--for some boneheaded reason, they must have felt it was cool to have something paste into a Word document with the formatting from the source. So now, everyone wants to do it because it's "cool." As someone who writes a lot for both work and school, and posts actively in forums, it is one of the most annoying "features" (I call it a "bug", sorry) to have any editor paste in formatting unless you specifically ask. When you are writing and/or doing research, the majority of the time you are just copying small snippets up to an entire paragraph of text to quote it. There is never a reason I would ever want formatted text pasted.

    That is one of the few reasons I do not like TinyMCE. Until they correct this, I consider it a bug.
    ankurs, Shelley, daveo82 and 2 others like this.
  5. Crispy

    Crispy Member

    Bump. This is very annoying!
  6. Brogan

    Brogan XenForo Moderator Staff Member

    You can always use the plain text editor and set it as the default in your account preferences.
  7. Crispy

    Crispy Member

    I suppose so. To do so would be a shame, though. TinyMCE is otherwise very nice!
  8. Brogan

    Brogan XenForo Moderator Staff Member

    I regularly switch from TinyMCE to plain text if I want to copy and paste without formatting.

    A WYSIWYG editor is suppose to keep the formatting after all, which is why the plain text option exists.
    lazy llama likes this.
  9. Jaxel

    Jaxel Well-Known Member

    I think this is wrong. A wysiwyg editor lets you edit a post and keep formatting. I hate how it keeps formatting from paste. Think about it this way, my forum has a light and dark skin... some people cut and paste text from MY site, and because of it, half the users can't read posts.
    ankurs likes this.
  10. Digital Doctor

    Digital Doctor Well-Known Member

    Does this work ?
    If not ask twollert to see if he can help you.
  11. Shamil

    Shamil Well-Known Member

    You think that's annoying? TextEditor and Notes on Mac work exactly like that. Difficult to get rid of formatting sometimes. I'll abstain from voting here.
  12. Crispy

    Crispy Member


    Format Menu -> Make Plain Text
  13. Jaxel

    Jaxel Well-Known Member

    Good luck getting your users to use that...

    The issue isn't with US... its with our users being morons.
  14. Jaxel

    Jaxel Well-Known Member

    That doesn't disable the formatting on paste... all that does is remove those specific buttons from the toolbar.
  15. dieketzer

    dieketzer Well-Known Member

  16. Rudy

    Rudy Well-Known Member

    Agreed--even Microsoft Word lets you set a default to paste in text as plain text, without formatting. I cannot think of one single reason I would ever want to copy someone else's text formatting into a forum post I am making.
    ankurs likes this.
  17. Jaxel

    Jaxel Well-Known Member

  18. Rudy

    Rudy Well-Known Member

    This technically is a TinyMCE issue, so I doubt there is anything XF could do to change it (unless they have more clout over on the TinyMCE support forum...I certainly don't). About all I was able to do was add a "paste plain text" button on the toolbar, but it does not display correctly since I don't know what the heck I'm doing. *sigh* But as I mentioned, default behavior should always be for plain text pasting. We are pasting in content from all over the web, and it really bothers me to have someone else's dysfunctional formatting in my posts.
  19. dieketzer

    dieketzer Well-Known Member

    that can be adapted to do just that. the different edits listed do different things, such as remove the button, remove the paste formatting, and removing the ability to manually use code.
  20. Jaxel

    Jaxel Well-Known Member

    I did not see anything that stopped paste formatting.

Share This Page