|
|
@@ -26,9 +26,8 @@ import uid from '@ckeditor/ckeditor5-utils/src/uid.js';
|
|
|
* To use it, first you need an upload adapter. Upload adapter's job is to handle communication with the server
|
|
|
* (sending the file and handling server's response). You can use one of the existing plugins introducing upload adapters
|
|
|
* (e.g. {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter} or
|
|
|
- * {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter}) or write your own one
|
|
|
- * (which boils down to setting the {@link ~FileRepository#createUploadAdapter} factory function – see
|
|
|
- * {@link module:upload/filerepository~UploadAdapter `UploadAdapter` interface} documentation).
|
|
|
+ * {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter}) or write your own one – see
|
|
|
+ * the {@glink framework/guides/deep-dive/upload-adapter "Custom image upload adpter" deep dive guide}.
|
|
|
*
|
|
|
* Then, you can use {@link module:upload/filerepository~FileRepository#createLoader `createLoader()`} and the returned
|
|
|
* {@link module:upload/filerepository~FileLoader} instance to load and upload files.
|
|
|
@@ -156,25 +155,17 @@ export default class FileRepository extends Plugin {
|
|
|
*
|
|
|
* **If you see this warning when using one of the {@glink builds/index CKEditor 5 Builds}**
|
|
|
* it means that you did not configure any of the upload adapters available by default in those builds.
|
|
|
- * See:
|
|
|
*
|
|
|
- * * {@link module:core/editor/editorconfig~EditorConfig#cloudServices `config.cloudServices`} for
|
|
|
- * Easy Image with Cloud Services integration,
|
|
|
- * * {@link module:core/editor/editorconfig~EditorConfig#ckfinder `config.ckfinder`} for CKFinder
|
|
|
- * file upload integration.
|
|
|
+ * See the {@glink features/image-upload/image-upload comprehensive "Image upload overview"} to learn which upload
|
|
|
+ * adapters are available in the builds and how to configure them.
|
|
|
*
|
|
|
* **If you see this warning when using a custom build** there is a chance that you enabled
|
|
|
* a feature like {@link module:image/imageupload~ImageUpload},
|
|
|
* or {@link module:image/imageupload/imageuploadui~ImageUploadUI} but you did not enable any upload adapter.
|
|
|
- * You can choose one of the existing upload adapters:
|
|
|
+ * You can choose one of the existing upload adapters listed in the
|
|
|
+ * {@glink features/image-upload/image-upload "Image upload overview"}.
|
|
|
*
|
|
|
- * * {@link module:easy-image/cloudservicesuploadadapter~CloudServicesUploadAdapter}
|
|
|
- * (remember to {@link module:core/editor/editorconfig~EditorConfig#cloudServices configure it})
|
|
|
- * * {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter}
|
|
|
- * (remember to {@link module:core/editor/editorconfig~EditorConfig#ckfinder configure it})
|
|
|
- *
|
|
|
- * You can also implement your own upload adapter (in which case, please refer
|
|
|
- * to the {@link module:upload/filerepository~UploadAdapter `UploadAdapter` interface} documentation).
|
|
|
+ * You can also implement your {@glink framework/guides/deep-dive/upload-adapter own image upload adapter}.
|
|
|
*
|
|
|
* @error filerepository-no-upload-adapter
|
|
|
*/
|
|
|
@@ -487,44 +478,12 @@ class FileLoader {
|
|
|
mix( FileLoader, ObservableMixin );
|
|
|
|
|
|
/**
|
|
|
- * Upload adapter interface used by FileRepository to handle file upload. Upload adapter is a bridge between the editor and server that
|
|
|
- * handles file uploads. It should contain logic necessary to initiate upload process and monitor its progress.
|
|
|
- *
|
|
|
- * It should implement two methods:
|
|
|
- *
|
|
|
- * * {@link module:upload/filerepository~UploadAdapter#upload `upload()`},
|
|
|
- * * {@link module:upload/filerepository~UploadAdapter#abort `abort()`}.
|
|
|
- *
|
|
|
- * Example upload adapter implementation:
|
|
|
- *
|
|
|
- * class UploadAdapter {
|
|
|
- * constructor( loader ) {
|
|
|
- * // Save Loader instance to update upload progress.
|
|
|
- * this.loader = loader;
|
|
|
- * }
|
|
|
- *
|
|
|
- * upload() {
|
|
|
- * // Update loader's progress.
|
|
|
- * server.onUploadProgress( data => {
|
|
|
- * loader.uploadTotal = data.total;
|
|
|
- * loader.uploaded = data.uploaded;
|
|
|
- * } ):
|
|
|
- *
|
|
|
- * // Return promise that will be resolved when file is uploaded.
|
|
|
- * return server.upload( loader.file );
|
|
|
- * }
|
|
|
- *
|
|
|
- * abort() {
|
|
|
- * // Reject promise returned from upload() method.
|
|
|
- * server.abortUpload();
|
|
|
- * }
|
|
|
- * }
|
|
|
- *
|
|
|
- * Then upload adapter can be set to be used by {@link module:upload/filerepository~FileRepository FileRepository}:
|
|
|
+ * Upload adapter interface used by the {@link module:upload/filerepository~FileRepository file repository}
|
|
|
+ * to handle file upload. An upload adapter is a bridge between the editor and server that handles file uploads.
|
|
|
+ * It should contain a logic necessary to initiate an upload process and monitor its progress.
|
|
|
*
|
|
|
- * editor.plugins.get( 'FileRepository' ).createUploadAdapter = function( loader ) {
|
|
|
- * return new UploadAdapter( loader );
|
|
|
- * };
|
|
|
+ * Learn how to develop your own upload adapter for CKEditor 5 in the
|
|
|
+ * {@glink framework/guides/deep-dive/upload-adapter "Custom upload adapter" guide}.
|
|
|
*
|
|
|
* @interface UploadAdapter
|
|
|
*/
|