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): ElementProxyParameters
| Parameter | Type | Description |
|---|---|---|
id | string | ID of this element |
client | EditorClient |
Returns
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
id
readonly id: string;ID of this element
Inherited from
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
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 | DataErrorExecute a formula in the context of this element
Parameters
| Parameter | Type | Description |
|---|---|---|
formula | string | The 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(): booleanReturns
boolean
true if this element still exists on the document, or false otherwise
removeReferenceKey()
removeReferenceKey(key): voidRemove the specified reference key from this element.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | number |
Returns
void
setReferenceKey()
setReferenceKey(key, settings): voidSet a reference key on this element, replacing any existing reference at the specified key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | number | |
settings | ReferenceKeyDefinition |
Returns
void