Search code examples
ckeditorckeditor5

Prevent from being added ".ck-reset" classes in CKEditor 5


By default, CK-Editor adds the resetting CSS classes like ".ck-reset":

.ck.ck-reset, .ck.ck-reset_all, .ck.ck-reset_all * {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-decoration: none;
    vertical-align: middle;
    transition: none;
    word-wrap: break-word;
}

What if I don't wish these classes? Which option is corresponding to disabling of CSS resetting classes?


Solution

  • There are a few ways you can try to solve this (copied from the GH issue below):

    1. A custom PostCSS plugin that replaces all .ck-reset statements with :not(.some-component) .ck-reset to disable CKEditor 5 reset in your component.
    2. Package.json level script that replaces the _reset.css files with your own css file with the not(.some-component)
    3. Wait for the issue to be resolved, per - https://github.com/ckeditor/ckeditor5/issues/3424