Back to Website
Show / Hide Table of Contents

updateSurfaces

  • 1 minute to read

Replaces product surfaces (pages). This is an equivalent of the updateSurfaces method from the IFrame API.

Params

  • definition - a product that can be defined through either IProductDefinition or a string. In the latter case, the string stands for a state file ID.
  • surfaces - an array of surfaces in the current product to be removed.
  • newProductSurfaces - an array of surfaces in the new product to be inserted.
  • options - additional configuration settings. See the ISetPrintAreasOptions for more details.
  • preserveSafetyLines - if true, the current safety lines, if any, are restored in new surfaces. If false, safety lines from new surfaces are applied. The default value is true.
  • preserveUserChanges - if true, the changes made by a user are restored in the new surfaces if it is possible. Otherwise, all changes made by the user are wiped. The default value is true.
  • replaceAll - if true, design elements whose names do not match move to the new surface in a random order according to their types. If false, only design elements with the same names are moved to the new surface. The default value is false.
  • updateRevertData - if true, the new surfaces are stored as ones to restore when the product is reverted. Otherwise, the previously stored ones are restored on product revert. The default value is true.
  • updateSurfaceSize - if true, changes the surface size to match the new surface. If it's false and a mockup is defined, then the surface size remains unchanged. By default, updateSurfaceSize is false, and the surface size changes only if no mockups are specified.

For the complete list of parameters, you can refer to IUpdateSurfacesCommandDefinition.

Example

Here, we replace the first page of the loaded product with the third page of a state file.

{
    "type": "design-editor", 
    "name": "design-editor",
    "params": {
        "initial": { ... }, 
        "updateSurfaces": [{
          "definition": "{{ $['options']._.props.id  }}",
          "surfaces": [0],
          "newProductSurfaces": [2],
          "replaceAll": true
        }]
    }
}
Was this page helpful?
Thanks for your feedback!
Back to top Copyright © 2001–2024 Aurigma, Inc. All rights reserved.
Loading...
    Thank for your vote
    Your opinion is important to us. To provide details, send feedback.
    Send feedback