Cloud
Upload images and attachments to the cloud.
☁️ Plate Cloud Uploads - Images and Attachments
Resizing Images
Local Setup
Cloud Images
Cloud Attachments
Installation
npm install @udecode/plate-cloud
Usage
To get the value to save to your database, use editor.cloud.getSaveValue()
. This is required for Plate Cloud because of the asynchronous nature of uploads.
API
createCloudAttachmentPlugin
createCloudImagePlugin
Options
The maximum initial width of the cloud image.
The maximum initial height of the cloud image.
The minimum width of the cloud image after resize.
The maximum width of the cloud image after resize.
createCloudPlugin
Options
Extends ClientOptions
.
The initial state of the upload store. Each record maps a string key to an upload object.
createUploadStore
State
The lookup for origin files, where the keys are the IDs and the values are upload information.
finishUploads
Finds all the in-progress uploads and waits for them all to finish before resolving the returned promise.
Parameters
The editor instance.
generateSrcAndSrcSet
Generates the src
and srcSet
attributes for an image.
Parameters
Returns
An object containing the src
and srcSet
attributes.
getInProgressUploads
Takes an array of nodes
and a lookup for origins
and normalizes the nodes by replacing the id
values with actual URLs for successfully uploaded files.
Parameters
The array of nodes to be normalized.
The lookup for origin files, where the keys are the IDs and the values are upload information.
getSaveValue
Normalizes the save value by replacing the id
values with actual URLs for successfully uploaded files.
Parameters
The save value to be normalized.
The lookup for origin files, where the keys are the IDs and the values are upload information.
Returns
The normalized save value with replaced id
values.
onDropCloud
Handles the drop event of cloud files.
Parameters
The editor instance.
The drag event object.
Returns
A boolean indicating whether the drop event was handled successfully.
onPasteCloud
Handles the paste event of cloud files.
Parameters
The editor instance.
The clipboard event object.
Returns
A boolean indicating whether the paste event was handled successfully.
uploadFiles
Uploads a single file to the cloud.
Parameters
The editor instance.
The file to be uploaded.
CloudEditorProps
Attributes
Object containing methods and properties related to cloud operations.
CloudImageEditorProps
Attributes
Object containing the dimensions of the cloud image.
TCloudAttachmentElement
Parameters
The URL of the cloud attachment.
The filename of the cloud attachment.
The size of the cloud attachment in bytes.
TCloudImageElement
Attributes
The URL of the cloud image.
The size of the image in bytes.
The width of the cloud image.
The height of the cloud image.
The maximum width of the cloud image.
The maximum height of the cloud image.
API Plugins
withCloud
A higher-order function that enhances a Plate editor with cloud-related functionality.
Parameters
The Plate editor instance.
The cloud plugin.
Returns
The enhanced Plate editor instance with cloud functionality.
withCloudAttachment
A higher-order function that enhances a Plate Cloud editor with cloud attachment functionality.
Parameters
The Plate editor instance.
The cloud attachment plugin.
Returns
The enhanced Plate Cloud editor instance with cloud attachment functionality.
withCloudImage
A higher-order function that enhances a Plate Cloud Image editor with cloud image functionality.
Parameters
The Plate editor instance.
The cloud image plugin.
Returns
The enhanced Plate Cloud Image editor instance with cloud image functionality.