@layers-app/editor 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +46 -6
- package/dist/index.js +2 -2
- package/dist/{layers.CjmCIVDQ.js → layers.Beb8H5iK.js} +33 -33
- package/dist/{layers.Cl_uz2hp.js → layers.CWaWCp52.js} +1 -1
- package/dist/layers.CmuE7cyq.js +1 -0
- package/dist/{layers.BtDUR7c8.js → layers.Cnf8ktNm.js} +13324 -12443
- package/dist/layers.Crl1Kzhp.js +164 -0
- package/dist/{layers.BgmvxWuS.js → layers.DicigL6z.js} +51 -51
- package/package.json +9 -7
- package/dist/layers.O3pZNIRN.js +0 -164
- package/dist/layers.Q3nBF5Jz.js +0 -1
package/README.md
CHANGED
|
@@ -149,12 +149,12 @@ Use **StylesProvider** to add styling to your HTML content.
|
|
|
149
149
|
|
|
150
150
|
## Image upload
|
|
151
151
|
|
|
152
|
-
To start working with image uploads, use the **
|
|
152
|
+
To start working with image uploads, use the **fetchUploadMedia** function, which takes three parameters: **file**, **success**, and **error**. After successfully uploading the image to your service, you should call the **success** function and pass two required arguments: the **URL** of the image and its **ID**.
|
|
153
153
|
|
|
154
154
|
```
|
|
155
|
-
const
|
|
155
|
+
const fetchUploadMedia = async (
|
|
156
156
|
file: File,
|
|
157
|
-
success: (url: string, id: string) => void,
|
|
157
|
+
success: (url: string, id: string, data?: object) => void,
|
|
158
158
|
error?: (error?: Error) => void
|
|
159
159
|
) => {
|
|
160
160
|
const formData = new FormData();
|
|
@@ -189,16 +189,16 @@ To start working with image uploads, use the **fetchUploadImage** function, whic
|
|
|
189
189
|
|
|
190
190
|
<Editor
|
|
191
191
|
...props
|
|
192
|
-
|
|
192
|
+
fetchUploadMedia={fetchUploadMedia}
|
|
193
193
|
/>
|
|
194
194
|
```
|
|
195
195
|
|
|
196
196
|
## Image Deletion
|
|
197
197
|
|
|
198
|
-
To have greater control over image deletion, pass an optional function **
|
|
198
|
+
To have greater control over image deletion, pass an optional function **fetchDeleteMedia** to the editor, which accepts three parameters: **id**, **success**, and **error**. After successfully deleting the image from your service, the **success** function should be called.
|
|
199
199
|
|
|
200
200
|
```
|
|
201
|
-
const
|
|
201
|
+
const fetchDeleteMedia = async (
|
|
202
202
|
id: string,
|
|
203
203
|
success: () => void,
|
|
204
204
|
error?: (error?: Error) => void
|
|
@@ -230,8 +230,8 @@ To have greater control over image deletion, pass an optional function **fetchDe
|
|
|
230
230
|
|
|
231
231
|
<Editor
|
|
232
232
|
...props
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
fetchUploadMedia={fetchUploadMedia}
|
|
234
|
+
fetchDeleteMedia={fetchUploadMedia}
|
|
235
235
|
/>
|
|
236
236
|
```
|
|
237
237
|
|
|
@@ -281,7 +281,7 @@ Dropzone.Idle is visible when the user is not dragging any file into the drop zo
|
|
|
281
281
|
|
|
282
282
|
<Editor
|
|
283
283
|
...props
|
|
284
|
-
|
|
284
|
+
fetchUploadMedia={fetchUploadMedia}
|
|
285
285
|
contentModalUploadImage={Content}
|
|
286
286
|
maxImageSize={5}
|
|
287
287
|
maxImageSizeError={() => {}}
|
|
@@ -356,8 +356,8 @@ outputFormat?: 'html' | 'json' - The outputFormat property defines whether we wa
|
|
|
356
356
|
initialContent: string | object - The initial content for the editor.
|
|
357
357
|
maxHeight?: number - Sets the height of the editor. The default is 100%.
|
|
358
358
|
mode?: 'simple' | 'default' | 'full' | 'editor' - The editor mode. Depending on the chosen mode, functionality may be restricted or extended. The default is default.
|
|
359
|
-
|
|
360
|
-
|
|
359
|
+
fetchUploadMedia?: (file: File, success: (url: string, id: string, error?: (error?: Error) => void) => void) - Function to upload an image to your service.
|
|
360
|
+
fetchDeleteMedia?: (id: string, success: () => void, error?: (error?: Error) => void) - Helper function to delete an image.
|
|
361
361
|
maxImageSize?: number - The maximum image size in megabytes.
|
|
362
362
|
contentModalUploadImage?: React.FunctionComponent - A React component to replace content in DropZone.
|
|
363
363
|
maxImageSizeError?: () => void - A function that is called if the image exceeds the maxImageSize.
|