Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0 - Add-Ons:
Luis Word Cleaner with HTML CLeaner



TNeves
New User

Feb 3, 2005, 7:48 AM


Views: 42419
Luis Word Cleaner with HTML CLeaner

 Hi all,

I┤m using the HTMLarea with Luis Word Cleaner in my aplications, but it is not working very well for what I need... When I paste some text that I copied of any site, the editor keeps all the formatting of texts (color, font, size), tables, etc
I would like that the EDITOR one only copied the text with basic formattings (Bold, Italic, Underline, BReak) and images tags.

If somebody will be able to help me will be very grateful!


PS: The code of the EDITOR is attached

PS2: Who to want to see an example: www.labomba.com.br/problema/index.html

THANKS!!!!!
Faša valer a pena

(This post was edited by TNeves on Feb 3, 2005, 7:51 AM)
Attachments: editor.zip (15.2 KB)


Luis
Veteran

Feb 3, 2005, 9:35 AM


Views: 42389
Re: [TNeves] Luis Word Cleaner with HTML CLeaner

Hi TNeves:

Take a look at function myclean(editdoc).

The first five lines are supposed to strip those tags at all, the rest only remove the attributes defined in function cleanEmptyTag(oTags).

If you want a tag stripped at all, just change it to the same format of the first five. For example, if you want to remove <H1>, make it:

oTags = editdoc.all.tags("SPAN"); if (oTags != null) {for (var i = oTags.length - 1; i >= 0; i--) {oTags.outerHTML = oTags.innerHTML;}}

Instead of:

oTags = editdoc.all.tags("H1"); if (oTags != null) {for (var i = oTags.length - 1; i >= 0; i--) {cleanEmptyTag(oTags);}}

Greetings



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


TNeves
New User

Feb 3, 2005, 10:16 AM


Views: 42382
Re: [Luis] Luis Word Cleaner with HTML CLeaner

Hi Luis,

I tried to make the changes that you said. As I want to remove tags FONT and TABLE (table, td, tr...), I start changing this line:

oTags = editdoc.all.tags("FONT"); if (oTags != null) {for (var i = oTags.length - 1; i >= 0; i--) {oTags.outerHTML = oTags.innerHTML;}}

to this line:

oTags = editdoc.all.tags("FONT"); if (oTags != null) {for (var i = oTags.length - 1; i >= 0; i--) {cleanEmptyTag(oTags);}}

But I did not see no difference in generated code HTML. I only want to preserv this tags when paste a text in the HTMLArea: IMG, B, I, U, A.

The example that I am using to make the tests is in: www.labomba.com.br/problema/index.html

Thanks again..
(Obrigado!!!)
Faša valer a pena

(This post was edited by TNeves on Feb 3, 2005, 10:21 AM)


TNeves
New User

Feb 4, 2005, 4:13 AM


Views: 42339
Re: [TNeves] Luis Word Cleaner with HTML CLeaner

Hi Luis (again.. hehehe),

I go to try to explain better what I need with the EDITOR(HTMLarea) to see if you or anybody can help me...
If you to have access link that I passed above (http://www.labomba.com.br/problema/index.html) you it will go to see in the end of the page the EIDTOR and some Smiles, where click in the image it is placed in the EDITOR... I would like it editor so that the people can leave the text while only BOLDFACE, UNDERLINED or ITALIC, and only place LINKS and these smiles.. These smiles cited are only images can be placed. The person cannot place image of other sites. This I control through the ASP (I compare tag of the image, and one will be smile authorized I records in the DB). The remain of tags I would like that I did not shown, therefore many people I copy the text of the Web, and when sending the message it is total dirty... You can see an example practical of that I am speaking in the address: http://www.labomba.com.br/listas/mural_editor_novo.asp?id=142


You will be able to see some "dirty" messages with codes HTML that had come together with the text copied of web

Thanks again!