Skip to content

uploadcare/uploadcare-ckeditor

Repository files navigation

File Uploader by Uploadcare

This is a plugin for CKEditor v4 providing it to work with Uploadcare Widget.

GitHub release  Uploadcare stack on StackShare

Demo

Check out the basic demo here.

Requirements

CKEditor 4.0+ (not 5).

File Uploader for CKEditor v5 is on its way. Stay tuned.

Install

You can go with either automatic or manual install.

Automatic install

Just add the File Uploader plugin to your CKBuilder.

You can find more info in the CKBuilder docs.

Manual install

Download the latest plugin archive from the release branch or releases page.

Extract the downloaded archive to the plugin directory of your CKEditor installation.

Other options here are either cloning the repo:

git clone -b release [email protected]:uploadcare/uploadcare-ckeditor.git plugins/uploadcare

Or directly loading it in your page:

CKEDITOR.plugins.addExternal('uploadcare', '/absolute/path/to/uploadcare/plugin.js')

You can find more info on manually installing plugins in the CKEditor docs.

Usage

Add uploadcare to the list of your CKEditor plugins and the toolbar. Set your public key. Public keys are used to identify a target Uploadcare project your uploads will go to.

CKEDITOR.replace('editor', {
  extraPlugins: 'uploadcare',
  toolbar: [['Uploadcare', /* Your toolbar items */]],
  uploadcare: {publicKey: 'YOUR_PUBLIC_KEY'},
})

Configuration

Plugin configuration

To apply a custom configuration, initialize the plugin providing additional options:

UPLOADCARE_LOCALE = 'ru' // set a preferred locale if needed

CKEDITOR.replace('editor', {
  extraPlugins: 'uploadcare',
  toolbar: [['Uploadcare', /* your toolbar items */]],
  uploadcare: {
    publicKey: 'YOUR_PUBLIC_KEY', // set your public API key here
    multiple: true, // allow multi-file uploads
    crop: '1:1,4:3', // set crop options when handling images
    /* feel free to add more “object key” options here */
  },
})

Widget configuration

Uploadcare Widget can be deeply customized to suit your UX/UI. You can define allowed upload sources, implement file validation, and more.

Use our live widget sandbox as a starting point and consider checking out the docs on widget configuration and its JavaScript API.

Security issues

If you think you ran into something in Uploadcare libraries which might have security implications, please hit us up at [email protected] or Hackerone.

We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.

Feedback

Issues and PRs are welcome. You can provide your feedback or drop us a support request at [email protected].