miztroh-zz / wysiwyg-e

A what-you-see-is-what-you-get editor created with Polymer
85 stars 18 forks source link

some html no longer works (iframes for instance) #214

Closed exper1 closed 6 years ago

exper1 commented 6 years ago

Previously in the 1.x version, I could pass html content and wysiwyg-e would render it. Now it seems I can only basic html such as images, links, headers, etc. I need to be able to have iframes as well. I think this might have been sanitized with the 2.x versions. Is there any way to get this functionality back?

miztroh-zz commented 6 years ago

By default, the editor only allows tags that it uses internally. Then, tools add to the allowed tags list based on what they use internally (i.e. the image tool adds 'img' to the allowed tags list). If you need to be able to configure the iframe, I'd suggest a custom tool. If no configuration is needed, then you can just add 'iframe' to the editor's allowedTagNames property.

For a basic example with only one editor:

document.querySelector('wysiwyg-e').allowedTagNames.push('iframe');

You'll need to do the above before loading content.