A generator on a page — an item that derives its shapes from some backing definition (e.g. a Mermaid diagram laid
out from markup). A single GeneratorProxy represents any generator type; its properties are read and written
generically via GeneratorProperty, and each generator type decides which properties it supports.
Extends
Constructors
new GeneratorProxy()
new GeneratorProxy(id, client): GeneratorProxyParameters
| Parameter | Type | Description |
|---|---|---|
id | string | ID of this element |
client | EditorClient |
Returns
Inherited from
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.
Inherited from
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.
Inherited from
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).
Inherited from
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.
Inherited from
exists()
exists(): booleanReturns
boolean
true if this element still exists on the document, or false otherwise
Inherited from
getProperty()
getProperty(property): UnsafeJsonSerializableOrUndefinedReads a GeneratorProperty from this generator.
Parameters
| Parameter | Type | Description |
|---|---|---|
property | "markup" | The property to read (e.g. GeneratorProperty.Markup). |
Returns
UnsafeJsonSerializableOrUndefined
The property value, or undefined if this generator does not have it.
listProperties()
listProperties(): "markup"[]Returns
"markup"[]
The GeneratorPropertys that this generator supports.
removeReferenceKey()
removeReferenceKey(key): voidRemove the specified reference key from this element.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | number |
Returns
void
Inherited from
ElementProxy.removeReferenceKey
setProperty()
setProperty(property, value): Promise<void>Sets a GeneratorProperty on this generator. Depending on the property and generator type this may
re-render the generator (e.g. setting Markup re-parses and re-lays-out a native Mermaid generator). Throws if
the generator does not support setting the property.
The returned promise resolves once the property has been applied. You may ignore it if you don't need to wait
for (or surface errors from) any re-render.
Parameters
| Parameter | Type | Description |
|---|---|---|
property | "markup" | The property to set (e.g. GeneratorProperty.Markup). |
value | UnsafeJsonSerializableOrUndefined | The new value for the property. |
Returns
Promise<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