|
1 | | -# Uploadcare CKEDITOR Plugin |
| 1 | +# Uploadcare CKEditor Plugin |
2 | 2 |
|
3 | | -This is a plugin for [CKEDITOR][4] to work with [Uploadcare][1]. |
| 3 | +This is a plugin for [CKEditor][3] to work with [Uploadcare][1]. |
4 | 4 |
|
5 | | -It's based on a [uploadcare-php][3] library. |
| 5 | +## Demo |
6 | 6 |
|
7 | | -## Requirements |
8 | | - |
9 | | -- CKEDITOR 4.0+ |
10 | | - |
11 | | -## Optional for PHP version. |
| 7 | +Minimalistic demo can be found [here][7]. |
12 | 8 |
|
13 | | -- [iframedialog][5] plugin for CKEDITOR |
14 | | -- PHP 5.2+ |
15 | | -- php-curl |
| 9 | +## Requirements |
16 | 10 |
|
17 | | -**Note!** PHP implementation is optional by now and we higly recommend not to use it. |
| 11 | +CKEditor 4.0+ |
18 | 12 |
|
19 | 13 | ## Install |
20 | 14 |
|
21 | | -**Warning**: You **must** enable "Automatic file storing" in your account settings. |
22 | | -Please follow https://uploadcare.com/accounts/settings/ to enable feature. |
23 | | - |
24 | | -Clone plugin from git to your plugins directory: |
25 | | - |
26 | | - git clone git://github.com/uploadcare/uploadcare-ckeditor.git plugins/uploadcare --recursive |
| 15 | +Add [plugin](http://ckeditor.com/addon/uploadcare) to CKBuilder or |
| 16 | +clone plugin from git to your plugins directory: |
27 | 17 |
|
28 | | -Initialize a CKEDITOR plugin with additional params: |
| 18 | + git clone git://github.com/uploadcare/uploadcare-ckeditor.git plugins/uploadcare |
29 | 19 |
|
30 | | - <script> |
31 | | - UPLOADCARE_PUBLIC_KEY = "demopublickey"; //set publick key for Uploadcare |
32 | | - UPLOADCARE_LOCALE = 'ru'; //set locale if you wish |
33 | | - CKEDITOR.replace( 'editor1', { |
34 | | - extraPlugins: 'uploadcare', // this will enable plugin |
35 | | - toolbar: [ |
36 | | - [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Uploadcare' ] |
37 | | - ] |
38 | | - }); |
| 20 | +## Configure |
39 | 21 |
|
40 | | - </script> |
| 22 | +Initialize a CKEditor plugin with additional params: |
41 | 23 |
|
42 | | -## PHP (Optional) |
| 24 | +```javascript |
| 25 | +UPLOADCARE_PUBLIC_KEY = "demopublickey"; // set public key for Uploadcare |
| 26 | +UPLOADCARE_LOCALE = 'ru'; // set locale if you wish |
| 27 | +CKEDITOR.replace( 'editor1', { |
| 28 | + extraPlugins: 'uploadcare', // this will enable plugin |
| 29 | + toolbar: [ |
| 30 | + // add Uploadcare button to toolbar, e.g.: |
| 31 | + ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Uploadcare'] |
| 32 | + ] |
| 33 | +}); |
| 34 | +``` |
43 | 35 |
|
44 | | -Install iframedialog plugin. |
| 36 | +You can heavily customize widget behavior, i.e. file sources, file validation and much more, please |
| 37 | +read Uploadcare [widget][5] and [javascript API][6] documentation. |
45 | 38 |
|
46 | | -Find a "config.php" file inside plugin directory and edit it: |
| 39 | +## File Autostore |
47 | 40 |
|
48 | | - <?php |
49 | | - define('UC_PUBLIC_KEY', 'demopublickey'); |
50 | | - define('UC_SECRET_KEY', 'demoprivatekey'); |
| 41 | +"Automatic file storing" **should** be enabled in your project settings. |
| 42 | +Please follow https://uploadcare.com/dashboard/ to ensure. |
51 | 43 |
|
52 | | -Initialize a CKEDITOR plugin: |
53 | | - |
54 | | - <script> |
55 | | - UPLOADCARE_PUBLIC_KEY = "demopublickey"; //set publick key for Uploadcare |
56 | | - UPLOADCARE_LOCALE = 'ru'; //set locale if you wish |
57 | | - CKEDITOR.replace( 'editor1', { |
58 | | - extraPlugins: 'uploadcare,iframedialog', // this will enable plugin. Iframedialog must be enabled in this case! |
59 | | - USE_PHP: true, //this will enable outdated PHP dialog |
60 | | - toolbar: [ |
61 | | - [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Uploadcare' ] |
62 | | - ] |
63 | | - }); |
64 | | - |
65 | | - </script> |
66 | | - |
67 | | -PHP Version provides an outdated custom dialog. This dialog is used to store files and images and |
68 | | -provides some additional image operations. |
| 44 | +If you do not want to enable "Autostore", you can try to use *deprecated* [php-based version][4] |
69 | 45 |
|
70 | 46 | ## Usage |
71 | 47 |
|
72 | | -### if USE_PHP = false |
73 | | - |
74 | 48 | 1. Press "Uploadcare" button. |
75 | 49 | 2. Select a file to upload and press "Upload" |
76 | 50 | 3. Wait for file to be uploaded. |
77 | 51 | 4. Crop an image as you wish. |
78 | | -5. Press "Upload" again. A cropped image will be available inside editor. |
| 52 | +5. Click "Done". A cropped image will be available inside editor. |
79 | 53 |
|
80 | | -### If USE_PHP = true |
| 54 | +## Feedback |
81 | 55 |
|
82 | | -1. Press "Uploadcare" button. |
83 | | -2. Select a file to upload. |
84 | | -3. Wait for file to be uploaded. An "Uploadcare" icon will show upload progress. |
85 | | -4. Change any parameters you like. |
86 | | -5. Press "Insert" and an image will be available inside editor. |
87 | | - |
88 | | -[1]: http://uploadcare.com/ |
89 | | -[2]: https://uploadcare.com/documentation/reference/basic/cdn.html |
90 | | -[3]: https://github.com/uploadcare/uploadcare-php |
91 | | -[4]: http://www.ckeditor.com |
92 | | -[5]: http://www.ckeditor.com/addon/iframedialog |
| 56 | +Send any feedback or request support at [email protected] |
| 57 | + |
| 58 | +[1]: https://uploadcare.com/ |
| 59 | +[2]: https://uploadcare.com/documentation/cdn/ |
| 60 | +[3]: http://ckeditor.com |
| 61 | +[4]: https://github.com/uploadcare/uploadcare-ckeditor/tree/php-dialog |
| 62 | +[5]: https://uploadcare.com/documentation/widget/ |
| 63 | +[6]: https://uploadcare.com/documentation/javascript_api/ |
| 64 | +[7]: https://uploadcare.com/demos/ckeditor/ |
0 commit comments