Search Docs
Loading...
Skip to content

Class: EditorAPI

EditorAPI provides methods for editor state management

Implements#

  • IEditorAPI

Constructors#

Constructor#


| Parameter | Type | | —— | —— | | engine | NativeEngine |

Returns#

EditorAPI

Role & Scope Management#

getRole()#


Get the current user role.

Returns#

RoleString

The current role of the user.

Implementation of#

IEditorAPI.getRole

Signature#

getRole(): RoleString

setRole()#


Set the user role and apply role-dependent defaults.

Automatically configures scopes and settings based on the specified role.

Parameters#

Parameter Type Description
role RoleString The role to assign to the user.

Returns#

void

Implementation of#

IEditorAPI.setRole

Signature#

setRole(role: RoleString): void

findAllScopes()#


Get all available global scope names.

Returns#

Scope$1[]

The names of all available global scopes.

Signature#

findAllScopes(): Scope$1[]

getGlobalScope()#


Get a global scope’s permission level.

Parameters#

Parameter Type Description
scope string The scope to query.

Returns#

"Allow" | "Deny" | "Defer"

Allow, Deny, or Defer indicating the scope’s permission level.

Signature#

getGlobalScope(scope: string): "Allow" | "Deny" | "Defer"

setGlobalScope()#


Set a global scope permission level.

Parameters#

Parameter Type Description
scope string The scope to configure.
value "Allow" "Deny"

Returns#

void

Signature#

setGlobalScope(scope: string, value: "Allow" | "Deny" | "Defer"): void

Edit Mode Management#

getEditMode()#


Get the editor’s current edit mode.

Edit modes represent different tools or interaction states within the editor. Common ones, are “Crop” while the crop tool is shown or “Text” when inline-editing text.

Returns#

string

“Transform”, “Crop”, “Text”, “Playback”, “Trim”, “Vector” or a custom value.

Implementation of#

IEditorAPI.getEditMode

Signature#

getEditMode(): string

setEditMode()#


Set the editor’s current edit mode.

Edit modes represent different tools or interaction states within the editor. Common ones, are “Crop” while the crop tool is shown or “Text” when inline-editing text.

engine.editor.setEditMode('Crop');
// With a base mode
engine.editor.setEditMode('CustomMode', 'Crop');

Parameters#

Parameter Type Description
mode string “Transform”, “Crop”, “Text”, “Playback”, “Trim”, “Vector” or a custom value.
baseMode? string Optional base mode from which the custom mode will inherit the settings.

Returns#

void

Implementation of#

IEditorAPI.setEditMode

Signature#

setEditMode(mode: string, baseMode?: string): void

getCursorType()#


Get the cursor type that should be displayed.

Returns#

| "Rotate" | "Text" | "Arrow" | "Move" | "MoveNotPermitted" | "Resize" | "Cell"

The cursor type.

Signature#

getCursorType(): "Rotate" | "Text" | "Arrow" | "Move" | "MoveNotPermitted" | "Resize" | "Cell"

getCursorRotation()#


Get the cursor rotation angle.

Returns#

number

The angle in radians.

Signature#

getCursorRotation(): number

getTextCursorPositionInScreenSpaceX()#


Get the text cursor’s x position in screen space.

Returns#

number

The text cursor’s x position in screen space.

Signature#

getTextCursorPositionInScreenSpaceX(): number

getTextCursorPositionInScreenSpaceY()#


Get the text cursor’s y position in screen space.

Returns#

number

The text cursor’s y position in screen space.

Signature#

getTextCursorPositionInScreenSpaceY(): number

History Management#

createHistory()#


Create a new undo/redo history stack.

Multiple histories can exist, but only one can be active at a time.

const newHistory = engine.editor.createHistory();

Returns#

number

The handle of the created history.

Implementation of#

IEditorAPI.createHistory

Signature#

createHistory(): number

destroyHistory()#


Destroy a history stack and free its resources.

engine.editor.destroyHistory(oldHistory);

Parameters#

Parameter Type Description
history number The history handle to destroy.

Returns#

void

Throws#

Error if the handle doesn’t refer to a valid history.

Implementation of#

IEditorAPI.destroyHistory

Signature#

destroyHistory(history: number): void

getActiveHistory()#


Get the currently active history handle.

Creates a new history if none exists.

const oldHistory = engine.editor.getActiveHistory();

Returns#

number

The handle of the active history.

Implementation of#

IEditorAPI.getActiveHistory

Signature#

getActiveHistory(): number

canUndo()#


Check if an undo step is available.

if (engine.editor.canUndo()) {
engine.editor.undo();
}

Returns#

boolean

True if an undo step is available.

Implementation of#

IEditorAPI.canUndo

Signature#

canUndo(): boolean

canRedo()#


Check if a redo step is available.

if (engine.editor.canRedo()) {
engine.editor.redo();
}

Returns#

boolean

True if a redo step is available.

Implementation of#

IEditorAPI.canRedo

Signature#

canRedo(): boolean

addUndoStep()#


Add a new history state to the undo stack.

Only adds a state if undoable changes were made since the last undo step.

engine.editor.addUndoStep();

Returns#

void

Implementation of#

IEditorAPI.addUndoStep

Signature#

addUndoStep(): void

removeUndoStep()#


Remove the last history state from the undo stack.

Removes the most recent undo step if available.

engine.editor.removeUndoStep();

Returns#

void

Implementation of#

IEditorAPI.removeUndoStep

Signature#

removeUndoStep(): void

Color Management#

supportsP3()#


Returns whether the engine supports displaying and working in the P3 color space on the current device.

Returns#

boolean

True when the P3 color space is supported.

Implementation of#

IEditorAPI.supportsP3

Signature#

supportsP3(): boolean

getSpotColorForCutoutType()#


Get the name of the spot color assigned to a cutout type.

Parameters#

Parameter Type Description
type CutoutType The cutout type.

