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:
Word filter


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.

 


MK
Novice

Jan 13, 2003, 8:09 AM

Post #1 of 20 (5987 views)
Shortcut
Word filter Can't Post

Hallo everybody!!

Is it possible to clean up the HTML-code when a user paste in text direct from Word or Excel. I want to remove all font-tags and paragraf (<P>) -tags and only keep formating tags like bold, italic etc. But I want to keep the ability to change to font-color inside HTML-area.

Regards Mats


redspider
User

Jan 13, 2003, 8:44 AM

Post #2 of 20 (5975 views)
Shortcut
Re: [MK] Word filter [In reply to] Can't Post

For more info see posting: http://www.interactivetools.com/forum/forum.cgi?post=3558

I use the code below to cleanup Word files



// custom 4 Word Clean-up

else if (cmdID == 'custom4') {
var oTags = editdoc.all.tags("SPAN");
if (oTags != null) {
for (var i = oTags.length - 1; i >= 0; i--) {
oTags.outerHTML = oTags.innerHTML;
}
}
oTags = editdoc.all.tags("P");
if (oTags != null) {
for (var i = oTags.length - 1; i >= 0; i--) {
cleanEmptyTag(oTags);
}
}
oTags = editdoc.all.tags("OL");
if (oTags != null) {
for (var i = oTags.length - 1; i >= 0; i--) {
cleanEmptyTag(oTags);
}
}
oTags = editdoc.all.tags("UL");
if (oTags != null) {
for (var i = oTags.length - 1; i >= 0; i--) {
cleanEmptyTag(oTags); }
}
}
greetz

Redspider
Belgium
http://www.tielt.be


MK
Novice

Jan 13, 2003, 9:11 AM

Post #3 of 20 (5967 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

Thanks for the information!

Some questions:

1: Will your code remove font-tags?

2: I suppose that I have to place the code in editor.js . Do I have to do something else to get it to work?

Regards



Mats


redspider
User

Jan 13, 2003, 9:38 AM

Post #4 of 20 (5963 views)
Shortcut
Re: [MK] Word filter [In reply to] Can't Post

Mats,

The script will remove the font-tags .

You must place the code into the editor.js-file and define a new buttom to activate the script.

vb.

