ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.54k stars 3.7k forks source link

Consider supporting a way to configure the editor for "Phrasing Content Only" #11697

Closed LukeLeber closed 2 years ago

LukeLeber commented 2 years ago

Background

Historically speaking in CKEditor4 there were three enter modes:<p>, <br>, and <div>. These modes all seem to make the assumption that the root context for CKEditor was block level. For systems that use CKEditor to syndicate content to third parties, this assumption does not hold true -- especially if some of the third parties are difficult and/or impossible to work with.

Some root contexts can only support a limited subset of HTML. For the purpose of this feature request, I'll be focusing on Phrasing Content. Basically (this might be an oversimplification...) Phrasing Content is the stuff that makes up paragraphs. In other words, the element types that are able to be included in a <p> element type.

Suppose that a content consumer renders CKEditor markup on their platform as follows:

<p class="third-party-content">{{ CKEDITOR CONTENT HERE }}</p>

As it stands, CKEditor is not a valid tool for this use case because it would form markup in one of the following varieties:

<p class="third-party-content"><p>CKEditor Content</p></p>

or

<p class="third-party-content"><div>CKEditor Content</div></p>

For situations where the content consumer is unable or unwilling to make accommodations on their platform, this forms a hard blocker.

📝 Provide a description of the new feature

This new feature would allow editor configurations to remove the assumption that all content should be wrapped in a block level element. Due to the decoupled nature of CKEditor5, it seems like this might be more feasible than it was in the past?

What is the expected behavior of the proposed feature? TBD

If you'd like to see this feature implemented, add a 👍 reaction to this post.

wimleers commented 2 years ago

Related context for CKEditor 4:

Related issue: #1537 — see @LukeLeber's comment at https://github.com/ckeditor/ckeditor5/issues/1537#issuecomment-1115372950.

wimleers commented 2 years ago

Was told by @NigelCunningham today that supporting this would mean he would not longer have to port https://www.drupal.org/project/ckeditor_no_autoparagraph to CKEditor 5 — and that by the way is based on https://drupal.stackexchange.com/questions/233283/how-to-remove-paragraph-tag-from-ckeditor#answer-253032.

Reinmar commented 2 years ago

I think this is a dup of #762. It's certainly doable and we've actually had a really promising PoC but never finished it.