Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rendering the <script> tag in HTML preview #8326

Closed
pomek opened this issue Oct 23, 2020 · 1 comment · Fixed by #9706
Closed

Allow rendering the <script> tag in HTML preview #8326

pomek opened this issue Oct 23, 2020 · 1 comment · Fixed by #9706
Assignees
Labels
package:html-embed squad:core Issue to be handled by the Core team. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@pomek
Copy link
Member

pomek commented Oct 23, 2020

📝 Provide a description of the improvement

Right now, the scripts are being removed because we use the Element#innerHTML property for updating the preview container element.

function createPreviewContainer( { domDocument, state, props } ) {
const domPreviewContainer = createElement( domDocument, 'div', {
class: 'raw-html-embed__preview'
} );
const sanitizeOutput = props.sanitizeHtml( state.getRawHtmlValue() );
domPreviewContainer.innerHTML = sanitizeOutput.html;
return domPreviewContainer;
}

We could parse the HTML string and append a proper structure to the element.


If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@pomek pomek added type:improvement This issue reports a possible enhancement of an existing feature. package:html-embed labels Oct 23, 2020
@Mgsy Mgsy added the squad:core Issue to be handled by the Core team. label Oct 26, 2020
@Mgsy Mgsy added this to the nice-to-have milestone Oct 26, 2020
@wwalc
Copy link
Member

wwalc commented Nov 24, 2020

I'd consider my case as irrelevant, but I just stumbled upon this problem when I tried to quickly embed a 3rd party library in CKEditor to showcase the potential of widgets.

@pomek pomek self-assigned this May 14, 2021
@pomek pomek modified the milestones: nice-to-have, iteration 43 May 14, 2021
magda-chrzescian pushed a commit that referenced this issue May 14, 2021
Fix (html-embed): Allows rendering the `<script>` element inside the HTML preview. Closes #8326.
@AnnaTomanek AnnaTomanek changed the title Allows rendering the <script> tag in HTML preview Allow rendering the <script> tag in HTML preview May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:html-embed squad:core Issue to be handled by the Core team. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants