Possible to strip <p> tags from tinyMCE?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
sarah_h
Forum Members
Forum Members
Posts: 189
Joined: Tue Apr 25, 2006 8:30 am

Possible to strip <p> tags from tinyMCE?

Post by sarah_h »

Hi All,

I'm thinking ahead to when my client starts using his site and I know he'll most likely copy and paste from Word into tinyMCE. Now I like to copy from Word into Notepad first and then into TinyMCE, this removes most of the tags and junk you get with Word. This isn't specifically related to my question but I will need to strip tags, so, all I need to know is can I set TinyMCE to remove/strip tags (or any others that I specify) before outputting?

If so it'd be a great help.

Thanks

Sarah
nivekiam

Re: Possible to strip <p> tags from tinyMCE?

Post by nivekiam »

I don't think this is really CMSms related.  It looks like you might be able to do it but I think you'll have to modify TinyMCE code:
http://tinymce.moxiecode.com/punbb/view ... ?pid=15591

But it looks like you can edit tinyconfig.php (located at /modules/TinyMCE/tinyconfig.php

Find the line invalid_elements : "", and change it to invalid_elements : "p",

I don't know what that will break, but I'm sure it won't give the results you are looking for.  As it appears copying and pasting from Word still brings along tags and they just get striped out instead of being replaced with
  IOW, they will loose their paragraphs.

But if you look at the link above and play with the extended_valid_elements line (two lines below the one I mention above) then you can maybe make some of the behavior better, like striping out the class attribute and prevent bringing along Microsoft's bloated style name junk.

Code: Select all

-p[id|style|dir|class|align]
  just remove class

Code: Select all

-p[id|style|dir|align]
Hope this helps a little bit.
sarah_h
Forum Members
Forum Members
Posts: 189
Joined: Tue Apr 25, 2006 8:30 am

Re: Possible to strip <p> tags from tinyMCE?

Post by sarah_h »

Thank for this. Your suggestion didn't break anything and kind of gave what I was looking for, but you were, of course, right about the missing paras! I feel, however, that I'm on the right lines but I'll need to do more experimentation. I've nothing [Solved] but I'll keep working on it. So thank you for pointing me in the right direction.
nivekiam

Re: Possible to strip <p> tags from tinyMCE?

Post by nivekiam »

I hope it's the right direction.  I tried searching google for 'strip word paragraphs tinymce' but didn't find much.  I did stumble upon this:
http://tinymce.moxiecode.com/punbb/view ... ?pid=30745

It might have a few more clues.  Apparently there is a "paste from word" plugin, I haven't looked to see if it's already used in CMSms or not, nor do I know if it would fit the bill.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Possible to strip <p> tags from tinyMCE?

Post by Dr.CSS »

There used to be a 'strip/paste from Word' button in FCKeditor, it was mostly just like pasting to notepad then into site but it took out all formating...
alby

Re: Possible to strip <p> tags from tinyMCE?

Post by alby »

mark wrote: There used to be a 'strip/paste from Word' button in FCKeditor, ....
TinyMCE also.
Add ",pastetext,pasteword" in toolbar1  (Extensions -> TinyMCE WYSIWYG Basic -> Toolbar)

Alby
Post Reply

Return to “CMSMS Core”