Sign up (with export icon)

ViewRootElementDefinition

Api-interface iconinterface

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

  • Chevron-right icon

    attributes : Record<string, string> | undefined

    Additional DOM attributes to apply to the editable element.

  • Chevron-right icon

    classes : string | Array<string> | undefined

    Class name or array of class names to apply to the editable element. Each name can be provided as a string.

  • Chevron-right icon

    name : string | undefined

    The DOM tag name to use. Defaults to 'div' when not provided, so integrators can keep the default element and still specify classes, styles, or attributes.

  • Chevron-right icon

    styles : Record<string, string> | undefined

    Inline styles to apply to the editable element as a record of style properties.