The VariableController is responsible for all communication regarding the variables. Methods inside this controller can be called by window.SDK.variable.{method-name}

Properties

date: DateVariable
number: NumberVariable

Methods

  • This method changes positions of variables

    Parameters

    • order: number

      new order of variable

    • ids: string[]

      Array of the variable IDs

    • parentId: string

      parent id of the variables

    Returns Promise<EditorResponse<null>>

  • This method sets the image variable connector. Setting a connector will automatically remove the assetId linked to the connector if present. If a connector was the source of the variable, it will be unregistered.

    Parameters

    • id: string

      The id of the image variable to update

    • registration: ConnectorRegistration

      registration object containing all details about the connector

    Returns Promise<EditorResponse<string>>

    The new id of the connector

  • This method sets the value of an image variable along with its context in a single atomic operation

    Parameters

    • id: string

      the id of the image variable to update

    • value: null | string

      the new value of the image variable

    • context: Dictionary

      the context dictionary

    Returns Promise<EditorResponse<null>>

  • Parameters

    • id: string

      variable id

    • isHidden: boolean

      visibility flag

    Returns Promise<EditorResponse<null>>

    Use setVariableVisibility instead. This method redirects to setVariableVisibility and sets visibility config for a variable by id.

  • Parameters

    • id: string

      variable id

    • isVisible: boolean

      visibility flag

    Returns Promise<EditorResponse<null>>

    Use setVariableVisibility instead. This method redirects to setVariableVisibility and sets visibility config for a variable by id.

  • This method sets which layouts are considered for variable visibility

    Parameters

    • OptionallayoutIdList: null | string[]

      nullable layout id list. Pass null to reset to follow selected layout.

    Returns Promise<EditorResponse<null>>

  • This method sets the minimum size (both width and height) for an image variable that will be uploaded

    Parameters

    • id: string

      the id of the variable

    • minWidth: null | string

      the minimum width

    • minHeight: null | string

      the minimum height

    Returns Promise<EditorResponse<null>>

  • Experimental

    Sets the prefix character style for a supported variable

    Parameters

    • id: string

      the id of the variable to update

    • characterStyleId: null | string

      the id of the character style to use/clear for the prefix

    Returns Promise<EditorResponse<null>>

  • This method sets removeParagraphIfEmpty flag for a variable

    Parameters

    • id: string

      The id of the variable to update

    • removeParagraphIfEmpty: boolean

      Set to true to remove the paragraph if it is empty, or false to keep it

    Returns Promise<EditorResponse<null>>

  • Experimental

    Sets the suffix character style for a supported variable

    Parameters

    • id: string

      the id of the variable to update

    • characterStyleId: null | string

      the id of the character style to use/clear for the suffix

    Returns Promise<EditorResponse<null>>

  • This method sets a new value for a variable

    If the value is some text to be set on a ShortTextVariable, it must not contain any type of line breaks.

    If the value is passing a context on an image variable value, it will be available from the connector.

    Parameters

    • id: string

      the id of the variable

    • value: null | string | number | boolean

      the new value of the variable

    Returns Promise<EditorResponse<null>>