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

Why CKEditor converts <style> tags to <span> #15513

Closed
MRezaKarimi opened this issue Dec 12, 2023 · 1 comment
Closed

Why CKEditor converts <style> tags to <span> #15513

MRezaKarimi opened this issue Dec 12, 2023 · 1 comment
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket). type:question This issue asks a question (how to...).

Comments

@MRezaKarimi
Copy link

📝 Ask a question

When I load HTML content into CKEditor, it automatically converts <style> tags to something like this:

<span data-ck-unsafe-element="style">
* { box-sizing: border-box; }
body {margin: 0;}
.
.
.
</span>

This is my configuration:

const editorConfig = {
  htmlSupport: {
    disallow: [{ name: "script" }],
    allow: [
      {
        name: /.*/,
        attributes: [
          "align",
          "valign",
          "border",
          "color",
          "bgcolor",
          "font-size",
          "font-family",
          "text-align",
          "text-decoration",
          "cellpadding",
          "cellspacing",
          "colspan",
          "rowspan",
          "width",
          "height",
          "padding",
          "margin",
          "src",
          "href",
        ],
        classes: true,
        styles: true,
      },
    ],
  },
};

I also have installed @ckeditor/ckeditor5-html-support package


Framework: Vue 3
@ckeditor/ckeditor5-vue: ^4.0.1
@ckeditor/vite-plugin-ckeditor5: ^0.1.1
@ckeditor/ckeditor5-html-support: 40.1.0

@MRezaKarimi MRezaKarimi added the type:question This issue asks a question (how to...). label Dec 12, 2023
@Witoso
Copy link
Member

Witoso commented Dec 18, 2023

Hi! We don't allow setting the style in the editor. Please check the #14661 for workarounds.

@Witoso Witoso closed this as completed Dec 18, 2023
@Witoso Witoso added the resolution:resolved This issue was already resolved (e.g. by another ticket). label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket). type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

2 participants