photoeditorsdk

Can't disable auto-download in version 4.3


My config is:

self.editor = new $window.PhotoEditorSDK.UI.ReactUI({
    container,
    responsive: true,
    license: JSON.stringify(sdkLicenseData),
    assets: {
        baseUrl: '/dist/photoeditorsdk/assets/',
    },
    editor: {
        image: img,
    },
    style: {
        width: 800,
        height: 800,
    },
    enableExport: true,
    export: {
        type: $window.PhotoEditorSDK.ImageFormat.IMAGE,
        quality: 1.0,
        download: false,
    },
});

I'm able to detect export being clicked by:

self.editor.on('export', (newUrl) => {

.. but it still downloads the image. How can this be disabled?

I've also tried:

self.editor.on('export', (newUrl) => {
                            self.editor.export(false)
                                .then((data) => {
                                    const foo = 1;
                                });

...but again, by the time I execute the 2nd line, an image has already been downloaded.


Solution

  • The export field here must be inside the editor option, e.g.,

    self.editor = new $window.PhotoEditorSDK.UI.ReactUI({
    container,
    responsive: true,
    license: JSON.stringify(sdkLicenseData),
    assets: {
        baseUrl: '/dist/photoeditorsdk/assets/',
    },
    editor: {
        image: img,
        export: {
          type: $window.PhotoEditorSDK.ImageFormat.IMAGE,
          quality: 1.0,
          download: false,
      }
    },
    style: {
        width: 800,
        height: 800,
    },
    enableExport: true
    })
    

    Then is should work.