What is the proper way to close PhotoEditorSDK ReactUI?

332 Views Asked by At

According to their documentation, there is an event for when the photoeditorsdk get close.

the editor will emit a close event when the user clicks the close button.

Source

However, there is no indication on how to properly close the editor. I tried to remove any items inside of div editor like this:

    // Closing
    imageEditor.editor.on('close', (result) => {
        console.log('Closing.....');
        // TODO: This is not working.
        $("#" + imageEditor.editorId).empty();
    });

The problem with this solution is that if I tried to load the editor again does not work.

What is the proper way to close PhotoEditorSDK ReactUI?

1

There are 1 best solutions below

0
On

You should do the following:

imageEditor
    .editor // @link https://docs.photoeditorsdk.com/apidocs/html5/v4/PhotoEditorSDK.html
    .on('close', () => imageEditor.editor.dispose());