@ckeditor/ckeditor5-adapter-ckfinder
Advanced tools
Comparing version 0.1.0 to 0.1.1
Changelog | ||
========= | ||
## [0.1.1](https://github.com/ckeditor/ckeditor5-adapter-ckfinder/compare/v0.1.0...v0.1.1) (2017-09-03) | ||
### Other changes | ||
* Aligned the implementation to changes in the image upload. ([eb456ac](https://github.com/ckeditor/ckeditor5-adapter-ckfinder/commit/eb456ac)) | ||
## 0.1.0 (2017-05-08) | ||
@@ -5,0 +12,0 @@ |
@@ -6,3 +6,3 @@ /** | ||
/* jshint browser: false, node: true, strict: true */ | ||
/* eslint-env node */ | ||
@@ -12,3 +12,4 @@ 'use strict'; | ||
const gulp = require( 'gulp' ); | ||
const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' )( { | ||
const ckeditor5Lint = require( '@ckeditor/ckeditor5-dev-lint' ); | ||
const options = { | ||
// Files ignored by `gulp lint` task. | ||
@@ -19,6 +20,6 @@ // Files from .gitignore will be added automatically during task execution. | ||
] | ||
} ); | ||
}; | ||
gulp.task( 'lint', ckeditor5Lint.lint ); | ||
gulp.task( 'lint-staged', ckeditor5Lint.lintStaged ); | ||
gulp.task( 'lint', () => ckeditor5Lint.lint( options ) ); | ||
gulp.task( 'lint-staged', () => ckeditor5Lint.lintStaged( options ) ); | ||
gulp.task( 'pre-commit', [ 'lint-staged' ] ); |
{ | ||
"Cannot upload file:": "A generic error displayed on upload failure. File name is concatenated to this text." | ||
"Cannot upload file:": "A generic error message displayed on upload failure. The file name is concatenated to this text." | ||
} |
{ | ||
"name": "@ckeditor/ckeditor5-adapter-ckfinder", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "CKFinder adapter for CKEditor 5.", | ||
"keywords": [], | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "*", | ||
"@ckeditor/ckeditor5-upload": "*", | ||
"@ckeditor/ckeditor5-utils": "*" | ||
"@ckeditor/ckeditor5-core": "^0.9.0", | ||
"@ckeditor/ckeditor5-upload": "^0.2.0", | ||
"@ckeditor/ckeditor5-utils": "^0.10.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "*", | ||
"@ckeditor/ckeditor5-clipboard": "*", | ||
"@ckeditor/ckeditor5-dev-lint": "^2.0.2", | ||
"@ckeditor/ckeditor5-editor-classic": "*", | ||
"@ckeditor/ckeditor5-enter": "*", | ||
"@ckeditor/ckeditor5-heading": "*", | ||
"@ckeditor/ckeditor5-image": "*", | ||
"@ckeditor/ckeditor5-list": "*", | ||
"@ckeditor/ckeditor5-paragraph": "*", | ||
"@ckeditor/ckeditor5-typing": "*", | ||
"@ckeditor/ckeditor5-undo": "*", | ||
"@ckeditor/ckeditor5-basic-styles": "^0.9.0", | ||
"@ckeditor/ckeditor5-clipboard": "^0.7.0", | ||
"@ckeditor/ckeditor5-dev-lint": "^3.1.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^0.8.0", | ||
"@ckeditor/ckeditor5-enter": "^0.10.0", | ||
"@ckeditor/ckeditor5-heading": "^0.10.0", | ||
"@ckeditor/ckeditor5-image": "^0.7.0", | ||
"@ckeditor/ckeditor5-list": "^0.7.0", | ||
"@ckeditor/ckeditor5-paragraph": "^0.9.0", | ||
"@ckeditor/ckeditor5-typing": "^0.10.0", | ||
"@ckeditor/ckeditor5-undo": "^0.9.0", | ||
"eslint-config-ckeditor5": "^1.0.5", | ||
"gulp": "^3.9.1", | ||
@@ -24,0 +25,0 @@ "guppy-pre-commit": "^0.4.0" |
CKFinder adapter for CKEditor 5 | ||
======================================== | ||
[![Join the chat at https://gitter.im/ckeditor/ckeditor5](https://badges.gitter.im/ckeditor/ckeditor5.svg)](https://gitter.im/ckeditor/ckeditor5?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-adapter-ckfinder.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-adapter-ckfinder) | ||
@@ -5,0 +6,0 @@ [![Build Status](https://travis-ci.org/ckeditor/ckeditor5-adapter-ckfinder.svg)](https://travis-ci.org/ckeditor/ckeditor5-adapter-ckfinder) |
@@ -18,4 +18,4 @@ /** | ||
/** | ||
* Plugin that enables CKFinder uploads in CKEditor 5. | ||
* Configure proper upload URL under `ckfinder.uploadUrl` key, for example: | ||
* A plugin that enables CKFinder uploads in CKEditor 5. | ||
* Configure proper upload URL under the `ckfinder.uploadUrl` key, for example: | ||
* | ||
@@ -67,3 +67,3 @@ * Editor.create( editorElement, { | ||
/** | ||
* Creates new adapter instance. | ||
* Creates a new adapter instance. | ||
* | ||
@@ -76,3 +76,3 @@ * @param {module:upload/filerepository~FileLoader} loader | ||
/** | ||
* FileLoader instance to use during upload. | ||
* FileLoader instance to use during the upload. | ||
* | ||
@@ -99,3 +99,3 @@ * @member {module:upload/filerepository~FileLoader} #loader | ||
/** | ||
* Starts upload process. | ||
* Starts the upload process. | ||
* | ||
@@ -114,3 +114,3 @@ * @see module:upload/filerepository~Adapter#upload | ||
/** | ||
* Aborts upload process. | ||
* Aborts the upload process. | ||
* | ||
@@ -127,3 +127,3 @@ * @see module:upload/filerepository~Adapter#abort | ||
/** | ||
* Initializes XMLHttpRequest object. | ||
* Initializes the XMLHttpRequest object. | ||
* | ||
@@ -143,4 +143,4 @@ * @private | ||
* @private | ||
* @param {Function} resolve Callback function to be called when request is successful. | ||
* @param {Function} reject Callback function to be called when request cannot be completed. | ||
* @param {Function} resolve Callback function to be called when the request is successful. | ||
* @param {Function} reject Callback function to be called when the request cannot be completed. | ||
*/ | ||
@@ -163,3 +163,3 @@ _initListeners( resolve, reject ) { | ||
resolve( { | ||
original: response.url | ||
default: response.url | ||
} ); | ||
@@ -171,3 +171,3 @@ } ); | ||
if ( xhr.upload ) { | ||
xhr.upload.addEventListener( 'progress', ( evt ) => { | ||
xhr.upload.addEventListener( 'progress', evt => { | ||
if ( evt.lengthComputable ) { | ||
@@ -182,3 +182,3 @@ loader.uploadTotal = evt.total; | ||
/** | ||
* Prepares data and sends the request. | ||
* Prepares the data and sends the request. | ||
* | ||
@@ -185,0 +185,0 @@ * @private |
@@ -44,3 +44,3 @@ /** | ||
for ( let part of parts ) { | ||
for ( const part of parts ) { | ||
const pair = part.split( '=' ); | ||
@@ -67,3 +67,3 @@ const key = decodeURIComponent( pair[ 0 ].trim().toLowerCase() ); | ||
// Generates CSRF token with given length. | ||
// Generates the CSRF token with the given length. | ||
// | ||
@@ -80,3 +80,3 @@ // @private | ||
for ( let j = 0; j < randValues.length; j++ ) { | ||
let character = tokenCharset.charAt( randValues[ j ] % tokenCharset.length ); | ||
const character = tokenCharset.charAt( randValues[ j ] % tokenCharset.length ); | ||
result += Math.random() > 0.5 ? character.toUpperCase() : character; | ||
@@ -83,0 +83,0 @@ } |
@@ -6,5 +6,5 @@ /** | ||
/* globals document, console */ | ||
/* globals console, window, document */ | ||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic'; | ||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import Enter from '@ckeditor/ckeditor5-enter/src/enter'; | ||
@@ -26,14 +26,19 @@ import Typing from '@ckeditor/ckeditor5-typing/src/typing'; | ||
ClassicEditor.create( document.querySelector( '#editor' ), { | ||
plugins: [ | ||
Enter, Typing, Paragraph, Heading, Undo, Bold, Italic, Heading, List, Image, ImageToolbar, Clipboard, | ||
ImageCaption, ImageStyle, ImageUpload, CKFinderUploadAdapter | ||
], | ||
toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'insertImage' ], | ||
ckfinder: { | ||
uploadUrl: 'https://cksource.com/weuy2g4ryt278ywiue/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json' | ||
} | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); | ||
ClassicEditor | ||
.create( document.querySelector( '#editor' ), { | ||
plugins: [ | ||
Enter, Typing, Paragraph, Heading, Undo, Bold, Italic, Heading, List, Image, ImageToolbar, Clipboard, | ||
ImageCaption, ImageStyle, ImageUpload, CKFinderUploadAdapter | ||
], | ||
toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'insertImage' ], | ||
ckfinder: { | ||
// eslint-disable-next-line max-len | ||
uploadUrl: 'https://cksource.com/weuy2g4ryt278ywiue/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json' | ||
} | ||
} ) | ||
.then( editor => { | ||
window.editor = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); |
@@ -24,13 +24,14 @@ /** | ||
sinonXHR = testUtils.sinon.useFakeXMLHttpRequest(); | ||
sinonXHR = testUtils.sinon.useFakeServer(); | ||
return ClassicTestEditor.create( editorElement, { | ||
plugins: [ Image, ImageUpload, CKFinderUploadAdapter ], | ||
ckfinder: { | ||
uploadUrl: 'http://example.com' | ||
} | ||
} ) | ||
.then( newEditor => { | ||
editor = newEditor; | ||
} ); | ||
return ClassicTestEditor | ||
.create( editorElement, { | ||
plugins: [ Image, ImageUpload, CKFinderUploadAdapter ], | ||
ckfinder: { | ||
uploadUrl: 'http://example.com' | ||
} | ||
} ) | ||
.then( newEditor => { | ||
editor = newEditor; | ||
} ); | ||
} ); | ||
@@ -58,5 +59,5 @@ | ||
it( 'crateAdapter method should be registered and have upload and abort methods', () => { | ||
expect( adapter ).to.be.defined; | ||
expect( adapter.upload ).to.be.function; | ||
expect( adapter.abort ).to.be.function; | ||
expect( adapter ).to.not.be.undefined; | ||
expect( adapter.upload ).to.be.a( 'function' ); | ||
expect( adapter.abort ).to.be.a( 'function' ); | ||
} ); | ||
@@ -69,12 +70,13 @@ | ||
return ClassicTestEditor.create( editorElement, { | ||
plugins: [ Image, ImageUpload, CKFinderUploadAdapter ], | ||
} ) | ||
.then( () => { | ||
sinon.assert.calledOnce( warnSub ); | ||
sinon.assert.calledWithExactly( | ||
warnSub, | ||
'ckfinder-upload-adapter-no-config: Please provide "ckfinder.uploadUrl" config option.' | ||
); | ||
} ); | ||
return ClassicTestEditor | ||
.create( editorElement, { | ||
plugins: [ Image, ImageUpload, CKFinderUploadAdapter ], | ||
} ) | ||
.then( () => { | ||
sinon.assert.calledOnce( warnSub ); | ||
sinon.assert.calledWithExactly( | ||
warnSub, | ||
'ckfinder-upload-adapter-no-config: Please provide "ckfinder.uploadUrl" config option.' | ||
); | ||
} ); | ||
} ); | ||
@@ -105,4 +107,2 @@ | ||
it( 'should throw an error on generic request error', () => { | ||
let request; | ||
const promise = adapter.upload() | ||
@@ -112,7 +112,7 @@ .then( () => { | ||
} ) | ||
.catch( ( msg ) => { | ||
.catch( msg => { | ||
expect( msg ).to.equal( 'Cannot upload file: image.jpeg.' ); | ||
} ); | ||
request = sinonXHR.requests[ 0 ]; | ||
const request = sinonXHR.requests[ 0 ]; | ||
request.error(); | ||
@@ -124,3 +124,2 @@ | ||
it( 'should throw an error on error from server', () => { | ||
let request; | ||
const responseError = { | ||
@@ -136,7 +135,7 @@ error: { | ||
} ) | ||
.catch( ( msg ) => { | ||
.catch( msg => { | ||
expect( msg ).to.equal( 'Foo bar baz.' ); | ||
} ); | ||
request = sinonXHR.requests[ 0 ]; | ||
const request = sinonXHR.requests[ 0 ]; | ||
request.respond( 200, { 'Content-Type': 'application/json' }, JSON.stringify( responseError ) ); | ||
@@ -148,3 +147,2 @@ | ||
it( 'should throw a generic error on error from server without message', () => { | ||
let request; | ||
const responseError = { | ||
@@ -158,7 +156,7 @@ error: {} | ||
} ) | ||
.catch( ( msg ) => { | ||
.catch( msg => { | ||
expect( msg ).to.equal( 'Cannot upload file: image.jpeg.' ); | ||
} ); | ||
request = sinonXHR.requests[ 0 ]; | ||
const request = sinonXHR.requests[ 0 ]; | ||
request.respond( 200, { 'Content-Type': 'application/json' }, JSON.stringify( responseError ) ); | ||
@@ -165,0 +163,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 3 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26597
30
513
0
16
0
14
+ Added@ckeditor/ckeditor5-core@0.9.0(transitive)
+ Added@ckeditor/ckeditor5-engine@0.11.0(transitive)
+ Added@ckeditor/ckeditor5-theme-lark@0.9.0(transitive)
+ Added@ckeditor/ckeditor5-ui@0.10.0(transitive)
+ Added@ckeditor/ckeditor5-upload@0.2.0(transitive)
+ Added@ckeditor/ckeditor5-utils@0.10.0(transitive)
- Removed@ckeditor/ckeditor5-core@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-engine@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-upload@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-utils@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-watchdog@43.1.0(transitive)
- Removedlodash-es@4.17.21(transitive)