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:
swapping — from MS Word


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.

 


snooper
User

Mar 30, 2004, 6:34 AM

Post #1 of 15 (4535 views)
Shortcut
swapping — from MS Word Can't Post

Hi Gang

i'm using one of Luis's versions of the Word cleaner.

i have noted that the funny long dash the Word uses still stays in. from looking at the code, i think its the —

how can i swap that to a regular dash that shows up properly, within the MS cleaner?



thanks!


Luis
Veteran

Mar 30, 2004, 11:45 AM

Post #2 of 15 (4528 views)
Shortcut
Re: [snooper] swapping — from MS Word [In reply to] Can't Post

Hi snooper:

Are you using the version that converts special characters?

If so, search for ,"—","-" in the var spchars array and change it to:

,"–","—"

Greetings.


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


snooper
User

Mar 30, 2004, 11:56 AM

Post #3 of 15 (4524 views)
Shortcut
Re: [Luis] swapping — from MS Word [In reply to] Can't Post

Hi Luis

thanks for the quick reply. not sure exactly wht you mean, but i do have this in the editor file:




if (ReplaceSpecialChars) {
/* Replace Special Character with Character Entities.
Method: String.fromCharCode(n)*/

var spchars = [
[255,254,253,252,251,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235,234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,172,171,169,168,167,166,165,164,163,162,161,376,339,353,8482,732,8211,8212,8226,8221,8220,8217,8216,338,352,8240,710,8224,8225,8230,8222,402,8218,8364,8249,8250,170],
["ÿ","þ","ý","ü","û","ú","ù","ø","÷","ö","õ","ô","ó","ò","ñ","ð","ï","î","í","ì","ë","ê","é","è","ç","æ","å","ä","ã","â","á","à","ß","Þ","Ý","Ü","Û","Ú","Ù","Ø","×","Ö","Õ","Ô","Ó","Ò","Ñ","Ð","Ï","Î","Í","Ì","Ë","Ê","É","È","Ç","Æ","Å","Ä","Ã","Â","Á","À","¿","¾","½","¼","»","º","¹","¸","·","¶","µ","´","³","²","±","°","¯","®","¬","«","©","¨","§","¦","¥","¤","£","¢","¡","Ÿ","œ","š","™","˜","—","–","•","”","“","’","‘","Œ","Š","‰","ˆ","‡","†","…","„","ƒ","‚","€","‹","›","ª"]
];
if (unclean) {
for(var j = 0; j < spchars[0].length; j++){
unclean = unclean.replace(eval("/"+String.fromCharCode(spchars[0][j])+"/g"),spchars[1][j]);
}



what should i insert and where?

thanks!

Sn


Luis
Veteran

Mar 30, 2004, 12:11 PM

Post #4 of 15 (4523 views)
Shortcut
Re: [snooper] swapping &mdash; from MS Word [In reply to] Can't Post

Hi snooper:

This is the code I mean:

In your code there is a mistake (maybe from my original code):
"&mdash;","&ndash;" are reversed. They should actually be "&ndash;","&mdash;".

If you what you want is the editor to convert dashes into hyphens make both "&ndash;","&ndash;"

Greetings


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


snooper
User

Mar 30, 2004, 12:23 PM

Post #5 of 15 (4520 views)
Shortcut
Re: [Luis] swapping &mdash; from MS Word [In reply to] Can't Post

mmmm..... i didnt even realize there was a differemnce between a dash and a hyphen. i guess i want the simplest thing, because mdash makes a little funny character on the web.

thanks, will try swapping them around as you said


Luis
Veteran

Mar 30, 2004, 2:55 PM

Post #6 of 15 (4517 views)
Shortcut
Re: [snooper] swapping &mdash; from MS Word [In reply to] Can't Post

Hi snooper:

Just a comment so you consider it in case you produce pages in English:
Some days ago I received a complain from a client because we were using hyphens were we were supposed to use dashes. I'm not a native English speaker, but it seems that both signs have a different use according to English grammar.

Greetings


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


snooper
User

Mar 30, 2004, 3:06 PM

Post #7 of 15 (4515 views)
Shortcut
Re: [Luis] swapping &mdash; from MS Word [In reply to] Can't Post

:) Thank Luis. i'm working in English and Hebrew, but i doubt the clients will really notice (heck - i dont!). thanks!

anyway... swapping round the n and m didnt seem to do the trick. is there anything else you can suggest?



thanks again!


Luis
Veteran

Mar 30, 2004, 3:28 PM

Post #8 of 15 (4514 views)
Shortcut
Re: [snooper] swapping &mdash; from MS Word [In reply to] Can't Post

Hi again snooper:

Swapping them is not enough. You need to change &mdash; for &ndash; in the var spchars array, so the editor writes short dashes always and/or converts long dashes to short dashes when pasting from another source.

Note: Maybe you'll need to switch to HTML Mode or submit your form to see the change reflected.


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


(This post was edited by Luis on Mar 30, 2004, 3:30 PM)


snooper
User

Mar 30, 2004, 3:34 PM

Post #9 of 15 (4508 views)
Shortcut
Re: [Luis] swapping &mdash; from MS Word [In reply to] Can't Post

yes, Luis. i do want short dashes always. and i do check thru HTML view to check it out, but nothing yet...

(what i've done so far is just switch the 2 around in the long line of &; chars).


Luis
Veteran

Mar 30, 2004, 6:34 PM

Post #10 of 15 (4504 views)
Shortcut
Re: [snooper] swapping &mdash; from MS Word [In reply to] Can't Post

Hi snooper:

Make sure you have set this.ReplaceSpecialChars=1 at the beginning of function cleanHTML(unclean)

I'm also attaching a file with the complete block.

Greetings


Don't give up!!
http://webstationone.com/test/htmlarea
Attachments: ReplaceSpecialChars.txt (2.00 KB)


snooper
User

Mar 31, 2004, 8:06 AM

Post #11 of 15 (4491 views)
Shortcut
Re: [Luis] swapping &mdash; from MS Word [In reply to] Can't Post

Thanks Luis

still doesnt seem to do the trick, though.

take a peak here, when you get a chance: http://mizrachi.org/onpaste27july/example.html the editor.js in the same location.

thanks ;)


Luis
Veteran

Mar 31, 2004, 11:25 AM

Post #12 of 15 (4485 views)
Shortcut
Re: [snooper] swapping &mdash; from MS Word [In reply to] Can't Post

Hi Snooper:

I took a look at your example and it does what it's supposed to do.

-Open the Insert Special Characters Dialog.
-Insert a (&mdash;)
-Switch to HTMLMode. You will see &ndash;
-Switch back to WYSIWYG and now you will see - (&ndash;)

This is what happens in your editor from my computer.

Greetings.


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


(This post was edited by Luis on Mar 31, 2004, 11:53 AM)


snooper
User

Mar 31, 2004, 11:31 AM

Post #13 of 15 (4482 views)
Shortcut
Re: [Luis] swapping &mdash; from MS Word [In reply to] Can't Post

mmm... ok. so what about skipping the Ndash part. and going straight to a simple dash.

is that do-able? Blush


Luis
Veteran

Mar 31, 2004, 12:01 PM

Post #14 of 15 (4480 views)
Shortcut
Re: [snooper] swapping &mdash; from MS Word [In reply to] Can't Post

Hi snooper:

What you can do is not to do any conversion for the &ndash;
In the long array in editor.js, write - instead of &ndash; in both places.


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


snooper
User

Mar 31, 2004, 1:38 PM

Post #15 of 15 (4473 views)
Shortcut
Re: [Luis] swapping &mdash; from MS Word [In reply to] Can't Post

perrrrrfect!Laugh

thanks Luis. sorry to have troubled you.

 
 
 


Search for (options)