You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, RootConfig#element only accepts an existing DOM element reference (HTMLElement). Per the decisions in RFC #19864 and RFC #19921, this field should be expanded to also accept:
A tag name string (e.g. 'h1', 'article') — the editor creates a new DOM element with that tag.
A full element definition object — { name, attributes?, classes?, styles? } describing the element to create, including an alternative flat notation where class and style are passed as strings inside attributes.
Classic Editor special case
ClassicEditor uses config.attachTo for the source/reference DOM element. Its root.element defines the editable root created inside the UI box, so it should only accept a tag name or definition object — not a DOM element reference. An error should be thrown if one is passed.
Definition of Done
RootConfig#element accepts a tag name string — the editor creates a DOM element with that tag and uses it as the editable root.
RootConfig#element accepts a full element definition object — { name, attributes?, classes?, styles? }, with the alternative flat notation also supported.
Backward compatible — HTMLElement reference still works. Omitting element defaults to <div>.
Works in all root contexts — config.root.element, config.roots.*.element, editor.addRoot(), and MultiRootEditor.createEditable().
Classic Editor guard — throws an error if a DOM element reference is passed in root.element.
Integrates with modelElement — works correctly alongside RootConfig#modelElement (e.g. $inlineRoot with an <h1> editable root).
Context
Currently,
RootConfig#elementonly accepts an existing DOM element reference (HTMLElement). Per the decisions in RFC #19864 and RFC #19921, this field should be expanded to also accept:'h1','article') — the editor creates a new DOM element with that tag.{ name, attributes?, classes?, styles? }describing the element to create, including an alternative flat notation whereclassandstyleare passed as strings insideattributes.Classic Editor special case
ClassicEditorusesconfig.attachTofor the source/reference DOM element. Itsroot.elementdefines the editable root created inside the UI box, so it should only accept a tag name or definition object — not a DOM element reference. An error should be thrown if one is passed.Definition of Done
RootConfig#elementaccepts a tag name string — the editor creates a DOM element with that tag and uses it as the editable root.RootConfig#elementaccepts a full element definition object —{ name, attributes?, classes?, styles? }, with the alternative flat notation also supported.HTMLElementreference still works. Omittingelementdefaults to<div>.config.root.element,config.roots.*.element,editor.addRoot(), andMultiRootEditor.createEditable().root.element.modelElement— works correctly alongsideRootConfig#modelElement(e.g.$inlineRootwith an<h1>editable root).RootConfig#elementtyped asHTMLElement | string | ElementDefinition.addRoot(), andcreateEditable().