Problem/Motivation

In the field help settings for the "Manually editable HTML tags," it says this:

A list of HTML tags that can be used while editing source. It is only necessary to add tags that are not already supported by other enabled plugins. For example, if "Bold" is enabled, it is not necessary to add the <strong> tag, but it may be necessary to add <dl><dt><dd> in a format that does not have a definition list plugin, but requires definition list markup.

In the Text Format settings, I've added <style> and <script> as "Manually editable HTML tags," but the editor is not behaving the way I would expect. When I paste in some HTML from the old CKEditor into CKEditor 5, it's still stripping out those tags, even though I've explicitly defined them in this field as being allowed.

Steps to reproduce

1. Install CKEditor 5 module.
2. Create a Text Format that uses CKEditor 5.
3. Under "Source Editing" -> "Manually editable HTML tags" field, add <style> and <script> to the list of manually editable tags. Save the configuration.
4. In the actual editor, go into the HTML source view, and paste in some HTML that contains the <style> or <script> tag.
5. Switch the editor to the preview view.
6. Switch back to the HTML source view. Examine the HTML.

Expected: <style> and <script> tags should still show up in the HTML.

Actual: <style> and <script> tags have been stripped from the HTML.

Proposed resolution

Fix the bug that is preventing HTML tags from being rendered when they are specifically included in the "Manually editable HTML tags" field.

CommentFileSizeAuthor
Screenshot from 2021-12-31 15-04-16.png21.6 KBj2

Comments

J2 created an issue. See original summary.

wim leers’s picture

Assigned: Unassigned » wim leers

Wow, that is definitely an interesting/unexpected way to use this — although you're totally right that nothing signals that today! Digging into this…

Thanks for the (interesting! :D) bug report 🙏

wim leers’s picture

Title: Manually Editable HTML Tags not working as expected » [upstream] GHS does not support <style>
Category: Bug report » Feature request
Priority: Normal » Major
Issue tags: +Needs issue summary update, +Needs upstream feature, +stable blocker
Related issues: +#3245950: [upstream] <script> tag support in GHS

Reproduced.

First: scripts — <script>

Paste this:

<p>
    Hi
</p>
<script>alert('hello')</script>

CKEditor 5 automatically converts this to

<p>
    Hi
</p>
<p>
    Hi
</p>
<p>
    alert('hello')
</p>

even in the Full HTML text format 🤯 Ah, but wait, this is exactly the bug that #3245950: [upstream] <script> tag support in GHS reported.

Second: styles — <style>

Paste this:

<style>p { color: red}</style>
<p>
    Hi
</p>

CKEditor 5 automatically converts this to

<p>
    Hi
</p>

even in the Full HTML text format 🤯

This is a new discovery.

wim leers’s picture

I will bring this up in the next meeting we have with CKE5 developers. 👍

wim leers’s picture

wim leers’s picture

Discussed in CKE5 meeting: https://docs.google.com/document/d/1R0WI9eKt7vug79HrlEwI5BHfmdTgM1KJrjB6...

They'll work on adding support for this; should be simple, should be similar to what they did for <script> support in GHS.

wim leers’s picture

Title: [upstream] GHS does not support <style> » [upstream] <style> tag support in GHS
j2’s picture

@Wim Leers: Awesome! Thank you!

wim leers’s picture

Status: Active » Postponed
wim leers’s picture

Assigned: wim leers » Unassigned
Status: Postponed » Closed (duplicate)
Issue tags: -Needs issue summary update, -Needs upstream feature