The currently-open Lucid document
Extends
Constructors
new DocumentProxy()
new DocumentProxy(client): DocumentProxyParameters
| Parameter | Type |
|---|---|
client | EditorClient |
Returns
Overrides
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
cardIntegrationConfigs
readonly cardIntegrationConfigs: MapProxy<string, CardConfigProxy>;client
protected readonly client: EditorClient;Inherited from
id
readonly id: string;ID of this element
Inherited from
pages
readonly pages: MapProxy<string, PageProxy>;The set of pages on this document, organized by 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.
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
rules
readonly rules: MapProxy<string, RuleProxy>;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
addPage()
addPage(def): PageProxyAdd a new page to the current document
Parameters
| Parameter | Type | Description |
|---|---|---|
def | PageDefinition | Definition of the page to add |
Returns
The created page
addRule()
addRule(definition): undefined | RuleProxyParameters
| Parameter | Type |
|---|---|
definition | RuleDefinition |
Returns
undefined | RuleProxy
allBlocks()
allBlocks(): Generator<BlockProxy, void, unknown>An iterator over all blocks on all pages of the document
Returns
Generator<BlockProxy, void, unknown>
allLines()
allLines(): Generator<LineProxy, void, unknown>An iterator over all lines on all pages of the document
Returns
Generator<LineProxy, void, unknown>
duplicateItems()
duplicateItems(ids): DuplicateItemsResultParameters
| Parameter | Type |
|---|---|
ids | string[] |
Returns
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
getTitle()
getTitle(): stringReturns
string
The title of this document
hookAllChanges()
hookAllChanges(callback): stringInfrequently, you may need to watch for any changes to the document. These changes may be
the local user adding content, or a data integration sending updated records to a data collection,
or a remote user hitting undo, or any user entering or exiting an intra-document mutex.
Because these changes may happen rapidly, the callback you provide here will only be called on
a heavily-debounced schedule. The callback will happen between 1-10 seconds after changes are
made to the document, depending on the frequency with which changes are happening.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | () => void |
Returns
string
A handle that can be passed into unhookAllChanges
hookCreateItems()
hookCreateItems(callback): stringWatch for new blocks, lines, or groups added to this document. The callback will
be called with new items created by the current user, but will not be called with items
created
- As part of a generated diagram, e.g. org chart
- By another user on the same document
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (items) => void |
Returns
string
A handle that can be passed to unhookCreateItems
hookDeleteItems()
hookDeleteItems(callback): stringWatch for new blocks, lines, or groups deleted from this document. The callback will
be called with items deleted by the current user, but will not be called with items
deleted
- As part of a generated diagram, e.g. org chart
- By another user on the same document
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (itemIds) => void |
Returns
string
A handle that can be passed to unhookDeleteItems
removeReferenceKey()
removeReferenceKey(key): voidRemove the specified reference key from this element.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | number |
Returns
void
Inherited from
ElementProxy.removeReferenceKey
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
Inherited from
setTitle()
setTitle(title): voidUpdates the title of this document
Parameters
| Parameter | Type | Description |
|---|---|---|
title | string | The new title for this document |
Returns
void
unhookAllChanges()
unhookAllChanges(handle): voidParameters
| Parameter | Type | Description |
|---|---|---|
handle | string | Return value from hookAllChanges |
Returns
void
unhookCreateItems()
unhookCreateItems(handle): voidParameters
| Parameter | Type | Description |
|---|---|---|
handle | string | Return value from hookCreateItems |
Returns
void
unhookDeleteItems()
unhookDeleteItems(handle): voidParameters
| Parameter | Type | Description |
|---|---|---|
handle | string | Return value from hookDeleteItems |
Returns
void