41.3.1 • Published 3 days ago

@rickx/ckeditor5-upload-adapter v41.3.1

Weekly downloads
-
License
GPL-2.0-or-later
Repository
github
Last release
3 days ago

ckeditor5-upload-adapter

The upload adapter plugin for ckeditor5.

Quick start

First, install the build from npm:

pnpm i @rickx/ckeditor5-upload-adapter
# or
yarn add @rickx/ckeditor5-upload-adapter
# or
npm i @rickx/ckeditor5-upload-adapter

Use ImageUploadAdapter in your application:

import { ImageUploadAdapter } from '@rickx/ckeditor5-upload-adapter'

Add ImageUploadAdapter to your editor:

ClassicEditor
  .create(document.querySelector('#editor'), {
    plugins: [
      /* ..., */
      ImageUploadAdapter, // add it to your plugins array
    ],
    imageUpload: {
      // The URL that the images are uploaded to.
      uploadUrl: 'http://example.com',
      // Enable the XMLHttpRequest.withCredentials property.
      withCredentials: true,
      // Headers sent along with the XMLHttpRequest to the upload server.
      headers: {
        'X-CSRF-TOKEN': 'CSRF-Token',
        'Authorization': 'Bearer <JSON Web Token>',
      },
      // Params sent along with the XMLHttpRequest to the upload server.
      params: {
        foo: 'bar',
        text: new Blob(['Another text'], { type: 'text/plain' })
      }
    },
  })
  .then(/* ... */)
  .catch(/* ... */)

Use CustomUploadAdapter in your application:

import { CustomUploadAdapter } from '@rickx/ckeditor5-upload-adapter'

Add CustomUploadAdapter to your editor:

ClassicEditor
  .create(document.querySelector('#editor'), {
    plugins: [
      /* ..., */
      CustomUploadAdapter, // add it to your plugins array
    ],
    customUpload: {
      onUpload: (file) => {
        return Promise.resolve('http://server/default-size.image.png')
      },
      onAbort: () => {
        console.log('Upload abort')
      }
    }
  })
  .then(/* ... */)
  .catch(/* ... */)

License

Licensed under the terms of GNU General Public License Version 2 or later.

41.3.1

3 days ago

41.3.0

3 days ago

41.2.0

1 month ago

41.1.1

2 months ago

41.0.1

2 months ago

40.2.1

2 months ago

41.2.1

1 month ago

41.1.0

2 months ago

41.0.0

2 months ago

40.2.0-rc.1

2 months ago

40.2.0

2 months ago

1.0.0

2 months ago