Members
(static, non-null) STATE :Object
State definition.
Type:
- Object
- Source:
(protected) history_ :Array.<Object>
History of the different image states during edition. Every
entry entry represents a change to the image on top of the
previous one.
- History entries are objects with
- url (optional): the url representing the image
- data: the ImageData object of the image
Type:
- Array.<Object>
- Source:
(protected) historyIndex_ :Number
This index points to the current state in the history.
Type:
- Number
- Source:
Methods
accept()
Accepts the current changes applied by the active control and creates
a new entry in the history stack. Doing this will wipe out any
stale redo states.
- Source:
(protected) close_()
Notifies the opener app that the user wants to close the
editor without saving the changes
- Source:
(protected) createHistoryEntry_(imageData)
Creates a new history entry state.
Parameters:
Name | Type | Description |
---|---|---|
imageData |
ImageData | The ImageData of the new image. |
- Source:
discard()
Discards the current changes applied by the active control and reverts
the image to its state before the control activation.
- Source:
getImageEditorCanvas() → {Element}
Retrieves the editor canvas DOM node.
- Source:
Returns:
The canvas element.
- Type
- Element
getImageEditorImageBlob() → {CancellablePromise}
Retrieves the Blob representation of the current image.
- Source:
Returns:
A promise that will resolve with the image blob.
- Type
- CancellablePromise
getImageEditorImageData() → {CancellablePromise}
Retrieves the ImageData representation of the current image.
- Source:
Returns:
A promise that will resolve with the image data.
- Type
- CancellablePromise
normalizeCanvasMimeType_(mimeType) → {String}
Normalizes different mime types to the most similar mime type
available to canvas implementations.
Parameters:
Name | Type | Description |
---|---|---|
mimeType |
String | Original mime type |
Returns:
The normalized mime type
- Type
- String
(protected) notifySaveResult_(result)
Notifies the opener app of the result of the save action
Parameters:
Name | Type | Description |
---|---|---|
result |
Object | The server response to the save action |
- Source:
redo()
Updates the image back to a previously undone state in the history.
Redoing an action recovers the undone image changes and enables the
undo stack in case the user wants to undo the changes again.
- Source:
requestImageEditorEdit(event)
Selects a control and starts the edition phase for it.
Parameters:
Name | Type | Description |
---|---|---|
event |
MouseEvent |
- Source:
requestImageEditorPreview()
Queues a request for a preview process of the current image by the
currently selected control.
- Source:
reset()
Discards all changes and restores the original state of the image.
Unlike the undo/redo methods, reset will wipe out all the history.
- Source:
(protected) save_(event)
Tries to save the current image using the provided save url.
Parameters:
Name | Type | Description |
---|---|---|
event |
MouseEvent | The MouseEvent that triggered the save action |
- Source:
(protected) setterSaveMimeTypeFn_(saveMimeTypenon-null) → {String}
Setter function for the `saveMimeType` state key
Parameters:
Name | Type | Description |
---|---|---|
saveMimeType |
String | The optional passed value for the attribute |
- Source:
Returns:
The computed value for the attribute
- Type
- String
(protected) showError_(message)
Shows an error message in the editor
Parameters:
Name | Type | Description |
---|---|---|
message |
String | The error message to show |
- Source:
(protected) submitBlob_(imageBlob) → {CancellablePromise}
Sends a given image blob to the server for processing
and storing.
Parameters:
Name | Type | Description |
---|---|---|
imageBlob |
Blob | The image blob to send to the server |
- Source:
Returns:
A promise that follows the xhr submission process
- Type
- CancellablePromise
(protected) syncHistory_()
Syncs the image and history values after changes to the
history stack.
- Source:
(protected) syncImageData_(imageData)
Updates the image data showed in the editable area
Parameters:
Name | Type | Description |
---|---|---|
imageData |
ImageData | The new ImageData value to show on the editor |
- Source:
undo()
Reverts the image to the previous state in the history. Undoing
an action brings back the previous version of the image and enables
the redo stack in case the user wants to reapply the change again.
- Source: