You can use the
getValue() method to get the content from an editor instance. What you do with it after that it outside of the scope of the library.
I used the getValue() method but it does not display on iframe when calling it with iframe.src. When using s div and appending it works but it append the entire code, for example if i write console.log() in the textarea it will append console.log() not the result