this.toolbar = [
['custom4'],

this.btnList = {
"custom4": ['custom4', 'Ruim MS-WORD tags op" ', 'editor_action(this.id)', 'ed_word.gif'],

Add the code in the custom area.

That's all. If you want i post my JS file, let me know





greetz

Redspider
Belgium
http://www.tielt.be


MK
Novice

Jan 13, 2003, 12:43 PM

Post #5 of 20 (5955 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

Hallo!

Thanks for all help Redspider!!

I would appreciate if you want to publish your .js file.

Regards
Mats


redspider
User

Jan 13, 2003, 1:06 PM

Post #6 of 20 (5953 views)
Shortcut
Re: [MK] Word filter [In reply to] Can't Post

Mats,

In Attach, not the JS file but the whole Zip-file with all the files.Wink

This version also include's "lvni900" table function, other functions from lvni and all the image's.

Have fun with it.
greetz

Redspider
Belgium
http://www.tielt.be

(This post was edited by redspider on Jan 13, 2003, 1:12 PM)
Attachments: htmlarea_wme.zip (82.8 KB)


snooper
User

Jan 14, 2003, 2:19 AM

Post #7 of 20 (5934 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

hey there red'

mm... this looks great. mind if i nab it too? i've seeking soemthing like this.
will take a look at installing, i know nothing about JS, so hope its easy ;)

and whats the table thing you mention?

thanks!

sn


redspider
User

Jan 14, 2003, 2:49 AM

Post #8 of 20 (5929 views)
Shortcut
Re: [snooper] Word filter [In reply to] Can't Post

sn,

No prob. it's open source Smile

Lvni900 has made it posible to edit tables with HtmlArea (insert rows, delete rows, insert cells , ...)
In the version in previous attach i have the table function, copy-paste, preview, ... included.

Just unzip the file, open example.asp and you see how it works. If you want to use HtmlArea in your own application replace <textarea></textarea> and past the code below (replace in code the name (tekst) of the textaere to your own). Also include the editor.inc in your page.

<%Response.Write "<textarea name='tekst' id='tekst' contentEditable='true' " & _
" cols=70 rows=20>" & strTekst & "</textarea><script language='javascript1.2'>" & _
" editor_generate('tekst'); // field, width, heig
ht " & _
"</script>"
%>



greetz

Redspider
Belgium
http://www.tielt.be

(This post was edited by redspider on Jan 14, 2003, 2:52 AM)


snooper
User

Jan 14, 2003, 3:26 AM

Post #9 of 20 (5926 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

hey Red'

thanks!

just took a look around, looks great! thanks for sharing!

couple of questions though -
  1. Are the "alt" tags available in English, as well the the UI instructions for table, images etc..?
  2. Is there a way to tell the Word cleaner to take out things like: dir=ltr style="MARGIN: 0cm 0cm 0pt" which it doesnt seem to take out (unless you use the Word 2000 Html filter - which i cant count on the users having... or bothering to use!)
  3. mmm ... (sure i had a 3rd one... cant remember!)
  4. ah - ok remembered - thanks for the instructions for installation. this differs from the 'regular' installation, right? how come? and is it ok to take out the <object> tag from the end of the example.asp page?


anyway -thanks already, i can see a lot has gone into this!

snooper


(This post was edited by snooper on Jan 14, 2003, 3:28 AM)


redspider
User

Jan 14, 2003, 5:04 AM

Post #10 of 20 (5920 views)
Shortcut
Re: [snooper] Word filter [In reply to] Can't Post

Sn,

In attch my new JS file, it remove's "margin" and "font" tags.

The "alt" tags you can always edit.

Just open notepad and search for "this.btnList = {" you see the all the discriptions of the buttoms. Just remove the dutch alt-tag in the 3th column ( see 'knip' in the example below) and replace it with the discriptions from the first column (these are still in english) . After edit the code save it again as "editor.js"

"cut": ['Cut', 'knip', 'editor_action(this.id)', 'ed_cut.gif'],

The reason the instructions for installation are differs from the regular installation is because i cut the code from my application. I think ik will work if follow the regular installation.

I hope this wil be usefull for you
greetz

Redspider
Belgium
http://www.tielt.be


snooper
User

Jan 14, 2003, 5:43 AM

Post #11 of 20 (5918 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

Hey Red

thanks for the answers, much appreciated!

i didnt though see the new JS file attached, if you dont mind sending it again.

thanks again - this is excellent!

sn


redspider
User

Jan 14, 2003, 5:57 AM

Post #12 of 20 (5916 views)
Shortcut
Re: [snooper] Word filter [In reply to] Can't Post

oeps ....

Here it is.
greetz

Redspider
Belgium
http://www.tielt.be
Attachments: EDITOR.js (73.5 KB)


snooper
User

Jan 14, 2003, 6:35 AM

Post #13 of 20 (5910 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

hi again Red

thanks for the file. just tried it, doesnt seem to work on my side.
the dir=ltr style="MARGIN: 0cm 0cm 0pt"... still is there.
also (but this is minor) - the button disbaling doesn work in this latest version, when moving to html mode.

sorry for the hassles...Blush

thanks

sn


redspider
User

Jan 14, 2003, 7:05 AM

Post #14 of 20 (5907 views)
Shortcut
Re: [snooper] Word filter [In reply to] Can't Post

i will look at it tonight (margin prob.)

De prob. with the HTML-mode is also a problem where i don't have an answer for.
Disabling the buttom in the toolbar is simple, getting it to work not Unsure

UPDATE:
Put my local version online: http://www.tielt.be/testzone/example.asp It seems to work fine (word filter), sorry
greetz

Redspider
Belgium
http://www.tielt.be

(This post was edited by redspider on Jan 14, 2003, 7:17 AM)


snooper
User

Jan 14, 2003, 7:39 AM

Post #15 of 20 (5903 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

THanks! look forward to anything you come up with!

sn

ps - your example works nice :)


redspider
User

Jan 14, 2003, 7:46 AM

Post #16 of 20 (5901 views)
Shortcut
Re: [snooper] Word filter [In reply to] Can't Post

The word-filter also ???

If so, clearing your browsercache and refresh your page with function "CTRL+F5" maybe help with your local machine. Otherwise i don't have a sugestion at ths moment.
greetz

Redspider
Belgium
http://www.tielt.be


snooper
User

Jan 14, 2003, 7:57 AM

Post #17 of 20 (5899 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

well, the filter worked well, just like the 1st version you sent me. the "style" element still stayed though.

even if you cant get it to remove it, its still not bad - takes out all the major stuff.

thanks

Sn


redspider
User

Jan 14, 2003, 9:14 AM

Post #18 of 20 (5892 views)
Shortcut
Re: [snooper] Word filter [In reply to] Can't Post

SN,

new JS-file cleans <H> -tag

Have fun
greetz

Redspider
Belgium
http://www.tielt.be
Attachments: EDITOR.js (72.8 KB)


MK
Novice

Jan 20, 2003, 3:15 AM

Post #19 of 20 (5842 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post

Hallo!!

Thanks for all help Redspider!!

I have got one more problem. When you paste a document from word into HTML-area and then run your command HTML-area replaces all "enter" with <P> or sometimes (if the text is centered) <P align=center>. Is it possible to remove this tags and keep the "center formating".



Regards

Mats


hotfirewire
New User

Jan 20, 2003, 3:49 PM

Post #20 of 20 (5809 views)
Shortcut
Re: [redspider] Word filter [In reply to] Can't Post


In Reply To
i will look at it tonight (margin prob.)

De prob. with the HTML-mode is also a problem where i don't have an answer for.
Disabling the buttom in the toolbar is simple, getting it to work not Unsure

UPDATE:
Put my local version online: http://www.tielt.be/testzone/example.asp It seems to work fine (word filter), sorry


 
 
 


Search for (options)