Преглед на файлове

Merge branch 'master' into t/18

Aleksander Nowodzinski преди 7 години
родител
ревизия
16c07de9cd

+ 31 - 7
packages/ckeditor5-ckfinder/src/ckfinder.js

@@ -48,7 +48,8 @@ export default class CKFinder extends Plugin {
  */
 
 /**
- * The configuration of the {@link module:ckfinder/ckfinder~CKFinder CKFinder feature}.
+ * The configuration of the {@link module:ckfinder/ckfinder~CKFinder CKFinder feature}
+ * and its {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter upload adapter}.
  *
  *		ClassicEditor
  *			.create( editorElement, {
@@ -56,7 +57,7 @@ export default class CKFinder extends Plugin {
  *					options: {
  *						resourceType: 'Images'
  *					}
- * 				}
+ *				}
  *			} )
  *			.then( ... )
  *			.catch( ... );
@@ -67,8 +68,9 @@ export default class CKFinder extends Plugin {
  */
 
 /**
- * The configuration options to pass to the CKFinder instance. Complete list of configuration options available
- * on [CKFinder documentation website](https://ckeditor.com/docs/ckfinder/ckfinder3/#!/api/CKFinder.Config).
+ * The configuration options passed to the CKFinder file manager instance.
+ *
+ * Check the file manager {@glink @ckfinder ckfinder3/#!/api/CKFinder.Config documentation} for the complete list of options.
  *
  * @member {Object} module:ckfinder/ckfinder~CKFinderConfig#options
  */
@@ -77,10 +79,32 @@ export default class CKFinder extends Plugin {
  * The type of the CKFinder opener method.
  *
  * Supported types are:
- * * `"modal"` - opens a CKFinder modal
- * * `"popup"` - opens a CKFinder popup window
  *
- * Defaults to "'modal'".
+ * * `'modal'` - opens a CKFinder in a modal,
+ * * `'popup'` - opens a CKFinder in a new "pop-up" window.
+ *
+ * Defaults to `'modal'`.
  *
  * @member {String} module:ckfinder/ckfinder~CKFinderConfig#openerMethod
  */
+
+/**
+ * The path (URL) to the connector which handles the file upload in the CKFinder file manager.
+ * When specified, enables the automatic upload of resources such as images inserted into the content.
+ *
+ * For instance, to use CKFinder's {@glink @ckfinder ckfinder3-php/commands.html#command_quick_upload quick upload}
+ * command, your can use the following (or similar) path:
+ *
+ *		ClassicEditor
+ *			.create( editorElement, {
+ *				ckfinder: {
+ *					uploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json'
+ *				}
+ *			} )
+ *			.then( ... )
+ *			.catch( ... );
+ *
+ * Used by the {@link module:adapter-ckfinder/uploadadapter~CKFinderUploadAdapter upload adapter}.
+ *
+ * @member {String} module:ckfinder/ckfinder~CKFinderConfig#uploadUrl
+ */

+ 1 - 1
packages/ckeditor5-ckfinder/src/ckfindercommand.js

@@ -58,7 +58,7 @@ export default class CKFinderCommand extends Command {
 			throw new CKEditorError( 'ckfinder-unknown-openerMethod: The openerMethod config option must by "popup" or "modal".' );
 		}
 
-		const options = this.editor.config.get( 'ckfinder.options' ) || {};
+		const options = Object.assign( {}, this.editor.config.get( 'ckfinder.options' ) );
 
 		options.chooseFiles = true;
 

+ 8 - 0
packages/ckeditor5-ckfinder/tests/ckfindercommand.js

@@ -384,6 +384,14 @@ describe( 'CKFinderCommand', () => {
 			expect( getModelData( model ) ).to.equal( '<other>[]</other>' );
 		} );
 
+		it( 'does not alter the original config', () => {
+			editor.config.set( 'ckfinder', { options: { foo: 'bar' } } );
+
+			command.execute();
+
+			expect( editor.config.get( 'ckfinder.options' ) ).to.deep.equal( { foo: 'bar' } );
+		} );
+
 		function mockFinderFile( url = 'foo/bar.jpg', isImage = true ) {
 			return {
 				isImage: () => isImage,