Procházet zdrojové kódy

Polished docs and improved test descriptions.

Kamil Piechaczek před 6 roky
rodič
revize
eea2117f8f

+ 4 - 0
packages/ckeditor5-upload/docs/features/base64-upload-adapter.md

@@ -22,6 +22,10 @@ Use the editor below to see the adapter in action. Open the web browser console
 
 ## Installation
 
+<info-box info>
+	The [`@ckeditor/ckeditor5-upload`](https://www.npmjs.com/package/@ckeditor/ckeditor5-upload) package is available by default in all builds. The installation instructions are for developers interested in building their own, custom WYSIWYG editor.
+</info-box>
+
 To add this feature to your editor, install the [`@ckeditor/ckeditor5-upload`](https://www.npmjs.com/package/@ckeditor/ckeditor5-upload) package:
 
 ```bash

+ 12 - 3
packages/ckeditor5-upload/src/base64uploadadapter.js

@@ -13,6 +13,15 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import FileRepository from './filerepository';
 
 /**
+ * A plugin that converts images inserted into the editor into [Base64 strings](https://en.wikipedia.org/wiki/Base64)
+ * stored directly in the {@glink builds/guides/integration/saving-data editor output}.
+ *
+ * This kind of image upload does not require server processing – images are stored with the rest of the text and
+ * displayed by the web browser without additional requests.
+ *
+ * Check out the {@glink features/image-upload/image-upload comprehensive "Image upload overview"} to learn about
+ * other ways to upload images into CKEditor 5.
+ *
  * @extends module:core/plugin~Plugin
  */
 export default class Base64UploadAdapter extends Plugin {
@@ -39,10 +48,10 @@ export default class Base64UploadAdapter extends Plugin {
 }
 
 /**
- * Upload adapter for Base64.
+ * The upload adapter that converts images inserted into the editor into Base64 strings.
  *
  * @private
- * @implements module:upload/base64uploadadapter~Adapter
+ * @implements module:upload/filerepository~UploadAdapter
  */
 class Adapter {
 	/**
@@ -52,7 +61,7 @@ class Adapter {
 	 */
 	constructor( loader ) {
 		/**
-		 * FileLoader instance to use during the upload.
+		 * `FileLoader` instance to use during the upload.
 		 *
 		 * @member {module:upload/filerepository~FileLoader} #loader
 		 */

+ 6 - 6
packages/ckeditor5-upload/tests/base64uploadadapter.js

@@ -38,7 +38,7 @@ describe( 'Base64UploadAdapter', () => {
 		window.document.body.removeChild( div );
 	} );
 
-	it( 'should require FileRepository plugin', () => {
+	it( 'should require the FileRepository plugin', () => {
 		expect( Base64UploadAdapter.requires ).to.deep.equal( [ FileRepository ] );
 	} );
 
@@ -47,7 +47,7 @@ describe( 'Base64UploadAdapter', () => {
 	} );
 
 	describe( 'init()', () => {
-		it( 'should set loader', () => {
+		it( 'should set the loader', () => {
 			return ClassicTestEditor
 				.create( div, {
 					plugins: [ Base64UploadAdapter ],
@@ -77,14 +77,14 @@ describe( 'Base64UploadAdapter', () => {
 			return editor.destroy();
 		} );
 
-		it( 'crateAdapter method should be registered and have upload and abort methods', () => {
+		it( 'crateAdapter method should be registered and have upload() and abort() methods', () => {
 			expect( adapter ).to.not.be.undefined;
 			expect( adapter.upload ).to.be.a( 'function' );
 			expect( adapter.abort ).to.be.a( 'function' );
 		} );
 
 		describe( 'upload()', () => {
-			it( 'returns a promise that resolves an image as base64 string', () => {
+			it( 'returns a promise that resolves an image as a base64 string', () => {
 				setTimeout( () => {
 					// FileReader has loaded the file.
 					stubs.onload();
@@ -136,7 +136,7 @@ describe( 'Base64UploadAdapter', () => {
 		} );
 
 		describe( 'abort()', () => {
-			it( 'should not call abort on the non-existing FileReader uploader (`loader.file` not resolved)', () => {
+			it( 'should not call abort() on the non-existing FileReader uploader (loader#file not resolved)', () => {
 				const adapter = fileRepository.createLoader( createNativeFileMock() );
 
 				expect( () => {
@@ -147,7 +147,7 @@ describe( 'Base64UploadAdapter', () => {
 				expect( stubs.abort.called ).to.equal( false );
 			} );
 
-			it( 'should call abort on the FileReader uploader (`loader.file` resolved)', done => {
+			it( 'should call abort() on the FileReader uploader (loader#file resolved)', done => {
 				adapter.upload();
 
 				// Wait for the `loader.file` promise.