Returns#

string

The color spot name.

Signature#

getSpotColorForCutoutType(type: CutoutType): string

setSpotColorForCutoutType()#


Set the spot color assign to a cutout type.

All cutout blocks of the given type will be immediately assigned that spot color.

Parameters#

Parameter Type Description
type CutoutType The cutout type.
color string The spot color name to assign.

Returns#

void

Signature#

setSpotColorForCutoutType(type: CutoutType, color: string): void

findAllSpotColors()#


Get all spot color names currently defined.

Returns#

string[]

The names of all defined spot colors.

Implementation of#

IEditorAPI.findAllSpotColors

Signature#

findAllSpotColors(): string[]

getSpotColorRGBA()#


Queries the RGB representation set for a spot color.

If the value of the queried spot color has not been set yet, returns the default RGB representation (of magenta). The alpha value is always 1.0.

Parameters#

Parameter Type Description
name string The name of a spot color.

Returns#

RGBA

A result holding a float array of the four color components.

Implementation of#

IEditorAPI.getSpotColorRGBA

Signature#

getSpotColorRGBA(name: string): RGBA

getSpotColorCMYK()#


Queries the CMYK representation set for a spot color.

If the value of the queried spot color has not been set yet, returns the default CMYK representation (of magenta).

Parameters#

Parameter Type Description
name string The name of a spot color.

Returns#

CMYK

A result holding a float array of the four color components.

Implementation of#

IEditorAPI.getSpotColorCMYK

Signature#

getSpotColorCMYK(name: string): CMYK

setSpotColorRGB()#


Sets the RGB representation of a spot color.

Use this function to both create a new spot color or update an existing spot color.

Parameters#

Parameter Type Description
name string The name of a spot color.
r number The red color component in the range of 0 to 1.
g number The green color component in the range of 0 to 1.
b number The blue color component in the range of 0 to 1.

Returns#

void

Implementation of#

IEditorAPI.setSpotColorRGB

Signature#

setSpotColorRGB(name: string, r: number, g: number, b: number): void

setSpotColorCMYK()#


Sets the CMYK representation of a spot color.

Use this function to both create a new spot color or update an existing spot color.

Parameters#

Parameter Type Description
name string The name of a spot color.
c number The cyan color component in the range of 0 to 1.
m number The magenta color component in the range of 0 to 1.
y number The yellow color component in the range of 0 to 1.
k number The key color component in the range of 0 to 1.

Returns#

void

Implementation of#

IEditorAPI.setSpotColorCMYK

Signature#

setSpotColorCMYK(name: string, c: number, m: number, y: number, k: number): void

removeSpotColor()#


Removes a spot color from the list of set spot colors.

Parameters#

Parameter Type Description
name string The name of a spot color.

Returns#

void

An empty result on success, an error otherwise.

Implementation of#

IEditorAPI.removeSpotColor

Signature#

removeSpotColor(name: string): void

setSoftProofEnabled()#


Turn soft proofing of the live canvas on or off.

With proofing on, the artwork inside the visible page trims shows the colors of the output profile of getSoftProofColorSpace. Exports, thumbnails, bleed and editor decorations stay unproofed. The state is not saved with the scene, and undo does not change it. Creating or loading a scene, or applying a template, turns proofing off and sets the color space to CMYK. A setActiveHistory call that switches to another scene does the same by the next update. A change notifies the editor state subscribers.

Parameters#

Parameter Type Description
enabled boolean Whether to proof the live canvas. Defaults to false.

Returns#

void

Implementation of#

IEditorAPI.setSoftProofEnabled

Signature#

setSoftProofEnabled(enabled: boolean): void

isSoftProofEnabled()#


Check whether soft proofing of the live canvas is on.

Returns#

boolean

True when the live canvas is proofed.

Implementation of#

IEditorAPI.isSoftProofEnabled

Signature#

isSoftProofEnabled(): boolean

setSoftProofColorSpace()#


Set the color space that soft proofing simulates.

The proof uses the Output profile of that space, then its Default profile, then the fallback profile. Creating or loading a scene, or applying a template, sets the color space to CMYK. A setActiveHistory call that switches to another scene does the same by the next update. A change notifies the editor state subscribers.

Parameters#

Parameter Type Description
colorSpace SoftProofColorSpace 'RGB' or 'CMYK'. Defaults to 'CMYK'.

Returns#

void

Throws#

COLOR.SOFT_PROOF_SPACE_UNSUPPORTED for another color space. The previous color space stays in use.

Implementation of#

IEditorAPI.setSoftProofColorSpace

Signature#

setSoftProofColorSpace(colorSpace: SoftProofColorSpace): void

getSoftProofColorSpace()#


Get the color space that soft proofing simulates.

Returns#

SoftProofColorSpace

'RGB' or 'CMYK'.

Implementation of#

IEditorAPI.getSoftProofColorSpace

Signature#

getSoftProofColorSpace(): SoftProofColorSpace

Resource Management#

getFileFormats()#


Lists native image, audio and video formats available in this runtime.

Reflects current features, license and measured codec families. Starts no downloads or codec probes. Use checkFileSupport to inspect a concrete file. Host-provided editable document importers and fonts are outside this catalog.

Returns#

FileSupport[]

Native format support at the format inspection level.

Implementation of#

IEditorAPI.getFileFormats

Signature#

getFileFormats(): FileSupport[]

getMimeType()#


Get the MIME type of a resource.

Downloads the resource if not already cached.

Parameters#

Parameter Type Description
uri string The URI of the resource.
options? AbortOptions An abortSignal that stops the download of the resource.

Returns#

Promise<string>

Promise resolving to the resource’s MIME type.

Throws#

Error if the resource cannot be downloaded or MIME type determined.

Implementation of#

IEditorAPI.getMimeType

Signature#

getMimeType(uri: string, options?: AbortOptions): Promise<string>

relocateResource()#


Changes the URL associated with a resource.

