Page 1 of 1
Possible to strip <p> tags from tinyMCE?
Posted: Mon Jan 14, 2008 12:28 pm
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
Re: Possible to strip <p> tags from tinyMCE?
Posted: Mon Jan 14, 2008 7:49 pm
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.
just remove class
Hope this helps a little bit.
Re: Possible to strip <p> tags from tinyMCE?
Posted: Tue Jan 15, 2008 9:05 am
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.
Re: Possible to strip <p> tags from tinyMCE?
Posted: Tue Jan 15, 2008 4:28 pm
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.
Re: Possible to strip <p> tags from tinyMCE?
Posted: Tue Jan 15, 2008 6:23 pm
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...
Re: Possible to strip <p> tags from tinyMCE?
Posted: Tue Jan 15, 2008 7:32 pm
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