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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -