ViewRootElementDefinition
interface
A description of the DOM element used as an editor's editable root, accepted by config.root.element.
const element: ViewRootElementDefinition = {
name: 'h1',
classes: [ 'article-title' ],
styles: { 'font-weight': 'bold' },
attributes: { 'data-id': '123' }
};
Copy code
class and style may also be passed as strings inside attributes as a shorthand:
const element: ViewRootElementDefinition = {
name: 'h1',
attributes: { class: 'article-title', style: 'font-weight: bold' }
};
Copy code
Properties
attributes : Record<string, string> | undefinedmodule:core/editor/editorconfig~ViewRootElementDefinition#attributesAdditional DOM attributes to apply to the editable element.
classes : string | Array<string> | undefinedmodule:core/editor/editorconfig~ViewRootElementDefinition#classesClass name or array of class names to apply to the editable element. Each name can be provided as a string.
name : string | undefinedmodule:core/editor/editorconfig~ViewRootElementDefinition#nameThe DOM tag name to use. Defaults to
'div'when not provided, so integrators can keep the default element and still specifyclasses,styles, orattributes.styles : Record<string, string> | undefinedmodule:core/editor/editorconfig~ViewRootElementDefinition#stylesInline styles to apply to the editable element as a record of style properties.