Methods

These methods are available on each editor instance.

Name Description
destroy() Destroy editor instance.
editImage(src, options) Load an image. Returns a Promise that resolves when the image is processed.
loadImage(src, options) Load an image. Returns a Promise that resolves when the image is loaded.
processImage() Start processing the current image.
abortProcessImage() Stop processing the current image.
undo() Undo action.
redo() Redo action.
revert() Revert actions. Will run willRevert.

Instances created with the openEditor JavaScript API have three additional methods.

Name Description
show() Show the editor.
hide() Hide the editor.
close() Close the editor. Same as pressing the close button in the top left of the modal.

loadImage

Loads the supplied image. Returns a Promise that resolves with the readOutput object when the image has loaded.

doka.loadImage('./my-image.jpeg').then((readOutput) => {
    // image has loaded
});

editImage

Loads the supplied image. Returns a Promise that resolves with the writeOutput object when the editor has finished processing the image.

doka.editImage('./my-image.jpeg').then((writeOutput) => {
    // image has been edited
});

processImage

Manually triggers the editor to start processing the image. Returns a Promise with the writeOutput object when the editor has finished processing the image.

doka.processImage().then((writeOutput) => {
    // image has been processed
});