Editor Configuration

You can change the default behavior of the Embedded Editor by changing the object inside the initDynamicMockupsIframe function from SDK.

<script>
      document.addEventListener("DOMContentLoaded", function () {
        DynamicMockups.initDynamicMockupsIframe({
          iframeId: "dm-iframe",
          data: { "x-website-key": "YOUR_WEBSITE_KEY_HERE" },
          mode: "download",
        });
      });
</script>
FieldRequiredTypeDefaultDescription

iframeId

true

string

dm-iframe

data

true

object

Change embeded editor behaviour

mode

true

string

download

Choose "download" or "custom"

callback

false

object

if mode is set to custom, use the callback

data

data parameter allows you to change the functionality inside the embedded editor:

FieldRequiredTypeExampleDescription

x-website-key

true

string

7OA6hzpunW

Connect the embed editor with Dynamic Mockups. Contact us to get this key.

showColorPicker

false

boolean

true

Show the color picker

showColorPresets

false

boolean

true

Show the color presets created in Dynamic Mockups APP on your account

enableDesignFileUpload

false

boolean

true

Enable users to upload design file from the editor

designUrl

false

string

https://app-dynamicmockups-production.s3.eu-central-1.amazonaws.com/static/api_sandbox_icon.png

Provide the URL of the design file to render

customFields

false

object

{

"userId": "143",

"productId": "1478",

"category": "Mugs"

}

Provide the JSON object of your custom fields and get them in a response

mockupExportOptions.imageFormat

false

string

webp

webp|jpg|png

mockupExportOptions.image_size

false

number

1080

Get the rendered image in strict image size defined in "width"

data example

// data example
<script>
      document.addEventListener("DOMContentLoaded", function () {
        DynamicMockups.initDynamicMockupsIframe({
          iframeId: "dm-iframe",
          data: { 
            "x-website-key": "CONTACT_US_FOR_THE_WEBSITE_KEY",
            "MORE DATA HERE": "VALUE" 
          },
          mode: "download"
        });
      });
</script>

callback

Inside the callbackData you can find:

FieldTypeExampleDescription

callbackData.mockupsExport[0].export_label

string

RIDN48UYR1

Get export_label in response once the render is done

callbackData.mockupsExport[0].export_path

string

Get export_path in response once the render is done

callbackData.customFields

object

{

"userId": "143",

"productId": "1478",

"category": "Mugs"

}

Provide the JSON object of your custom fields and get them in a response

callback example

// callback example
<script>
      document.addEventListener("DOMContentLoaded", function () {
        DynamicMockups.initDynamicMockupsIframe({
          iframeId: "dm-iframe",
          data: { "x-website-key": "CONTACT_US_FOR_THE_WEBSITE_KEY" },
          mode: "custom",
          callback: (callbackData) => { console.log(callbackData); },
        });
      });
</script>

Last updated