|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
WYSIWYG Editor and MicroSoft Markup
Hi all,
I'm using the WYSIWYG Editor from the DevArticles tutorial. My clients keep posting stuff they copied from MicroSoft Word and it ends up containing all the markup that can be found in a typical MS document. Not only is it bloating the file size but it interferes with the CSS as different clients may be using different fonts for their documents. I've told them to save everything to text first and then post, but they are not listening. Is there a way of getting all the MS rubbish cut from the IFRAME or am I stuck with it? At the moment I have to go in and manually clean everything up. I just want simple <p></p> tags, not the lengthy ones used in Word.
__________________
Without me my guitar is useless -- http://www.guitarnoise.com http://www.musiccareers.net |
|
#2
|
|||
|
|||
|
Hoo......I don't know of any quick method, but I'm certain it would involve a fair bit of regular expression work to parse all that pointless junk out.
If I'm not mistaken there's a program called "tidy" in existance which can easily remove all the unnecessary Word HTML markup. You could pipe the HTML code through that program first using PHP's exec() command, and then store the cleaned code. Hope that gave you a bit of an idea, -Jeb. |
|
#3
|
|||
|
|||
|
Thanks Jeb.
My first idea was to use regular expressions. But boy, what a variety of Junk MS code uses. It will be tedious and time consuming to catch most of it. I will look into using a tidy program. Though it does sound like more trouble than it's worth. I could change back to a regular textarea box in a matter of minutes and be done with it. |
|
#4
|
|||
|
|||
|
Well, the easiest route was to train everyone to use Dreamweaver and clean up MS HTML rather than simply cutting and pasting from Word.
It works, but having to train clients on Dreamweaver kind of defeats some of the purpose. Anyone else experienced this? |
|
#5
|
|||
|
|||
|
You could use the strip_tags() function to clear out everything except the tags you want to allow prior to inserting the text into your database. I've tested this out using basic word docs and it seems to work ok. For complex documents I'm not sure how well this works.
|
|
#6
|
|||
|
|||
|
I'm having similar problems as well.
When I copy & paste articles or huge blocks of text from Ms-Word into the WYSIWYG iframe, the script returns an "Undefinex index" error, pointing to the hidden form variable that is supposed to hold the iframe contents. The application works perfectly, however, when I key in plain text and do all the formatting via the WYSWIYG editor itself. It also works nicely if I copy and paste tiny little chunks of text from Ms-Word, eg 1 paragraph or two. Has anyone experienced similar problems? Does a "hidden" form field contain limitations to the amount of characters that it can hold? Any feedback will be much appreciated. Thank you! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > WYSIWYG Editor and MicroSoft Markup |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|