There is a component in the textarea field that takes any html/css/js template.
I need to create a preview of this template with valid working template code (styles, scripts, style classes)
1st option - a crutch: redirection to another page
, the downside is that there are a lot of errors in the console
2nd option is to do it in backend, however, there are no ideas how to proceed further.
I have a primitive code editor

and with the preview button you need to display the working code
1 option to display in another component
2nd option display in another window