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:
remove ALL HTML tags on paste ?


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.

 


100jan
New User

Sep 26, 2003, 9:52 AM

Post #1 of 3 (1941 views)
Shortcut
remove ALL HTML tags on paste ? Can't Post

How can all HTML tags be removed automaticly when user paste text into htmlarea ?
I'm using default htmlarea configuration, with 2 htmlareas on same page.

(there is a thread on this, but no solution)

Please help.
Thanx, Stojan.


taberg
New User

Sep 29, 2003, 10:07 AM

Post #2 of 3 (1880 views)
Shortcut
Re: [100jan] remove ALL HTML tags on paste ? [In reply to] Can't Post

Test this code in editor_event:

//Catch paste-functionality
if (editEvent && editEvent.type == 'paste') {
var clipboard = editor_obj.contentWindow.clipboardData.getData("Text");
if (clipboard == null) {clipboard = "";}
clipboard = clipboard.replace (/<(.*?)>/ig,'');
editor_insertHTML(objname,clipboard);
editEvent.returnValue=false;
return;
}



regards, taberg


100jan
New User

Sep 29, 2003, 3:23 PM

Post #3 of 3 (1859 views)
Shortcut
Re: [taberg] remove ALL HTML tags on paste ? [In reply to] Can't Post

I tried your code , but it doesn't seems to work.
Then I tried this code from another post:


Code
  

i changed the following line:

editdoc.body.onpaste = function() { cleanup_pasted(objname); }

and added at the end of the js file:

function cleanup_pasted(objname) {
var mytext = window.clipboardData.getData('Text');
window.clipboardData.clearData('Text');
window.clipboardData.clearData('HTML');
window.clipboardData.setData('Text', mytext);
}


 
 
 


Search for (options)