The editor handler defines functions and properties that allow to control the editor session.

Hierarchy

  • EditorHandler

Properties

CustomDataCategory: CustomDataCategory

Interface to give access to the custom data category to search for data in a very high performance mode.

Interface giving access to data stored via the editor session.

  • data stored against the user or deparmtnet
  • data stored against the current product or in general
  • data files available in the global data folder
Events: Events

The event interface helps for events generated by the editor as well as establish communications between different scripts.

ExternalApi: ExternalApi

The external API gives access to external functionality which is available as server to server communication.

Helper: Helper

Helper methods to do a wide range of tasks.

ImmediateActions: ImmediateActions

The immediate actions interface gives access to the immediate actions functionality. Internal use only.

Invent: Invent

The Invent interface gives access to the Invent integration.

Loc: Loc

Localization interface to translate language strings to the current locale variant.

Resources: Resources

Interface to give access to all resources:

  • cliparts
  • backgrounds
  • fonts
  • spot colors
  • media items
  • layouts
  • masks
  • placeholders
Selection: EditorSelection

Interface giving access to the field selection functionality including getting and setting the selection.

ServerSide: Serverside

Server side only functionality for batch output creation.

UI: UI

Interface to give access to the UI functionality. Used to generate custom UI and access other UI elements.

View: View

Interface giving access to the current canvas view including the zoom level and the scroll position. Function to retrieve and change the current view.

Methods

  • Checks if the current user has the specified permission. This should be used before attemting to execute any action that requires a specific permission.

    Parameters

    Returns boolean

    True if the current user has the specified permission, and false if it does not.

  • Clears the current undo stack. As script operations can generate a series of undo items, this function can be used to clear the undo stack.

    Returns void

  • Returns the specified price with the formatting configured for that storefront (e.g. currency symbol, decimal separator, etc.)

    Parameters

    • price: number

      The price to format.

    Returns number

    The formatted price.

  • Helper function to generate a link to the MegaScript handler for a specific instance. This allows you to add custom functionality to the editor.

    Parameters

    • parameters: MegaScriptIdentifier

      The megascript identifier.

    • additionalValues: {
          [Key: string]: string;
      }

      Additional dictionary which will be added to the query string of the generated URL.

      • [Key: string]: string

    Returns string

    The absolute URL for the mega script handler.

  • Test if the current user is an administrator (aka user with administration rights for MegaEdit).

    Returns boolean

    True if the current user is an administrator, and false if it is not.

  • Test if the editor is running in an embedded context.

    Returns boolean

    True if the editor is running in an embedded context, and false if it runs standalone.

  • Test if the editor is running in an iframe.

    Returns boolean

    True if the editor is running in an iframe, and false if it runs standalone.

  • Test if the current execution is client or server side.

    Returns boolean

    True if the script is running server side, and false if it runs on the editor.

  • Reports a custom load step. Load steps allow to add additional custom steps to the loading process of the editor. The loading overlay will be extended with each step. Steps can be configured within the administration interface and scripts have to report the steps once they are done. Multiple custom steps are supported. The script should report the step only once it would be ok with the user interface to show.

    Parameters

    • loadStep: string

      The load step to report. This should be the name of the step as configured in the administration interface.

    Returns void

  • Set the editor status for the given status item. This allows to enable/disable certain editor functionality via a script.

    Parameters

    • stat: EditorStatusItems

      The status item to control.

    • value: unknown

      The value to set. The type of the value depends on the status item.

    Returns void

Generated using TypeDoc