match4everyone / match4everything

Other
7 stars 0 forks source link

CKEditor adds <p>'s around text automatically #150

Open bjrne opened 4 years ago

bjrne commented 4 years ago

Describe the bug When editing a snippet in django-cms, the WYSWYG Editor in use, CKEditor, automatically adds paragraphs around the whole snipped.

bjrne commented 4 years ago

This might be harder/more stupid than anticipanted. A google search still yields forum entries from 2008, when CKEditor 3 was used. The most recent one is CKEditor 5.

So back in 2008, a LOT of people were complaining about this (1, 2), with one maintainer responding with snappy comments only:

if your one post to our "community" forums is all you can do to contribute, there is no much lucky for you here, sorry.

Reading the forums, I think they never anticipated the usecase of their editor in a cms that is used as granular as we (and lots of others) do. With the release of CKEditor 4 they caved and added some config options. However, in version 5, they removed it again because it "simplified the editors code"(3).

CKEditor 4 also did autoparagraph stuff by default. There was an option to disable that, though. In CKEditor 5 there's no such option and I'm not sure there will be. It's creating enormous complexity and that's why we decided to not implement it. It greatly simplified the editor's code. [...] The default block type in the model is paragraph. You won't be able to change that because that's one of the few things hardcoded in the engine.

The CKEditor 5 project leader explains part of the complexity a bit better here.

Our pip requirements currently state djangocms_text_ckeditor==3.9.1, which is the most recent version and uses CKEditor 4.7.3.

Given that djangocms still uses Version 4 (which seems to be maintained very well), we could try some of the config choices and see if that helps our use-case. Skimming through the issues it still did not seem easy to achieve exactly what we (and others) want, which is to not add anything except for when the user presses enter (e.g. when editing longer explanantion texts).