A block, line, or group on a page of the current document.
Extends
Extended by
Constructors
new ItemProxy()
new ItemProxy(id, client): ItemProxy
Parameters
Parameter | Type | Description |
---|---|---|
id | string | ID of this item |
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
client
protected readonly client: EditorClient;
Inherited from
id
readonly id: string;
ID of this item
Inherited from
properties
readonly properties: WriteableMapProxy<string, JsonSerializable, void, JsonSerializable>;
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
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
textAreas
readonly textAreas: WriteableMapProxy<string, string, undefined, string>;
The plain text in each of the text areas on this item, organized by text area name.
textStyles
readonly textStyles: WriteableMapProxy<string, TextStyle, Promise<undefined>, Partial<TextStyle>>;
The text style in each of the text areas on this item, organized by text area name.
Methods
applyRule()
applyRule(rule): void
Parameters
Parameter | Type | Description |
---|---|---|
rule | RuleProxy | Rule to apply to this item |
Returns
void
changeZOrder()
changeZOrder(operation): void
Parameters
Parameter | Type | Description |
---|---|---|
operation | ZOrderOperation | How to adjust the Z order of this item relative to the other items it overlaps on the page |
Returns
void
delete()
delete(): void
Delete this item from the document
Returns
void
executeFormula()
executeFormula(formula): SerializedFieldType | DataError
Execute 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(): boolean
Returns
boolean
true
if this element still exists on the document, or false
otherwise
Inherited from
getBoundingBox()
getBoundingBox(): Box
Returns
The bounding box of this item relative to its containing page. As pages may change size
to fit the content on them, note that these coordinates may be negative or very large.
If this is a rotated block, the bounding box returned here is where the block would be if it were
unrotated.
getContainers()
getContainers(): BlockProxy[]
Returns
An array of blocks whose bounding boxes contain this item's upper-left corner
getLocation()
getLocation(): object
Returns
object
The x/y location of this item
x
x: number = bb.x;
y
y: number = bb.y;
getPage()
getPage(): PageProxy
Returns
The page containing this item
getPageId()
getPageId(): string
Returns
string
The ID of the page containing this item
measureText()
measureText(name, maxWidth): MeasureTextResult
Measure the amount of space necessary to render the text in the given text area, given a
width to measure that text within.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | Name of the text area whose content we should measure |
maxWidth | number | Width of the area in which to measure this text. The result will usually be no wider than this, but if a single word is long enough to go beyond this maxWidth, the width of that word will be returned. |
Returns
The size of rectangle necessary to render this text area's content.
offset()
offset(type, offset): void
Offset this item in the given direction by the given amount.
Parameters
Parameter | Type | Description |
---|---|---|
type | LinearOffsetType | The type of offset to apply to this item |
offset | Point | The amount to offset |
Returns
void
removeReferenceKey()
removeReferenceKey(key): void
Remove the specified reference key from this element.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | number |
Returns
void
Inherited from
ElementProxy
.removeReferenceKey
setBoundingBox()
setBoundingBox(bb): void
Attempts to move and resize this item to fit into the given bounding box. If this item (or another
item it contains) has size or aspect ratio restrictions, it may not be possible to fit the requested
location exactly.
This is done by moving this item to the requested location, then attempting to resize it from the
bottom-right corner to the requested size.
Parameters
Parameter | Type | Description |
---|---|---|
bb | Box | The bounding box to attempt to make this item fill |
Returns
void
setLocation()
setLocation(location): void
Moves this item so that its upper-left corner is positioned at the given location (prior to any rotation)
Parameters
Parameter | Type | Description |
---|---|---|
location | Point | The target location |
Returns
void
setReferenceKey()
setReferenceKey(key, settings): void
Set 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
unapplyRule()
unapplyRule(rule): void
Parameters
Parameter | Type | Description |
---|---|---|
rule | RuleProxy | Rule to remove from this item |
Returns
void