New in 1.25.0

configurePreviewSizes(previewSizes)

Defines custom preview sizes for use in Scrivito’s editing interface.

Scrivito’s sidebar offers several preview sizes for selection. They enable editors to see how the website would look on devices with smaller screens. If custom preview sizes are provided, they replace the built-in ones.

Params

  • previewSizes (Array) – the preview sizes to provide. Each array element is expected to be an object containing the following:
    • title (String) – the title of the preview size. 
    • width (Number) – the width of the preview size in pixels (optional). If not specified, the full width is used.
    • description (String) – the description of the preview size (optional).
    • icon (String) – the URL of an icon image (optional).

Throws

An error is thrown if

  • the previewSizes array is empty,
  • the provided preview sizes do not have a unique width specified as a positive integer.

Example