ViewElementObjectDefinition
interface
A plain object that describes a view element in a way that a concrete, exact view element could be created from that description.
const viewDefinition = {
name: 'h1',
classes: [ 'foo', 'bar' ]
};Copy codeAbove describes a view element:
<h1 class="foo bar"></h1>Copy codeAn example with styles and attributes:
const viewDefinition = {
name: 'span',
styles: {
'font-size': '12px',
'font-weight': 'bold'
},
attributes: {
'data-id': '123'
}
};Copy codeDescribes:
<span style="font-size:12px;font-weight:bold" data-id="123"></span>Copy codeProperties
attributes?: Record<string, string>module:engine/view/elementdefinition~ViewElementObjectDefinition#attributesObject with key-value pairs representing attributes. Each object key represents attribute name. Value under that key must be a string.
classes?: ArrayOrItem<string>module:engine/view/elementdefinition~ViewElementObjectDefinition#classesClass name or array of class names to match. Each name can be provided in a form of string.
name: stringmodule:engine/view/elementdefinition~ViewElementObjectDefinition#nameView element name.
priority?: numbermodule:engine/view/elementdefinition~ViewElementObjectDefinition#priorityElement's priority.
styles?: Record<string, string>module:engine/view/elementdefinition~ViewElementObjectDefinition#stylesObject with key-value pairs representing styles. Each object key represents style name. Value under that key must be a string.