This function can be used change the URL of a resource that has been relocated (e.g., to a CDN). Relocating the URL of a document color profile also repoints the profile. A setDocumentColorProfile request for that URL that is still loading commits the new URL once it loads.

Parameters#

Parameter Type Description
currentUri string The current URL of the resource.
newUri string The new URL of the resource.

Returns#

void

Implementation of#

IEditorAPI.relocateResource

Signature#

relocateResource(currentUri: string, newUri: string): void

findAllMediaURIs()#


Get all media URIs referenced by blocks in the scene.

Returns URIs from image fills, video fills, and audio blocks, including their source sets. Only returns valid media URIs (http://, https://, file://), excluding transient resources like buffer URIs. Useful for determining which media files are referenced by a scene (e.g., for cleanup operations, CDN management, or file system tracking).

Returns#

string[]

The URLs of all media resources referenced in the scene, deduplicated.

Implementation of#

IEditorAPI.findAllMediaURIs

Signature#

findAllMediaURIs(): string[]

findAllTransientResources()#


List all transient (in-engine) resources — typically buffer:// URIs created by importers (psd, pdf, idml) before they’re uploaded to a permanent location. Each entry is { URL, size }, as on the WASM engine.

Returns#

TransientResource[]

The URLs and sizes of transient resources.

Implementation of#

IEditorAPI.findAllTransientResources

Signature#

findAllTransientResources(): TransientResource[]

getResourceData()#


Reads a resource’s bytes in chunks. onData is called per chunk with a Uint8Array; return false to stop early. Returns once fully streamed.

Parameters#

Parameter Type Description
uri string The URL of the resource.
chunkSize number Size in bytes of each chunk passed to onData.
onData (result) => boolean Called with each chunk; return false to stop.

Returns#

void

Implementation of#

IEditorAPI.getResourceData

Signature#

getResourceData(uri: string, chunkSize: number, onData: (result: Uint8Array) => boolean): void

Editor Settings#

getSettingBool()#


Get a boolean setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. doubleClickToCropEnabled.
Returns#

boolean

The boolean value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingBool

Call Signature#

getSettingBool(keypath): boolean;
Parameters#
Parameter Type
keypath `ubq://${string}`
Returns#

boolean

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.getSettingBool

Call Signature#

getSettingBool(keypath): boolean;

Get a boolean setting value.

Parameters#
Parameter Type Description
keypath SettingBoolPropertyName The settings keypath, e.g. doubleClickToCropEnabled.
Returns#

boolean

The boolean value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingBool

Signatures#

getSettingBool(keypath: string): boolean
getSettingBool(keypath: `ubq://${string}`): boolean
getSettingBool(keypath: SettingBoolPropertyName): boolean

setSettingBool()#


Set a boolean setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. doubleClickToCropEnabled.
value boolean The boolean value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingBool

Call Signature#

setSettingBool(keypath, value): void;
Parameters#
Parameter Type
keypath `ubq://${string}`
value boolean
Returns#

void

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.setSettingBool

Signatures#

setSettingBool(keypath: string, value: boolean): void
setSettingBool(keypath: `ubq://${string}`, value: boolean): void

getSettingInt()#


Get an integer setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath.
Returns#

number

The integer value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingInt

Call Signature#

getSettingInt(keypath): number;

Get an integer setting value.

Parameters#
Parameter Type Description
keypath SettingIntPropertyName The settings keypath.
Returns#

number

The integer value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingInt

Signatures#

getSettingInt(keypath: string): number
getSettingInt(keypath: SettingIntPropertyName): number

setSettingInt()#


Set an integer setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath.
value number The integer value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingInt

Call Signature#

setSettingInt(keypath, value): void;

Set an integer setting value.

Parameters#
Parameter Type Description
keypath SettingIntPropertyName The settings keypath.
value number The integer value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingInt

Signatures#

setSettingInt(keypath: string, value: number): void
setSettingInt(keypath: SettingIntPropertyName, value: number): void

getSettingFloat()#


Get a float setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. positionSnappingThreshold.
Returns#

number

The float value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingFloat

Call Signature#

getSettingFloat(keypath): number;
Parameters#
Parameter Type
keypath `ubq://${string}`
Returns#

number

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.getSettingFloat

Call Signature#

getSettingFloat(keypath): number;

Get a float setting value.

Parameters#
Parameter Type Description
keypath SettingFloatPropertyName The settings keypath, e.g. positionSnappingThreshold.
Returns#

number

The float value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingFloat

Signatures#

getSettingFloat(keypath: string): number
getSettingFloat(keypath: `ubq://${string}`): number
getSettingFloat(keypath: SettingFloatPropertyName): number

setSettingFloat()#


Set a float setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. positionSnappingThreshold.
value number The float value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingFloat

Call Signature#

setSettingFloat(keypath, value): void;
Parameters#
Parameter Type
keypath `ubq://${string}`
value number
Returns#

void

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.setSettingFloat

Call Signature#

setSettingFloat(keypath, value): void;

Set a float setting value.

Parameters#
Parameter Type Description
keypath SettingFloatPropertyName The settings keypath, e.g. positionSnappingThreshold.
value number The float value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingFloat

Signatures#

setSettingFloat(keypath: string, value: number): void
setSettingFloat(keypath: `ubq://${string}`, value: number): void
setSettingFloat(keypath: SettingFloatPropertyName, value: number): void

getSettingString()#


Get a string setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. license.
Returns#

string

The string value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingString

Call Signature#

getSettingString(keypath): string;
Parameters#
Parameter Type
keypath `ubq://${string}`
Returns#

string

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.getSettingString

Call Signature#

getSettingString(keypath): string;

Get a string setting value.

Parameters#
Parameter Type Description
keypath SettingStringPropertyName The settings keypath, e.g. license.
Returns#

string

The string value of the setting.

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingString

Signatures#

getSettingString(keypath: string): string
getSettingString(keypath: `ubq://${string}`): string
getSettingString(keypath: SettingStringPropertyName): string

setSettingString()#


Set a string setting value.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. license.
value string The string value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingString

Call Signature#

setSettingString(keypath, value): void;
Parameters#
Parameter Type
keypath `ubq://${string}`
value string
Returns#

void

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.setSettingString

Call Signature#

setSettingString(keypath, value): void;

Set a string setting value.

Parameters#
Parameter Type Description
keypath SettingStringPropertyName The settings keypath, e.g. license.
value string The string value to set.
Returns#

void

Throws#

Error if the keypath is invalid.

Implementation of#
IEditorAPI.setSettingString

Signatures#

setSettingString(keypath: string, value: string): void
setSettingString(keypath: `ubq://${string}`, value: string): void
setSettingString(keypath: SettingStringPropertyName, value: string): void

getSettingColor()#


Get a color setting.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. highlightColor.
Returns#
Color
Throws#

An error, if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingColor

Call Signature#

getSettingColor(keypath): Color;
Parameters#
Parameter Type
keypath `ubq://${string}`
Returns#
Color
Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.getSettingColor

Call Signature#

getSettingColor(keypath): Color;

Get a color setting.

Parameters#
Parameter Type Description
keypath SettingColorPropertyName The settings keypath, e.g. highlightColor.
Returns#
Color
Throws#

An error, if the keypath is invalid.

Implementation of#
IEditorAPI.getSettingColor

Signatures#

getSettingColor(keypath: string): Color
getSettingColor(keypath: `ubq://${string}`): Color
getSettingColor(keypath: SettingColorPropertyName): Color

setSettingColor()#


Set a color setting.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. highlightColor.
value Color The The value to set.
Returns#

void

Implementation of#
IEditorAPI.setSettingColor

Call Signature#

setSettingColor(keypath, value): void;
Parameters#
Parameter Type
keypath `ubq://${string}`
value Color
Returns#

void

Deprecated#

Support for ubq:// prefixed keypaths will be removed in a future release.

Implementation of#
IEditorAPI.setSettingColor

Call Signature#

setSettingColor(keypath, value): void;

Set a color setting.

Parameters#
Parameter Type Description
keypath SettingColorPropertyName The settings keypath, e.g. highlightColor.
value Color The The value to set.
Returns#

void

Implementation of#
IEditorAPI.setSettingColor

Signatures#

setSettingColor(keypath: string, value: Color): void
setSettingColor(keypath: `ubq://${string}`, value: Color): void
setSettingColor(keypath: SettingColorPropertyName, value: Color): void

getSettingEnum()#


Get an enum setting.

Type Parameters#
Type Parameter
T extends keyof SettingEnumType
Parameters#
Parameter Type Description
keypath T The settings keypath, e.g. doubleClickSelectionMode.
Returns#

SettingEnumType[T]

The value as string.

Implementation of#
IEditorAPI.getSettingEnum

Call Signature#

getSettingEnum(keypath): string;

Get an enum setting.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. doubleClickSelectionMode.
Returns#

string

The value as string.

Implementation of#
IEditorAPI.getSettingEnum

Signatures#

getSettingEnum(keypath: T): SettingEnumType[T]
getSettingEnum(keypath: string): string

setSettingEnum()#


Set an enum setting.

Type Parameters#
Type Parameter
T extends keyof SettingEnumType
Parameters#
Parameter Type Description
keypath T The settings keypath, e.g. doubleClickSelectionMode.
value SettingEnumType[T] The enum value as string.
Returns#

void

Implementation of#
IEditorAPI.setSettingEnum

Call Signature#

setSettingEnum(keypath, value): void;

Set an enum setting.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. doubleClickSelectionMode.
value string The enum value as string.
Returns#

void

Implementation of#
IEditorAPI.setSettingEnum

Signatures#

setSettingEnum(keypath: T, value: SettingEnumType[T]): void
setSettingEnum(keypath: string, value: string): void

findAllSettings()#


Returns a list of all the settings available.

Returns#

string[]

A list of settings keypaths.

Implementation of#

IEditorAPI.findAllSettings

Signature#

findAllSettings(): string[]

getSettingType()#


Returns the type of a setting.

Parameters#

Parameter Type Description
keypath string The settings keypath, e.g. doubleClickSelectionMode.

Returns#

SettingType

The setting type.

Implementation of#

IEditorAPI.getSettingType

Signature#

getSettingType(keypath: string): SettingType

getSettingEnumOptions()#


Get the possible enum options for a given enum setting.

Type Parameters#
Type Parameter
T extends keyof SettingEnumType
Parameters#
Parameter Type Description
keypath T The settings keypath, e.g. doubleClickSelectionMode.
Returns#

SettingEnumType[T][]

The possible enum options as strings.

Implementation of#
IEditorAPI.getSettingEnumOptions

Call Signature#

getSettingEnumOptions(keypath): string[];

Get the possible enum options for a given enum setting.

Parameters#
Parameter Type Description
keypath string The settings keypath, e.g. doubleClickSelectionMode.
Returns#

string[]

The possible enum options as strings.

Implementation of#
IEditorAPI.getSettingEnumOptions

Signatures#

getSettingEnumOptions(keypath: T): SettingEnumType[T][]
getSettingEnumOptions(keypath: string): string[]

getAbsoluteURI()#


Resolves the given path asynchronously.

If a custom resolver has been set with setURIResolverAsync (or setURIResolver), it invokes it with the given path. Else, it resolves it as relative to the basePath setting. This performs NO validation of whether a file exists at the specified location.

Breaking change: This method now returns a Promise<string> instead of a plain string. Callers must await the result.

Parameters#

Parameter Type Description
relativeUri string A relative path string

Returns#

Promise<string>

Promise resolving to the resolved absolute uri or rejecting if an invalid path was given.

Implementation of#

IEditorAPI.getAbsoluteURI

Signature#

getAbsoluteURI(relativeUri: string): Promise<string>

defaultURIResolver()#


This is the default implementation for the URI resolver.

It resolves the given path relative to the basePath setting.

engine.editor.defaultURIResolver(uri);

Parameters#

Parameter Type Description
relativePath string The relative path that should be resolved.

Returns#

string

The resolved absolute URI.

Implementation of#

IEditorAPI.defaultURIResolver

Signature#

defaultURIResolver(relativePath: string): string

System Information#

getUsedMemory()#


Get the engine’s current memory usage.

Returns#

number

The current memory usage in bytes.

Signature#

getUsedMemory(): number

getAvailableMemory()#


Get the currently available memory.

Returns#

number

The available memory in bytes.

Signature#

getAvailableMemory(): number

getMaxExportSize()#


Get the maximum export size limit for the current device.

Exports are only possible when both width and height are below this limit. Note that exports may still fail due to other constraints like memory. A PDF export checks the limit against each image, gradient and effect that it draws as pixels at the scene DPI, not against the page. The limit is at most 23170 px, the side of the largest square export whose pixels fit in 2 GiB. A wider export with fewer pixels, such as 262144 x 2047, still works on a device without a GPU.

Returns#

number

The upper export size limit in pixels.

Signature#

getMaxExportSize(): number

Experimental#

unstable_isInteractionHappening()#

Check if a user interaction is currently happening.

Detects active interactions like resize edits with drag handles, touch gestures, and content dragged over the canvas.

Returns#

boolean

True if an interaction is happening. This API is experimental and may change or be removed in future versions.

Other#

unlockWithLicense()#


Activate (or re-activate) the engine with a license key. Pass an empty string to drop into Evaluation mode. Mirrors @cesdk/engine’s engine.editor.unlockWithLicense().

Most callers should pass license via CreativeEngine.init({ license }) — init calls this internally. Use this method only to switch licenses at runtime (e.g. trial → paid upgrade in place).

Parameters#

Parameter Type
license string

Returns#

void

Implementation of#

IEditorAPI.unlockWithLicense

Signature#

unlockWithLicense(license: string): void

getCapabilityState()#


Reports the current backend capability evidence. Native AAC and MP3 decoding can stay ‘unchecked’ until an existing media operation initializes a licensed backend and a later checkCapabilities() refreshes the evidence. Mirrors @cesdk/engine’s engine.editor.getCapabilityState().

Parameters#

Parameter Type Description
capability EngineCapability The capability to query.

Returns#

EngineCapabilityState

'unchecked', 'pending', 'supported' or 'unsupported'.

Throws#

For unknown capability names.

Signature#

getCapabilityState(capability: EngineCapability): EngineCapabilityState

checkCapabilities()#


Refreshes native backend capability evidence and resolves immediately afterward. This starts no media or license initialization. AAC and MP3 decoding can remain ‘unchecked’ until an existing media operation initializes a licensed backend; call again afterward to refresh those answers. Mirrors @cesdk/engine’s engine.editor.checkCapabilities(). Android checks its AAC and MP3 decoders once, when the engine starts. A later call reports that result again and does not check them a second time.

Returns#

Promise<void>

Resolves after the native evidence has been refreshed. Codecs can remain 'unchecked'.

Signature#

checkCapabilities(): Promise<void>

getSettingDouble()#


Get a double setting, such as clip/defaultDurationValue in seconds.

Parameters#

Parameter Type
keypath string

Returns#

number

Implementation of#

IEditorAPI.getSettingDouble

Signature#

getSettingDouble(keypath: string): number

setSettingDouble()#


Set a finite double setting without reducing its precision.

Parameters#

Parameter Type
keypath string
value number

Returns#

void

Implementation of#

IEditorAPI.setSettingDouble

Signature#

setSettingDouble(keypath: string, value: number): void

getSetting()#


Generic setting getter that dispatches to the typed getter based on getSettingType.

Type Parameters#

Type Parameter
K extends keyof Settings

Parameters#

Parameter Type
keypath OptionalPrefix<K>

Returns#

SettingValueType<K>

Signature#

getSetting(keypath: OptionalPrefix<K>): SettingValueType<K>

setSetting()#


Generic setting setter — dispatches to the typed setter via getSettingType.

Type Parameters#

Type Parameter
K extends keyof Settings

Parameters#

Parameter Type
keypath OptionalPrefix<K>
value SettingValueType<K>

Returns#

void

Signature#

setSetting(keypath: OptionalPrefix<K>, value: SettingValueType<K>): void

getFontMetrics()#


Get the font metrics for a font URI. An abortSignal stops the download of the font. Missing or zero underline metrics use the defaults documented in FontMetrics.

Parameters#

Parameter Type
fontFileUri string
options? AbortOptions

Returns#

Promise<FontMetrics>

Signature#

getFontMetrics(fontFileUri: string, options?: AbortOptions): Promise<FontMetrics>

getFontInfo()#


Get the names, weight, style, variation axes and OpenType features of a font file. The result describes the default instance of a variable font, and the call ignores a fragment that names axis values, such as #wght=700. An abortSignal stops the download of the font. Rejects with EDITOR.FONT_LOAD_FAILED when the file does not load, and with EDITOR.FONT_INFO_EXTRACT_FAILED when the file is not a font.

Parameters#

Parameter Type
fontFileUri string
options? AbortOptions

Returns#

Promise<FontInfo>

Signature#

getFontInfo(fontFileUri: string, options?: AbortOptions): Promise<FontInfo>

setMovementConstraint()#


Set one or more rules limiting how far blocks may be moved outside their parent page during user interactions.

A rule on a page slice is the default for the blocks whose center the page slice holds, and its edges to the other page slices act as page edges for them. A block wider than the page slice is held in the page on that axis. During a drag or a touch pan, the page slice where it started applies, until it takes the block fully onto another page slice.

Parameters#

Parameter Type
rules

Returns#

void

Signature#

setMovementConstraint(rules: MovementConstraintRule | MovementConstraintRule[]): void

getMovementConstraint()#


Get the effective movement constraint for a block (most specific rule wins: block > page slice > parent page > blockType > scene-wide). Returns null when unconstrained.

Parameters#

Parameter Type
id number

Returns#

object

Name Type
overshoot number

Remarks#

May perform an internal update to resolve pending layout. This update can run even when implicit updates are disabled if the required layout is missing or stale.

Signature#

getMovementConstraint(id: number): object

removeMovementConstraint()#


Remove movement constraints. No argument removes the scene-wide default. { block } / { blockType } (or array) removes the matching scope(s).

Parameters#

Parameter Type
scopes?

Returns#

void

Signature#

removeMovementConstraint(scopes?: MovementConstraintScope | MovementConstraintScope[]): void

releaseMemory()#


Free the memory that the engine can build again without a download.

The engine frees the decoded images that the canvas did not draw last, and the video thumbnails. It also frees the files that no block uses, and the unused GPU textures. The files that blocks use stay, so no file downloads again. The next frames decode the freed images again when they need them.

Returns#

void

Signature#

releaseMemory(): void

convertColorToColorSpace()#


Converts a color to the given color space. In Managed scenes, converting sRGB colors or RGB-only spot approximations to CMYK uses the document or fallback CMYK profile. While the required profile loads from a URI, this conversion throws COLOR.PROFILE_NOT_LOADED. Await loadColorProfiles first. RGB-to-CMYK conversion uses a simple formula if the profile only converts CMYK to RGB or cannot load.

Parameters#
Parameter Type
color Color
colorSpace "sRGB"
Returns#
RGBAColor
Implementation of#
IEditorAPI.convertColorToColorSpace

Call Signature#

convertColorToColorSpace(color, colorSpace): CMYKColor;
Parameters#
Parameter Type
color Color
colorSpace "CMYK"
Returns#
CMYKColor
Implementation of#
IEditorAPI.convertColorToColorSpace

Call Signature#

convertColorToColorSpace(color, colorSpace): never;
Parameters#
Parameter Type
color Color
colorSpace ColorSpace
Returns#

never

Implementation of#
IEditorAPI.convertColorToColorSpace

Signatures#

convertColorToColorSpace(color: Color, colorSpace: "sRGB"): RGBAColor
convertColorToColorSpace(color: Color, colorSpace: "CMYK"): CMYKColor
convertColorToColorSpace(color: Color, colorSpace: ColorSpace): never

loadColorProfiles()#


Loads the color profiles used for managed color conversion and preview.

Waits for every profile the document names, and for the effective Default/CMYK profile, including the configured or bundled fallback. Only the Default/CMYK result decides the outcome: a profile of another slot that fails to load is logged and does not fail the call. Configuration changes during loading are resolved before completion. Call again after later changes.

Aborting ends this wait; the profile keeps loading for color conversion.

Parameters#

Parameter Type Description
options? AbortOptions Abort options.

Returns#

Promise<void>

Resolves when the effective profile is ready, immediately if every named profile is already loaded.

Throws#

An error with COLOR.PROFILE_MISSING when no usable profile can be read.

Implementation of#

IEditorAPI.loadColorProfiles

Signature#

loadColorProfiles(options?: AbortOptions): Promise<void>

loadCMYKProfile()#


Loads the CMYK profile used for managed color conversion and preview.

The profile is a resource, and a resource takes several update cycles to arrive, so a conversion that needs it can fail right after the engine starts. Await this once and every later convertColorToColorSpace answers without handling COLOR.PROFILE_NOT_LOADED.

Parameters#

Parameter Type Description
options? AbortOptions An abortSignal that ends the wait. The download of the profile goes on, because the document keeps its profile loaded for its color conversions.

Returns#

Promise<void>

A promise that resolves once the profile is loaded.

Deprecated#

Use loadColorProfiles instead.

Implementation of#

IEditorAPI.loadCMYKProfile

checkFileSupport()#


Inspect a resource and report its image, audio and video support. An abortSignal stops the download and the inspection. Disposing the engine rejects a call that still waits.

Parameters#

Parameter Type
uri string
options? AbortOptions

Returns#

Promise<FileSupport>

Implementation of#

IEditorAPI.checkFileSupport

Signature#

checkFileSupport(uri: string, options?: AbortOptions): Promise<FileSupport>

setTypefaceResolver()#


Sets a font provider; null or undefined restores registered-source lookup. The provider runs asynchronously on the JavaScript thread and may dispose the engine. Invalid providers throw before replacing the current provider. When the provider returns undefined, throws or rejects, the engine uses the default font, and the request reports substituted. The engine ignores stale completions after provider replacement, edits or disposal.

Without a resolver, the engine searches registered local asset sources. Identical requests share pending lookups. Each source is limited to 100 pages. Set assetSourceId to query an external source explicitly. Call setTypefaceResolver again to retry unresolved requests after registering a source.

Parameters#

Parameter Type
resolver? TypefaceResolver

Returns#

void

Implementation of#

IEditorAPI.setTypefaceResolver

Signature#

setTypefaceResolver(resolver?: TypefaceResolver): void

setURIResolver()#


Register a synchronous URI resolver. Matches @cesdk/engine’s (uri, defaultResolver) => string signature (bindings/wasm/js_web/src/EditorAPI.ts). The defaultResolver argument is the engine’s built-in resolver — call it to delegate the lookup chain.

To remove a previously set resolver, pass null or undefined. setURIResolver and setURIResolverAsync share one resolver slot, so a call to either one replaces the resolver set by the other.

Parameters#

Parameter Type
resolver? SyncURIResolver

Returns#

void

Implementation of#

IEditorAPI.setURIResolver

Signature#

setURIResolver(resolver?: SyncURIResolver): void

setURIResolverAsync()#


Register an asynchronous URI resolver. Matches @cesdk/engine’s (uri, defaultResolver) => Promise<string> | string signature (bindings/wasm/js_web/src/EditorAPI.ts). Bridges to the native callback-style binding by adapting the returned Promise.

To remove a previously set resolver, pass null or undefined. setURIResolver and setURIResolverAsync share one resolver slot, so a call to either one replaces the resolver set by the other.

Parameters#

Parameter Type
resolver? AsyncURIResolver

Returns#

void

Implementation of#

IEditorAPI.setURIResolverAsync

Signature#

setURIResolverAsync(resolver?: AsyncURIResolver): void

isHighlightingEnabled()#


Checks wether the block has selection and hover highlighting enabled or disabled.

const highlightingIsEnabled = engine.editor.isHighlightingEnabled(block);

Parameters#

Parameter Type Description
id number The block to query.

Returns#

boolean

True if highlighting is enabled, false otherwise.

Signature#

isHighlightingEnabled(id: number): boolean

setHighlightingEnabled()#


Enable or disable selection and hover highlighting for a block.

engine.editor.setHighlightingEnabled(block, true);

Parameters#

Parameter Type Description
id number The block to update.
enabled boolean Whether or not the block should show highlighting when selected or hovered.

Returns#

void

Signature#

setHighlightingEnabled(id: number, enabled: boolean): void

isSelectionEnabled()#


Checks whether the block can currently be selected.

const selectionIsEnabled = engine.editor.isSelectionEnabled(block);

Parameters#

Parameter Type Description
id number The block to query.

Returns#

boolean

True if selection is enabled, false otherwise.

Signature#

isSelectionEnabled(id: number): boolean

setSelectionEnabled()#


Enable or disable selection for a block.

engine.editor.setSelectionEnabled(block, true);

Parameters#

Parameter Type Description
id number The block to update.
enabled boolean Whether the block should be selectable.

Returns#

void

Signature#

setSelectionEnabled(id: number, enabled: boolean): void

startTracking()#


Start the engine’s analytics tracking pipeline. Mirrors @cesdk/engine’s editor.startTracking(license, userId); invoked automatically from CreativeEngine.init when license and/or userId are passed in the Configuration. Safe to call multiple times.

The C++ binding accepts a third deviceId argument that the engine itself uses for tracking-pipeline disambiguation; WASM always passes '' (see bindings/wasm/js_web/src/EditorAPI.ts) — we mirror that here so the no-args / “engine picks a default device id” path is honored.

Parameters#

Parameter Type
license string
userId string
deviceId? string

Returns#

void

Signature#

startTracking(license: string, userId: string, deviceId?: string): void

setActiveHistory()#


Set a history as the active undo/redo stack. All other histories lose their active state. Undo/redo operations only apply to the active history. A new history starts from the current scene, including edits without an undo step and the selection. Returning to a history restores its last undo step. Setting a history that is not new as active, also the active one, discards edits without an undo step. Edits with an undo step stay in the history they were made in.

Parameters#

Parameter Type
history number

Returns#

void

Implementation of#

IEditorAPI.setActiveHistory

Signature#

setActiveHistory(history: number): void

undo()#


Undo one step in the active history if an undo step is available. Scene edits made since the last undo step are discarded. Call addUndoStep first, so that redo can restore them. Use canUndo beforehand to determine whether a step is available.

Returns#

void

Implementation of#

IEditorAPI.undo

Signature#

undo(): void

redo()#


Redo one step in the active history if a redo step is available. Scene edits made since the last undo step are discarded. Call addUndoStep first to keep them, which clears the redo steps. Use canRedo beforehand to determine whether a step is available.

Returns#

void

Implementation of#

IEditorAPI.redo

Signature#

redo(): void

onStateChanged#


Subscribe to editor-state changes.

Parameters#

Parameter Type Description
callback () => void Called whenever the editor state changes.

Returns#

A function that unsubscribes when called.

() => void


onSettingsChanged#


Subscribe to editor settings changes. Matches WASM’s engine.editor.onSettingsChanged(callback). The native C++ side implements this via subscribeToSettings; this wrapper exposes it on the editor API so portable consumers (settings-reactive UI) work on both bindings.

Parameters#

Parameter Type
callback () => void

Returns#

A function that unsubscribes when called.

() => void

Implementation of#

IEditorAPI.onSettingsChanged

onHistoryUpdatedWithKind#


Subscribe to history updates. The callback receives a HistoryUpdate describing what kind of update happened (matches the node wasm binding’s EditorAPI surface) so consumers can distinguish a snapshot mutation from an Activated event triggered by setActiveHistory — important for save-button logic that should NOT fire on activation alone.

Parameters#

Parameter Type Description
callback (kind) => void Called with the kind of update.

Returns#

A function that unsubscribes when called.

() => void

Implementation of#

IEditorAPI.onHistoryUpdatedWithKind

onRoleChanged#


Subscribe to role changes.

Parameters#

Parameter Type Description
callback (role) => void Called with the new role when it changes.

Returns#

A function that unsubscribes when called.

() => void


createBuffer()#


Create a new buffer and return its URI.

Returns#

string

A URI to identify the created buffer (buffer://N format).

Implementation of#

IEditorAPI.createBuffer

Signature#

createBuffer(): string

destroyBuffer()#


Destroy a buffer and free its resources.

Parameters#

Parameter Type Description
uri string The URI of the buffer to destroy.

Returns#

void

Implementation of#

IEditorAPI.destroyBuffer

Signature#

destroyBuffer(uri: string): void

setBufferData()#


Set the data of a buffer at a given offset.

Parameters#

Parameter Type Description
uri string The URI of the buffer to update.
offset number The offset in bytes at which to start writing.
data Uint8Array The data to write.

Returns#

void

Implementation of#

IEditorAPI.setBufferData

Signature#

setBufferData(uri: string, offset: number, data: Uint8Array): void

getBufferData()#


Get the data of a buffer at a given offset.

Parameters#

Parameter Type Description
uri string The URI of the buffer to query.
offset number The offset in bytes at which to start reading.
length number The number of bytes to read.

Returns#

Uint8Array

The data at the given offset.

Implementation of#

IEditorAPI.getBufferData

Signature#

getBufferData(uri: string, offset: number, length: number): Uint8Array

getBufferLength()#


Get the length of a buffer.

Parameters#

Parameter Type Description
uri string The URI of the buffer to query.

Returns#

number

The length of the buffer in bytes.

Implementation of#

IEditorAPI.getBufferLength

Signature#

getBufferLength(uri: string): number

setBufferLength()#


Resize a buffer. Truncates if length is smaller than the current size; zero-extends if larger. Matches the WASM editor.setBufferLength shape used by psd/pdf/idml importers to pre-allocate a buffer before writing data with setBufferData.

Parameters#

Parameter Type
uri string
length number

Returns#

void

Implementation of#

IEditorAPI.setBufferLength

Signature#

setBufferLength(uri: string, length: number): void

Vector Edit#

addVectorNode()#


Add a new vertex by splitting the segment after the currently selected vector node.

Returns#

void

Signature#

addVectorNode(): void

deleteVectorNode()#


Delete the currently selected vector node from the path.

Returns#

void

Signature#

deleteVectorNode(): void

deleteSelectedVectorControlPoints()#


Delete (reset) the currently selected vector control point handles. Removes the bezier handle from the node, converting that side to a straight line. If the node has two handles, only the selected one is removed.

Returns#

void

Signature#

deleteSelectedVectorControlPoints(): void

getSelectedVectorNodeMirrorMode()#


Get the bezier handle mirror mode of the currently selected vector node.

Returns#

number

The mirror mode as a number (0 = None, 1 = AngleAndLength, 2 = AngleOnly).

Throws#

Error if no node is selected or no vector path is being edited.

Signature#

getSelectedVectorNodeMirrorMode(): number

setSelectedVectorNodeMirrorMode()#


Set the bezier handle mirror mode for the currently selected vector node.

Mirror modes control how the opposite handle behaves when one handle is dragged:

  • 0 (None): handles move independently
  • 1 (AngleAndLength): the opposite handle mirrors both angle and length
  • 2 (AngleOnly): the opposite handle mirrors the angle but keeps its own length

Parameters#

Parameter Type Description
mode number The mirror mode (0, 1, or 2).

Returns#

void

Signature#

setSelectedVectorNodeMirrorMode(mode: number): void

getVectorEditAddMode()#


Check whether vector edit add mode is currently active.

Returns#

boolean

true if add mode is active.

Signature#

getVectorEditAddMode(): boolean

setVectorEditAddMode()#


Enable or disable add mode for vector editing.

When add mode is active, clicking on a path segment inserts a new anchor point at the click position. Mutually exclusive with bend and delete modes.

Parameters#

Parameter Type Description
active boolean true to enable add mode, false to return to normal move mode.

Returns#

void

Signature#

setVectorEditAddMode(active: boolean): void

getVectorEditBendMode()#


Check whether vector edit bend mode is currently active.

Returns#

boolean

true if bend mode is active.

Signature#

getVectorEditBendMode(): boolean

setVectorEditBendMode()#


Enable or disable bend mode for vector editing.

When bend mode is active, clicking an anchor node automatically toggles it between smooth (bezier handles) and corner (no handles).

Parameters#

Parameter Type Description
active boolean true to enable bend mode, false to return to normal move mode.

Returns#

void

Signature#

setVectorEditBendMode(active: boolean): void

getVectorEditDeleteMode()#


Check whether vector edit delete mode is currently active.

Returns#

boolean

true if delete mode is active.

Signature#

getVectorEditDeleteMode(): boolean

setVectorEditDeleteMode()#


Enable or disable delete mode for vector editing.

When delete mode is active, clicking an anchor node instantly deletes it from the path. Mutually exclusive with bend and add modes.

Parameters#

Parameter Type Description
active boolean true to enable delete mode, false to return to normal move mode.

Returns#

void

Signature#

setVectorEditDeleteMode(active: boolean): void

hasSelectedVectorNode()#


Check whether a vector anchor node is currently selected in vector edit mode.

Returns#

boolean

True if a vector anchor node is selected.

Signature#

hasSelectedVectorNode(): boolean

hasSelectedVectorControlPoint()#


Check whether a vector control point handle is currently selected.

Returns#

boolean

Signature#

hasSelectedVectorControlPoint(): boolean

toggleSelectedVectorNodeSmooth()#


Toggle the currently selected vector node between smooth (bezier handles) and corner (no handles).

Returns#

void

Signature#

toggleSelectedVectorNodeSmooth(): void

Viewport#

setSafeAreaInsets()#


Set global safe area insets for UI overlays.

Safe area insets define UI-safe regions by specifying padding from screen edges. These insets are automatically applied to all camera operations (zoom, pan, clamping) to ensure important content remains visible when UI elements overlap the viewport edges. Set to zero to disable (default state).

Parameters#

Parameter Type Description
insets { left?: number; top?: number; right?: number; bottom?: number; } The inset values in CSS pixels (device-independent)
insets.left? number -
insets.top? number -
insets.right? number -
insets.bottom? number -

Returns#

void

Implementation of#

IEditorAPI.setSafeAreaInsets

Signature#

setSafeAreaInsets(insets: object): void

getSafeAreaInsets()#


Get the current global safe area insets configuration.

Returns#

object

The current inset values in CSS pixels (device-independent)

Name Type
left number
top number
right number
bottom number

Implementation of#

IEditorAPI.getSafeAreaInsets

Signature#

getSafeAreaInsets(): object