Remove external html tags when copying into an iframe text editor -
i have made custom iframe based text editor scratch. looking implement 2 features now. here iframe :
<div id="iframe-container" style="height: 200px; width : 450px ; border:1px solid #1d1d1d;"> <iframe id="wysiwygtextfield" onload = 'return iframevents(); ' frameborder="0" style="height: 100%; width:100%;" scrolling="no" > <html> <head> </head> <body> <br/> </body> </html> </iframe> </div>
at times when copy pasting web text contains styling rules of it's own.when text pasted regular input box styling disappears on it's own, iframe tends retain styling. there way copy paste iframe without html tags?
you can using regex:
var string = sample.replace(/(<([^>]+)>)/ig,"");
prevent copying text in web-page
sample text being loaded in iframe
replace function changes matched text another, nothing ""
.
then append modified text.
you may have this.
- onchange event select content of textarea
- run replace function
- done. :d
Comments
Post a Comment