htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0 - Add-Ons:
LUIS or anybody, question about word cleaner


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


brockb
Novice

Mar 20, 2004, 4:37 PM

Post #1 of 11 (5477 views)
Shortcut
LUIS or anybody, question about word cleaner Can't Post

Hey LUIS, your word cleaner is awesome. It works wonders. I wanted to know if there was a way to turn off the on paste cleaner, and attatch it to a "word cleaner" button so you can clean the code AFTER it has already been pasted in if you wanted to clean it? The reason I'm asking... whenever pasting word documents, I definately want the tags cleaned... however, when pasting excel documents... I want to keep the formatting of the excel document as pasted, but the automatic word cleaner takes that formatting away. If there were a button to press when you wanted the word cleaner to work, it would allow you to clean word documents yet also keep excel documents formatted as normal when you don't want them to be cleaned.

Any way to do this?

Thanks!

-Brock


(This post was edited by brockb on Mar 20, 2004, 5:36 PM)


brockb
Novice

Mar 20, 2004, 5:54 PM

Post #2 of 11 (5468 views)
Shortcut
Re: [brockb] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Nevermind... I answered my own question. It wasn't as difficult as I thought it was going to be. I just commented out all of the calls to the functions myclean() & cleanHTML.

I created a ['cleanword'] button in the btnList:


Code
 "cleanword":  ['CleanWord',  'Clean HTML pasted from a word document',  'editor_action(this.id)',  'ed_word.gif'],



then had it call:


Code
  else if (cmdID.toLowerCase() == 'cleanword') {  
var str=editdoc.body.createTextRange().htmlText;
if (str.indexOf("; mso-")>=0 || str.indexOf("<v:")>=0 || str.indexOf('class=Mso')>=0) {
myclean(editdoc);
}
editdoc.body.innerHTML = cleanHTML(editdoc.body.innerHTML);
}




(This post was edited by brockb on May 16, 2004, 3:48 PM)


kwillems
User

May 16, 2004, 1:23 PM

Post #3 of 11 (5224 views)
Shortcut
Re: [brockb] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Thanx for figuring this out!

But when i was using your solution i had some difficulties. After changing ('class="Mso') to ('class=Mso') evrything works fine!


(This post was edited by kwillems on May 16, 2004, 2:01 PM)


brockb
Novice

May 16, 2004, 3:51 PM

Post #4 of 11 (5205 views)
Shortcut
Re: [kwillems] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Thanks for bringing that to my attention kwillems. I didn't copy and paste that over because I had it on a server at work, so I printed out the code and hand-typed it in, so it was a typo. I went in and updated the original post though to reflect the changes (removed the doublequote).

I'm glad it is working for you. Everybody here at work loves it since they can now paste excel data in the web pages without worrying about loosing the formatting with the automatic word cleaner.

-Brock


kwillems
User

May 16, 2004, 4:13 PM

Post #5 of 11 (5203 views)
Shortcut
Re: [brockb] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Well, in fact i found the following lines in the Luis' version:

else if (cmdID.toLowerCase() == 'paste') {
editdoc.execCommand('Paste');
var str=editdoc.body.createTextRange().htmlText;
if (str.indexOf("; mso-")>=0 ||str.indexOf("<v:")>=0 ||str.indexOf('class="Mso')>=0){
myclean(editdoc);
}
editdoc.body.innerHTML = cleanHTML(editdoc.body.innerHTML);
}


As you see: it's the same typo.


(This post was edited by kwillems on May 16, 2004, 4:13 PM)


brockb
Novice

May 16, 2004, 7:31 PM

Post #6 of 11 (5191 views)
Shortcut
Re: [kwillems] LUIS or anybody, question about word cleaner [In reply to] Can't Post

hmmm, I guess you are right... it is the same in both versions. Maybe it wasn't a typo then. I don't know why that double quote would be giving you problems then. I looked at the code on our server at work... and it seems to be working just fine with that double-quote in there. I haven't tried removing it yet to see if it still works, or breaks it.

hehe, well, as long as you have it figured out to where it is working with you. Wink

-Brock


kwillems
User

May 17, 2004, 3:25 AM

Post #7 of 11 (5143 views)
Shortcut
Re: [brockb] LUIS or anybody, question about word cleaner [In reply to] Can't Post

I tested it again and again, at home and the office, but WordCleaner doesn't work at my system with de extra quotes.

I studied the original Luis' version of editor.js and noticed that there's only a double quote at the paste-command. At other places in the script Luis made no double quote.
In fact: the past option won't work in the original version i downloaded from webstationone.

Perhaps Luis himself can give his comments.


Luis
Veteran

May 17, 2004, 12:10 PM

Post #8 of 11 (5102 views)
Shortcut
Re: [kwillems] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Hi kwillems:

All the code in the function is correct. The problem here is how ilogically MS Word renders code differently everytime without an apparent reason. Therefore, you need to analyze what code is common to all cases when typing a single character in Word and add it to the function, but not taking appart any of the code that is already there.

The reason for having or not double quotes is because Word some times adds them and some other times does not. The best is having both declarations there.

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea


kwillems
User

May 17, 2004, 12:15 PM

Post #9 of 11 (5098 views)
Shortcut
Re: [Luis] LUIS or anybody, question about word cleaner [In reply to] Can't Post

LOL. Always knew Wordperfect was far better than MS-Word.

Anyway, could something like the following line be the solution?

if (str.indexOf("; mso-")>=0 ||str.indexOf("<v:")>=0 ||str.indexOf('class="Mso')>=0) || str.indexOf('class=Mso')>=0)


Luis
Veteran

May 17, 2004, 12:19 PM

Post #10 of 11 (5096 views)
Shortcut
Re: [kwillems] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Sure, and perhaps we will need to add some other code in the future as we keep discovering more incongruences in how Word renders HTML code.

Greetings again


Don't give up!!
http://webstationone.com/test/htmlarea


kwillems
User

May 17, 2004, 12:23 PM

Post #11 of 11 (5094 views)
Shortcut
Re: [Luis] LUIS or anybody, question about word cleaner [In reply to] Can't Post

Thanx for your explanaition!

 
 
 


Search for (options)