Skip to main content
Platform
Language

Change Settings

In this example, we will show you how to use the CreativeEditor SDK's CreativeEngine to control with the editor API. A list of all available settings can be found on the Settings page.

Setup#

This example uses the headless CreativeEngine. See the Setup article for a detailed guide. To get started right away, you can also access the block API within a running CE.SDK instance via cesdk.engine.block. Check out the APIs Overview to see that illustrated in more detail.

Exploration#

findAllSettings(): string[]

Returns a list of all the settings available.

  • Returns A list of settings keypaths.
getSettingType(keypath: string): SettingType

Returns the type of a setting.

  • keypath: The settings keypath, e.g. doubleClickSelectionMode.
  • Returns The setting type.

Functions#

onSettingsChanged: (callback: () => void) => (() => void)

Subscribe to changes to the editor settings.

  • callback: This function is called at the end of the engine update, if the editor settings have changed.
  • Returns A method to unsubscribe.
onRoleChanged: (callback: (role: RoleString) => void) => (() => void)

Subscribe to changes to the editor role. This lets you react to changes in the role of the user and update engine and editor settings in response.

  • callback: This function will be called immediately after a role has been set and the default settings for that role have been applied. This function will also be called in case the role is set to the same value as before.
  • Returns A function for unsubscribing
setSettingBool(keypath: SettingsBool, value: boolean): void

Set a boolean setting.

  • keypath: The settings keypath, e.g. doubleClickToCropEnabled
  • value: The value to set.
  • Throws An error, if the keypath is invalid.
setSettingBool(keypath: `ubq://${SettingsBool}`, value: boolean): void

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

getSettingBool(keypath: SettingsBool): boolean

Get a boolean setting.

  • keypath: The settings keypath, e.g. doubleClickToCropEnabled
  • Throws An error, if the keypath is invalid.
getSettingBool(keypath: `ubq://${SettingsBool}`): boolean

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

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

Set an integer setting.

  • keypath: The settings keypath.
  • value: The value to set.
  • Throws An error, if the keypath is invalid.
getSettingInt(keypath: string): number

Get an integer setting.

  • keypath: The settings keypath.
  • Throws An error, if the keypath is invalid.
setSettingFloat(keypath: SettingsFloat, value: number): void

Set a float setting.

  • keypath: The settings keypath, e.g. positionSnappingThreshold
  • value: The value to set.
  • Throws An error, if the keypath is invalid.
setSettingFloat(keypath: `ubq://${SettingsFloat}`, value: number): void

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

getSettingFloat(keypath: SettingsFloat): number

Get a float setting.

  • keypath: The settings keypath, e.g. positionSnappingThreshold
  • Throws An error, if the keypath is invalid.
getSettingFloat(keypath: `ubq://${SettingsFloat}`): number

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

setSettingString(keypath: SettingsString, value: string): void

Set a string setting.

  • keypath: The settings keypath, e.g. license
  • value: The value to set.
  • Throws An error, if the keypath is invalid.
setSettingString(keypath: `ubq://${SettingsString}`, value: string): void

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

getSettingString(keypath: SettingsString): string

Get a string setting.

  • keypath: The settings keypath, e.g. license
  • Throws An error, if the keypath is invalid.
getSettingString(keypath: `ubq://${SettingsString}`): string

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

setSettingColor(keypath: SettingsColor, value: Color): void

Set a color setting.

  • keypath: The settings keypath, e.g. highlightColor.
  • value: The The value to set.
setSettingColor(keypath: `ubq://${SettingsColor}`, value: Color): void

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

getSettingColor(keypath: SettingsColor): Color

Get a color setting.

  • keypath: The settings keypath, e.g. highlightColor.
  • Throws An error, if the keypath is invalid.
getSettingColor(keypath: `ubq://${SettingsColor}`): Color

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

setSettingEnum<T extends keyof SettingsEnum>(keypath: T, value: SettingsEnum[T]): void

Set an enum setting.

  • keypath: The settings keypath, e.g. doubleClickSelectionMode.
  • value: The enum value as string.
setSettingEnum<T extends keyof SettingsEnum>(keypath: `ubq://${T}`, value: SettingsEnum[T]): void

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

getSettingEnum<T extends keyof SettingsEnum>(keypath: T): SettingsEnum[T]

Get an enum setting.

  • keypath: The settings keypath, e.g. doubleClickSelectionMode.
  • Returns The value as string.
getSettingEnum<T extends keyof SettingsEnum>(keypath: `ubq://${T}`): SettingsEnum[T]

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

getSettingEnumOptions<T extends keyof SettingsEnum>(keypath: T): string[]

Get the possible enum options for a given enum setting.

  • keypath: The settings keypath, e.g. doubleClickSelectionMode.
  • Returns The possible enum options as strings.
getSettingEnumOptions<T extends keyof SettingsEnum>(keypath: `ubq://${T}`): string[]

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

getRole(): RoleString

Get the current role of the user

setRole(role: RoleString): void

Set the role of the user and apply role-dependent defaults for scopes and settings