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:
Not allowing paste/formatting..


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.

 


tylercruz
Novice

Dec 13, 2004, 11:32 PM

Post #1 of 7 (3747 views)
Shortcut
Not allowing paste/formatting.. Can't Post

Hi,

I have modified my HtmlArea to only allow 2 fonts, and 2 font sizes, but when my staff copy/paste text from somewhere else into HtmlArea, it will preserve their formatting - is there a simple way to prevent this - ideally making the pasted text only the same as the HtmlArea formatting I allow?

Thanks in advance!

Tyler


tylercruz
Novice

Dec 14, 2004, 8:00 PM

Post #2 of 7 (3721 views)
Shortcut
Re: [tylercruz] Not allowing paste/formatting.. [In reply to] Can't Post

Could somebody please help?


Luis
Veteran

Dec 15, 2004, 1:33 AM

Post #3 of 7 (3714 views)
Shortcut
Re: [tylercruz] Not allowing paste/formatting.. [In reply to] Can't Post

Hi tylecruz:

Put this function at the end of editor.js

function setDefaultFont(editdoc){
var fonts = editdoc.body.getElementsByTagName("FONT");
for (j=0; j < fonts.length; j++) {


if(fonts.size !=null){
if (fonts.size != "2"){fonts.size="2";}
}


if(fonts.face !=null){
if (fonts.face.indexOf('Arial') == -1){
fonts.face = "Arial, Helvetica";
}
}
}
}


Change the values in red to match your default font face and size. Then, to call the function onpaste, search for this line in editor.js:

editdoc.body.onpaste = function() { editor_event(objname, 100); }

and change it for:

editdoc.body.onpaste = function() {
editor_event(objname, 100);
setTimeout(function(){setDefaultFont(editdoc);}, 100);
}


I hope this be of help.

greetings


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


(This post was edited by Luis on Dec 15, 2004, 1:38 AM)


tylercruz
Novice

Dec 15, 2004, 1:36 AM

Post #4 of 7 (3708 views)
Shortcut
Re: [Luis] Not allowing paste/formatting.. [In reply to] Can't Post

Thanks - I'm going to try this in a bit. If it works, I'm going to come back and kiss you so passionately, others will suspect my sexual orientation!


tylercruz
Novice

Dec 15, 2004, 3:48 AM

Post #5 of 7 (3699 views)
Shortcut
Re: [Luis] Not allowing paste/formatting.. [In reply to] Can't Post

Hi Luis,

Thanks a lot for your help, unfortunately that change didn't work. I didn't receive any errors, but when I tried copy/pasting form Wordpad to my HtmlArea, it still retained all the formatting.

Is there anything else I could try?

Thanks a lot..


Luis
Veteran

Dec 15, 2004, 4:32 AM

Post #6 of 7 (3696 views)
Shortcut
Re: [Luis] Not allowing paste/formatting.. [In reply to] Can't Post

Sure it works. Try the attached editor.


Don't give up!!
http://webstationone.com/test/htmlarea
Attachments: editor.js (46.7 KB)


tylercruz
Novice

Dec 15, 2004, 5:03 AM

Post #7 of 7 (3689 views)
Shortcut
Re: [Luis] Not allowing paste/formatting.. [In reply to] Can't Post

Hi Luis,

Your attached file worked perfectly - was there something you missed perhaps, in the instructions for modifying the editor.js? Because when I made the changes you originally said, it didn't work, but your attached file did.

Thanks again, and happy holidays :)

 
 
 


Search for (options)