tinymce.EditorUpload
TinyMCE Editor Upload API Handles image uploads, updates undo stack and patches over various internal functions.
Examples
// Apply a new filter within the image scan.
tinymce.activeEditor.EditorUpload.addFilter((image) => {
const maxSize = 1920 * 1080;
const imageSize = image.width * image.height;
return imageSize < maxSize;
});
// Upload all valid images in the editor
tinymce.activeEditor.EditorUpload.uploadImages();
// Scan the editor for valid images
tinymce.activeEditor.EditorUpload.scanForImages();
Summary
Properties
Name | Type | Summary | Defined by |
---|---|---|---|
blobCache |
|
Cache of blob elements created in an editor instance. |
Methods
Name | Summary | Defined by |
---|---|---|
Adds a custom filter that controls the images which are included in the scan. Images must return true on every added filter to be considered valid. |
||
Resets the blob data and upload status of all uploaded images. Called automatically on |
||
Scans the editor content for valid image elements and generates blob information for each image. |
||
Uploads all the data uri/blob uri images scanned from the editor content to the server. |
||
Uploads all data uri/blob uri images to the server only when automatic uploads are enabled. |
Methods
addFilter()
addFilter(filter: Function)
Adds a custom filter that controls the images which are included in the scan. Images must return true on every added filter to be considered valid.
destroy()
destroy()
Resets the blob data and upload status of all uploaded images. Called automatically on editor.remove
.
This method is not recommended for integration.
scanForImages()
scanForImages(): Promise
Scans the editor content for valid image elements and generates blob information for each image.