ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Documentation on "How to set the height of CKEditor 5" fails for the source view

Open Verdoso opened this issue 4 months ago • 1 comments

📝 The documentation on how to set the height of CKEditor 5 fails for the source view

If you follow the documentation ( https://ckeditor.com/docs/ckeditor5/latest/framework/how-tos.html#how-to-set-the-height-of-ckeditor-5 ) and add the following to your css:

.ck-editor__editable_inline:not(.ck-comment__input *) {
	height: 300px;
	overflow-y: auto;
}

When you change to the source view, the limited height applies no more and the editor grows "infinitely". Moreover, you have no scroll bar now in the editor and have to use the page scroll-bar. The cause is that the source view is not under div.ck-editor__editable_inline hierarchy but it's a div.ck-source-editing-area at the same level.

In my case, adding something like this snippet works:

.yourspecificlass .ck-source-editing-area textarea {
	height: 300px;
	overflow-y: auto;
}

You have to add the ".yourspecificlass" because otherwise depending on the order or your css loading, you might not overwrite the textarea styles, so you have to be more specific so the order does not matter. In my case, I use a scoped style (Vue).

Just in case someone comes across issue 15500, like me, and finds out it does not work with the source view.

Cheers!

Verdoso avatar Aug 05 '26 09:08 Verdoso

Hi @Verdoso!

Thanks a lot for the report and for the detailed analysis with a working workaround. We'll take a look at the guide and see how to cover the source editing area. Thanks again!

jacek-cke avatar Aug 06 '26 13:08 jacek-cke