Edit in GitHubLog an issue

@add-on-hlapi-sdk / Editor

Class: Editor

Entry point for APIs that read or modify the document's content.

Hierarchy

  • ProxyLiveObject

    Editor

Table of contents

Accessors

Methods

Accessors

context

get context(): Context

User's current selection context

Returns

Context


documentRoot

get documentRoot(): ExpressRootNode

Returns

ExpressRootNode

the root of the document.

Methods

createColorFill

createColorFill(color): ColorFill

Parameters

NameTypeDescription
color
The color to use for the fill.

Returns

ColorFill

a solid color fill.


createEllipse

createEllipse(): EllipseNode

Returns

EllipseNode

an ellipse node with default x/y radii, and no initial stroke or fill. Transform values default to 0.


createGroup

createGroup(): GroupNode

Returns

GroupNode

a group node.


createImageContainer

createImageContainer(bitmapData, options?): MediaContainerNode

Creates a bitmap image, represented as a multi-node MediaContainerNode structure. Always creates a "full-frame," uncropped image initially, but cropping can be changed after it is created by modifying the properties of the container's mediaRectangle and maskShape children.

Image creation involves some asynchronous steps. The image will be visible in this client almost instantly, but will render as a gray placeholder on other clients until it has been uploaded to storage and then downloaded by those clients. This local client will act as having unsaved changes until the upload has finished.

Parameters

NameTypeDescription
bitmapData
BitmapImage resource (e.g. returned from loadBitmapImage()).
options
Object
Additional configuration:
options.initialSize?
Size the image is displayed at. Must have the same aspect ratio as bitmapData. Defaults to the size the image would be created at by a UI drag-drop gesture (typically the image's full size, but scaled down if needed to stay below an application-defined size cap).

Returns

MediaContainerNode

MediaContainerNode representing the top container node of the multi-node structure.


createLine

createLine(): LineNode

Returns

LineNode

a line node with default start point and end point and a default stroke. Transform values default to 0.


createRectangle

createRectangle(): RectangleNode

Returns

RectangleNode

a rectangle node with default width and height, and no initial stroke or fill. Transform values default to 0.


createStroke

createStroke(options?): Stroke

See StrokeOptions for more details on the options fields. Defaults:

  • color has default value DEFAULT_STROKE_COLOR if none is provided.
  • width has default value DEFAULT_STROKE_WIDTH if none is provided.
  • dashPattern has default value [] if none is provided. If the dash pattern has odd number of elements, the items are copied to double the array. For example, [1, 2, 3] becomes [1, 2, 3, 1, 2, 3]. Values cannot be negative.
  • dashOffset has default value 0 if none is provided. This options field is ignored if no dashPattern was provided.

The stroke's position field cannot be specified via options yet because only center is supported.

Parameters

NameType
options?
Partial<StrokeOptions>

Returns

Stroke

a stroke configured with the given options.


createText

createText(): TextNode

Returns

TextNode

a text node with default styles. The text content is initially empty, so the text node will be invisible until its text property is set. Creates point text, so the node's width will automatically adjust to accommodate whatever text is set.


loadBitmapImage

loadBitmapImage(bitmapData): Promise<BitmapImage>

Creates a bitmap image resource in the document, which can be displayed in the scenegraph by passing it to createImageContainer to create a MediaContainerNode. The same BitmapImage can be used to create multiple MediaContainerNodes.

Note: image resources that are unused will be automatically cleaned up after the document is closed.

Async steps to upload image resource data continue in the background after this call's Promise resolves, but the BitmapImage return value can be used immediately. The local client will act as having unsaved changes until the upload has finished.

Parameters

NameTypeDescription
bitmapData
Blob
Encoded image data in PNG or JPEG format.

Returns

Promise<BitmapImage>

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.