From 4e0866c877dde58247ff5042c10a8ad3ecb0a13f Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Mon, 29 Jan 2018 10:36:21 +0100 Subject: [PATCH 1/4] Make XHR defualt option to upload a file. Documentation update. --- plugins/filebrowser/plugin.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/filebrowser/plugin.js b/plugins/filebrowser/plugin.js index bcc4059bc68..7519ed32d56 100644 --- a/plugins/filebrowser/plugin.js +++ b/plugins/filebrowser/plugin.js @@ -311,7 +311,7 @@ if ( uploadFile.call( sender, evt ) ) { // Use one of two upload strategies, either form or XHR based (#643). - if ( editor.config.filebrowserUploadMethod !== 'xhr' || !isFileUploadApiSupported ) { + if ( editor.config.filebrowserUploadMethod === 'form' || !isFileUploadApiSupported ) { // Append token preventing CSRF attacks. appendToken( fileInput ); return true; @@ -604,9 +604,9 @@ * * Available values: * - * * `'xhr'` - XMLHttpRequest is used to upload file. Using this option allows to set up with Additional XHR headers with + * * `'xhr'` - (default) XMLHttpRequest is used to upload file. Using this option allows to set up with additional XHR headers with * {@link CKEDITOR.config#fileTools_requestHeaders} option. - * * `'form'` - (default) File is uploaded by submitting a traditional `
` element. + * * `'form'` - File is uploaded by submitting a traditional `` element. * * `null` - The default method is used. * * Note: please be aware that `'xhr'` requires the [File Tools](https://ckeditor.com/cke4/addon/filetools) plugin to work @@ -614,9 +614,8 @@ * {@link CKEDITOR.fileTools#isFileUploadSupported file uploading}, will fallback to the `'form'` method despite configuration * option. * - * // Modern browsers will use XMLHttpRequest to upload files. - * // IE8 and IE9 will use form submit even though the config option is set to 'xhr'. - * config.filebrowserUploadMethod = 'xhr'; + * // All browsers will use form element with submit method to upload a file. + * config.filebrowserUploadMethod = 'form'; * * @since 4.9.0 * @cfg {String/null} [filebrowserUploadMethod=null] From 00598234e15432634ab17c4c147e194807a90503 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Tue, 30 Jan 2018 12:20:13 +0100 Subject: [PATCH 2/4] Update docs description. --- plugins/filebrowser/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/filebrowser/plugin.js b/plugins/filebrowser/plugin.js index 7519ed32d56..d40f817c648 100644 --- a/plugins/filebrowser/plugin.js +++ b/plugins/filebrowser/plugin.js @@ -607,7 +607,7 @@ * * `'xhr'` - (default) XMLHttpRequest is used to upload file. Using this option allows to set up with additional XHR headers with * {@link CKEDITOR.config#fileTools_requestHeaders} option. * * `'form'` - File is uploaded by submitting a traditional `` element. - * * `null` - The default method is used. + * * `null` - The default method is used. _Note: Below version 4.9.0 only available upload option was submitting a form._ * * Note: please be aware that `'xhr'` requires the [File Tools](https://ckeditor.com/cke4/addon/filetools) plugin to work * properly. Without the plugin or using a browser that does not support From 39970443d46be6cec48522be315f6739f59d2ddb Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Thu, 1 Feb 2018 22:09:02 +0100 Subject: [PATCH 3/4] Adjusted API docs for config.filebrowserUploadMethod - it no longer uses null value. --- plugins/filebrowser/plugin.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/filebrowser/plugin.js b/plugins/filebrowser/plugin.js index d40f817c648..93eb7daad17 100644 --- a/plugins/filebrowser/plugin.js +++ b/plugins/filebrowser/plugin.js @@ -604,10 +604,9 @@ * * Available values: * - * * `'xhr'` - (default) XMLHttpRequest is used to upload file. Using this option allows to set up with additional XHR headers with + * * `'xhr'` - XMLHttpRequest is used to upload file. Using this option allows to set up with additional XHR headers with * {@link CKEDITOR.config#fileTools_requestHeaders} option. - * * `'form'` - File is uploaded by submitting a traditional `` element. - * * `null` - The default method is used. _Note: Below version 4.9.0 only available upload option was submitting a form._ + * * `'form'` - File is uploaded by submitting a traditional `` element. _Note: That was the only option available until CKEditor 4.9.0._ * * Note: please be aware that `'xhr'` requires the [File Tools](https://ckeditor.com/cke4/addon/filetools) plugin to work * properly. Without the plugin or using a browser that does not support @@ -618,6 +617,6 @@ * config.filebrowserUploadMethod = 'form'; * * @since 4.9.0 - * @cfg {String/null} [filebrowserUploadMethod=null] + * @cfg {String} [filebrowserUploadMethod='xhr'] * @member CKEDITOR.config */ From bcc923544fb016b32de030ceeadf0420416224ba Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Thu, 1 Feb 2018 22:12:37 +0100 Subject: [PATCH 4/4] Changelog entry. Also corrected link to File Browser plugin in other entry. --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 889a107f6e1..49235662df2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,8 @@ New Features: * [#1338](https://github.com/ckeditor/ckeditor-dev/issues/1338): Keystroke labels are displayed for function keys (like F7, F8). -* [#933](https://github.com/ckeditor/ckeditor-dev/issues/933): [File Browser](https://ckeditor.com/cke4/addon/filetools) plugin can now upload files using XHR requests. This allows for setting custom HTTP headers using [`config.fileTools_requestHeaders`](http://docs.ckeditor.test/#!/api/CKEDITOR.config-cfg-fileTools_requestHeaders) configuration option. +* [#933](https://github.com/ckeditor/ckeditor-dev/issues/933): [File Browser](https://ckeditor.com/cke4/addon/filebrowser) plugin can now upload files using XHR requests. This allows for setting custom HTTP headers using [`config.fileTools_requestHeaders`](http://docs.ckeditor.test/#!/api/CKEDITOR.config-cfg-fileTools_requestHeaders) configuration option. +* [#1365](https://github.com/ckeditor/ckeditor-dev/issues/1365): [File Browser](https://ckeditor.com/cke4/addon/filebrowser) plugin uses XHR requests by default. * [#1399](https://github.com/ckeditor/ckeditor-dev/issues/1399): Added possibility to set [`CKEDITOR.config.startupFocus`](https://docs.ckeditor.com/ckeditor4/docs/#!/api/CKEDITOR.config-cfg-startupFocus) as `start` or `end` to specify where editor focus should be after initialization. * [#1441](https://github.com/ckeditor/ckeditor-dev/issues/1441): [Magic Line](https://ckeditor.com/cke4/addon/magicline) line element can now be identified by `data-cke-magic-line="1"` attribute.