Developers should be able to initialize the editor on a paragraph-like roots. For example, someone may want to make content of just an <h1> element editable:
<h1 id=editor>Title...</h1>
<script>
InlineEditor.create( document.getElementById( 'editor' ) )
.then( ... )
.catch( ... );
</script>
The inline type of editors are most often to be used in such a cases and there's even a ticket for InlineEditor already (https://github.com/ckeditor/ckeditor5-editor-inline/issues/3 and https://github.com/ckeditor/ckeditor5-editor-inline/issues/5). But this requirement applies also to BalloonEditor and I may imagine that someone might want to enable ClassicEditor in such a mode. So, since most of the work is needed in the common part of the code base (core, engine), I'd say that the solution could be generic to all kinds of editors from day one.
In case of editors which upcast existing DOM elements (like inline and balloon editors), the information about the type of element (whether it's div-like or paragraph-like) can be taken from that element itself. But in case of the classic editor it will need to be specified in the config. The config option could work for all editors, overriding the upcasted element.
What's kinda tricky here is mapping DOM element name to schema item name so we can create a model root with the right name. However, I think that this should be enough, taken that the automatic behaviour will be overridable by configuration anyway:
const paragraphLikeElements = [ 'p', 'h1', ... ];
getRootName( domElementName ) {
if ( paragraphLikeElements.includes( domElementName ) {
return '$block';
} else {
return '$root';
}
}
Defaulting to the generic $block item for all p/h1/etc elements should be enough.
Add :+1: to this post if you'd like this feature to be implemented.
I wrote a few words about how this can be achieved with minimal changes to existing editor creators: https://stackoverflow.com/questions/48896019/ckeditor5-inline-build-puts-a-p-tag-inside-of-an-h1-tag-how-do-i-disable-this/49130552#49130552
I'm curious if it'd work.
Here's a fiddle based on that suggestion. It does prevent new paragraphs from being created, but without the appropriate root there's still a child paragraph in the content.
https://jsfiddle.net/v81yndc7/2/
This is a hugely important feature for any app doing serious inline editing. It's not uncommon for headings, paragraphs, and even spans to be made editable.
We'll need to update https://github.com/ckeditor/ckeditor5/pull/1494/files#r255422201 after p-level editors are a thing.
There's been some work in this area and it looks really promising.
Discussions:
Branches:
Results:


Related tickets:
Those tests make us believe that there's not that much to do to enable such type of editors. I'm moving this up the waiting list.
The todo list:
$inlineRoot is the right direction.$inlineRoot.Are there any movements in this direction?
I would be interested in this as well