ElementProxy

An element is anything on a Lucid document that can have properties and shape data:

Extends

Extended by


Constructors

new ElementProxy()

new ElementProxy(id, client): ElementProxy

Parameters

ParameterTypeDescription
idstringID of this element
clientEditorClient

Returns

ElementProxy

Overrides

PropertyStoreProxy.constructor


Properties

allShapeData

readonly allShapeData: MapProxy<string, SerializedFieldType | DataError>;

All shape data accessible on this element, including shape data inherited from the page or a containing group.
This collection is read-only.


client

protected readonly client: EditorClient;

Inherited from

PropertyStoreProxy.client


id

readonly id: string;

ID of this element

Inherited from

PropertyStoreProxy.id


properties

readonly properties: WriteableMapProxy<string, UnsafeJsonSerializableOrUndefined, void, UnsafeJsonSerializableOrUndefined>;

All properties available on this element, organized by name.
Not all properties are writeable (e.g. "ClassName" on a block).
To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.

For text area properties, properties.get('Text') returns plain text. To get or set
rich text with inline formatting (bold, italic, links, line spacing), use the Rich:
prefix: properties.get('Rich:Text') returns {t: string, m: Array} with text and
markup, and properties.set('Rich:Text', {t: 'hello', m: [{s: 0, e: 5, n: 'b', v: true}]})
sets bold text. This works with any text area name (e.g. 'Rich:Title',
'Rich:Cell_0,1').

Inherited from

PropertyStoreProxy.properties


referenceKeys

readonly referenceKeys: MapProxy<string | number, ReferenceKeyProxy>;

The set of reference keys, organized by their ID, which can be either a string or number.

For more information, see the Developer Guide.


shapeData

readonly shapeData: ShapeDataProxy;

The shape data set directly on this element (not including any shape data inherited from the page or a containing group).


Methods

executeFormula()

executeFormula(formula): SerializedFieldType | DataError

Execute a formula in the context of this element

Parameters

ParameterTypeDescription
formulastringThe formula text, e.g. "@a + @b" to add together the shape data values a and b.

Returns

SerializedFieldType | DataError

The result of the formula, or an error.


exists()

exists(): boolean

Returns

boolean

true if this element still exists on the document, or false otherwise


removeReferenceKey()

removeReferenceKey(key): void

Remove the specified reference key from this element.

Parameters

ParameterTypeDescription
keystring | number

Returns

void


setReferenceKey()

setReferenceKey(key, settings): void

Set a reference key on this element, replacing any existing reference at the specified key.

Parameters

ParameterTypeDescription
keystring | number
settingsReferenceKeyDefinition

Returns

void