[ 21 posts ] Go to page 1, 2, 3 Next

Karen

  • Username: lilycreek
  • Joined: Wed May 06, 2009 11:50 am
  • Posts: 28
  • Location: Illinois
  • Twitter: mygenesis_cms
  • Offline
  • Profile
Tags:

MS word code filterWord cleanHTML

Post Posted: Wed Nov 04, 2009 9:46 am
+0-
I was searching trying to find a way for YUI RTE to remove MS word code as well as clean up the html so it does’nt throw an error in my RSS feed and I found this post made in 08 http://old.nabble.com/Re%3A-Table-in-YUI-Rich-Text-Editor-p20803667.html

Is there an example of how to implement this in the latest yui rte version? or is there another way to strip MS word invalid code, or to set the exact characters you want removed?
@rtfully, Karen lee

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: MS word code filterWord cleanHTML

Post Posted: Wed Nov 04, 2009 10:14 am
+0-
Try setting the filterWord config option:
http://developer.yahoo.com/yui/docs/YAH ... ter_msword

Code:
filterWord: true

Karen

  • Username: lilycreek
  • Joined: Wed May 06, 2009 11:50 am
  • Posts: 28
  • Location: Illinois
  • Twitter: mygenesis_cms
  • Offline
  • Profile
Tags:

Re: MS word code filterWord cleanHTML

Post Posted: Wed Nov 04, 2009 11:56 am
+0-
Hi Dav
(I posted this on your site, so need to answer it there now).
I did put the filterWord option in but it does'nt take out all the ms code, is there somewhere I can make it take out other tags, like inline styles? I have my php script stripping them but that does'nt happen till after it's posted which causes an error initially on the finish screen, so I need to strip them out before post as well.
I tried the CleanPaste hack from antscode blog but the insert image function is putting a width=_foo height=_foo (underscore before the pixel number and no qoutes) on the image tag which is invalid so cleanpaste removes the image.
Also, the insert link tool when selecting open in new window option is putting the link as target=_blank, rather than target="_blank" (with the quotations) so that causes the xml rss feed file to throw an error, is there somewhere I can change the way these tags are output?

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: MS word code filterWord cleanHTML

Post Posted: Wed Nov 04, 2009 11:59 am
+0-
The Word filter is a "general" filter, since Word puts so much garbage in it's hard to filter it all out without some valid cases.

For now you can override the filter_msword method to make it filter anything extra you want removed.

Once you have it working better, file an enhancement request, give me a test case and the code. I would be happy to roll it into a future release.

Karen

  • Username: lilycreek
  • Joined: Wed May 06, 2009 11:50 am
  • Posts: 28
  • Location: Illinois
  • Twitter: mygenesis_cms
  • Offline
  • Profile

Re: MS word code filterWord cleanHTML

Post Posted: Thu Nov 05, 2009 7:34 am
+0-
thx Dav, unfortunately, I have no idea how to override the filter_msword could you give me an example?

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: MS word code filterWord cleanHTML

Post Posted: Thu Nov 05, 2009 7:37 am
+0-
Include this JS after the main editor file, but before you instantiate your instances:

Example

Click here to see the revision history on this Gist.

Karen

  • Username: lilycreek
  • Joined: Wed May 06, 2009 11:50 am
  • Posts: 28
  • Location: Illinois
  • Twitter: mygenesis_cms
  • Offline
  • Profile

Re: MS word code filterWord cleanHTML

Post Posted: Thu Nov 05, 2009 7:47 am
+0-
thx so much, makes sense now. I'll give it a go.

Karen

  • Username: lilycreek
  • Joined: Wed May 06, 2009 11:50 am
  • Posts: 28
  • Location: Illinois
  • Twitter: mygenesis_cms
  • Offline
  • Profile
Tags:

Re: MS word code filterWord cleanHTML

Post Posted: Fri Nov 06, 2009 11:40 am
+0-
Well, I made a custom js file with your suggestions, put it just below the main editor file but above my instances, I put filterWord: true in my config, it's not throwing an error but the word tags are'nt being replaced, nothings happening. Maybe I'm missing something above the myEditor.saveHTML(); ??

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: MS word code filterWord cleanHTML

Post Posted: Fri Nov 06, 2009 11:41 am
+0-
You need to post a link.

Karen

  • Username: lilycreek
  • Joined: Wed May 06, 2009 11:50 am
  • Posts: 28
  • Location: Illinois
  • Twitter: mygenesis_cms
  • Offline
  • Profile

Re: MS word code filterWord cleanHTML

Post Posted: Fri Nov 06, 2009 12:16 pm
+0-
removed url
@rtfully, Karen lee

Last edited by lilycreek on Tue Nov 10, 2009 9:47 am, edited 1 time in total.
  [ 21 posts ] Go to page 1, 2, 3 Next
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron