Projet

Général

Profil

Paste
Télécharger (20,8 ko) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / modules / ckeditor / README.txt @ a5572547

1
TABLE OF CONTENTS
2
-----------------
3
 * Overview
4
 * More Information and License
5
 * Requirements
6
 * Installation Paths
7
 * Installation / Configuration
8
 * Installation Troubleshooting
9
 * Uploading Images and Files
10
 * Installing CKFinder
11
 * Managing Plugins
12
 * Installing Additional Plugins
13
 * Integrating a Plugin with the CKEditor Module (for Plugin Developers)
14
 * Setting up Security Filters
15
 * HTML Filters and Inline Styling
16
 * Integrating a Custom Security Filter with the CKEditor Module (for Developers)
17
 * Upgrading Instructions
18
 * Help & Contribution
19
 * Credits
20

    
21
Overview
22
--------
23
This module allows Drupal to replace textarea fields with CKEditor.
24
CKEditor is an online rich text editor that can be embedded inside web pages.
25
It is a WYSIWYG (What You See Is What You Get) editor which means that the
26
text edited in it looks as similar as possible to the results end users will
27
see after the document gets published. It brings to the Web popular editing
28
features found in desktop word processors such as Microsoft Word and
29
OpenOffice.org Writer. CKEditor is truly lightweight and does not require any
30
kind of installation on the client computer.
31

    
32
More Information and License
33
----------------------------
34
CKEditor - The text editor for the Internet
35
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
36

    
37
Licensed under the terms of the GNU Lesser General Public License:
38
    http://www.opensource.org/licenses/lgpl-license.php
39

    
40
For further information visit:
41
    http://ckeditor.com/
42

    
43
Requirements
44
------------
45
  - Drupal 7.x,
46
  - PHP 5.2 or greater,
47
  - CKEditor 3.4 or greater.
48
    You will need to download CKEditor from the official download site: http://ckeditor.com/download.
49
    It is recommended to always use the latest CKEditor version available.
50

    
51
Installation Paths
52
------------------
53
It is recommended to install the CKEditor for Drupal module in the "sites/all/modules" directory.
54

    
55
When adding the files for standalone CKEditor and CKFinder, you can use one of the following directories:
56
- "sites/all/modules/ckeditor/"
57
- "sites/all/libraries/"
58
and create a "ckeditor" or "ckfinder" directory inside.
59

    
60
The CKEditor module will automatically recognize the proper path to the editor and the file browser.
61

    
62
All installation and configuration instructions in this README file assume that you use the first option and place the CKEditor and CKFinder files in the "sites/all/modules/ckeditor/" directory. If you want to use the "sites/all/libraries/" directory, you will need to adjust the paths given in the instructions accordingly.
63

    
64
Installation / Configuration
65
----------------------------
66
Note: these instructions assume that you install the CKEditor for Drupal module in the
67
      "sites/all/modules" directory (recommended).
68

    
69
   1. Unzip the module files to the "sites/all/modules" directory. It should now
70
      contain a "ckeditor" directory.
71
   2. Download standalone CKEditor from http://ckeditor.com/download. Unzip the
72
      contents of the "ckeditor" directory from the installation package to the
73
      "sites/all/modules/ckeditor/ckeditor" (or "sites/all/libraries/ckeditor") directory.
74
      Note: you can skip uploading the "_samples" and "_source" folders.
75
   3. Enable the module in the "Administration panel > Modules > User Interface" section.
76
   4. Grant permissions for using CKEditor in the
77
      "Administration panel > People > Permissions" section.
78
      Note: In order to enable the file browser, refer to the
79
            "Installing CKFinder" section.
80
   5. Adjust CKEditor profiles in the
81
      "Administration panel > Configuration > Content Authoring > CKEditor" section.
82
      Profiles determine which options are available to users based on the input format system.
83
   6. For the Rich Text Editing to work you also need to configure your filters
84
      for the users that may access Rich Text Editing.
85
      Either grant those users Full HTML access or use the following tags:
86
      <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr>
87
      <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong>
88
      <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code>
89
      <cite> <embed> <object> <param> <strike> <caption> <tbody>
90
      To make copying the list easier, below all tags were placed in one line:
91
      <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption> <tbody>
92
      If you are going to use CKEditor with the Filtered HTML input format,
93
      please refer to the "HTML Filters and Inline Styling" section.
94
   7. To have better control over line breaks, you may disable the line break converter
95
      for a given text format in the "Administration panel > Configuration > Content authoring > Text formats" section (recommended).
96
   8. Modify the ckeditor.config.js file to adjust it to your needs (optional).
97
      Configuration options are described here:
98
      http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
99
      Developer's documentation for CKEditor:
100
      http://docs.cksource.com/CKEditor_3.x/Developers_Guide
101
      WARNING: Remember to clear the browser cache after you have modified any of the JavaScript files.
102
      If you skip this step, you may notice that the browser is ignoring your changes.
103

    
104
Installation Troubleshooting
105
----------------------------
106
If CKEditor does not appear on the page, check if all files were extracted correctly.
107

    
108
The "sites/all/modules/ckeditor/ckeditor/" directory should contain the following files:
109
ckeditor.js, config.js, contents.css
110
and directories: "skins", "themes", "lang", "images".
111

    
112
The correct directory structure is as follows:
113
modules               <dir>
114
   ckeditor           <dir>
115
      ckeditor.module
116
      ckeditor.admin.inc
117
      ...
118
      ckeditor        <dir>
119
         _source      <dir>
120
         images       <dir>
121
         lang         <dir>
122
         plugins      <dir>
123
         skins        <dir>
124
         themes       <dir>
125
         COPY_HERE.txt
126
         ckeditor.js
127
         ...
128

    
129
As noted above, alternatively the "sites/all/libraries/ckeditor" directory can be used.
130
The "libraries" directory is the default path when drush is used to download the editor JavaScript code.
131

    
132
If you are still experiencing problems with your CKEditor installation, scroll down to the "Help & Contribution" section.
133

    
134
Uploading Images and Files
135
--------------------------
136
There are two methods for uploading files:
137
- by using a commercial file browser like CKFinder (http://ckfinder.com), an advanced Ajax file manager;
138
- by using modules like IMCE.
139

    
140
To select a preferred file browser, adjust CKEditor profiles in the
141
"Administration panel > Configuration > Content Authoring > CKEditor" section.
142
In the "File browser settings" section you can choose which file browser will be used for each profile.
143
Note: in order to choose an upload module other than CKFinder, you should install an appropriate Drupal module first.
144

    
145
Installing CKFinder
146
-------------------
147
CKFinder is an Ajax-based file manager created by CKEditor developers: http://ckfinder.com/.
148

    
149
   1. Download CKFinder for PHP: http://ckfinder.com/download
150
   2. Unpack CKFinder to the directory containing the CKEditor module and place it in the
151
      "sites/all/modules/ckeditor/ckfinder" (or "sites/all/libraries/ckfinder") folder.
152
      The correct directory structure is as follows:
153

    
154
      modules               <dir>
155
         ckeditor           <dir>
156
            ckeditor.module
157
            ckeditor.admin.inc
158
            ...
159
            ckeditor        <dir>
160
               _source      <dir>
161
               images       <dir>
162
               ckeditor.js
163
               ...
164
            ckfinder        <dir>
165
               core         <dir>
166
               ckfinder.php
167
               config.php
168
               ...
169

    
170
   3. Grant the "CKFinder access" permission in the "Administration panel > People > Permissions" section.
171
      Note: if you do not see this permission, it means that CKEditor did not find CKFinder
172
      and you have probably uploaded CKFinder into a wrong directory.
173
   4. Open the CKFinder configuration file (ckfinder/config.php) and do the following:
174

    
175
      I) Remove the CheckAuthentication() function:
176
        (do not worry, this function is defined in filemanager.config.php, see below)
177

    
178
        function CheckAuthentication()       <- remove it
179
        {                                    <- remove it
180
           //WARNING : DO NOT simply...      <- remove it
181
           ...                               <- remove it
182
           return false;                     <- remove it
183
        }                                    <- remove it
184

    
185
      II) Add:
186

    
187
        - for CKFinder installed in the "sites/all/modules/ckeditor/ckfinder" directory:
188
        require_once '../../../../includes/filemanager.config.php';
189

    
190
        - for CKFinder installed in the "sites/all/libraries/ckfinder" directory:
191
        require_once '../../../../../modules/ckeditor/includes/filemanager.config.php';
192

    
193
        straight below the following line:
194

    
195
        $baseDir = resolveUrl($baseUrl);
196

    
197
   5. Open the Drupal settings file (sites/default/settings.php) and do the following:
198

    
199
      I) Uncomment the $base_url variable and set the base URL of your website (without the trailing slash).
200

    
201
      II) Uncomment the $cookie_domain variable and set the domain name of your website.
202

    
203
   6. Select CKFinder as a preferred file browser in the
204
      "Administration panel > Configuration > Content Authoring > CKEditor" section
205
      (for a selected CKEditor profile scroll down to the "File browser settings" section).
206
      In the "File browser settings" section you may also change destination folders for files uploaded with CKFinder.
207

    
208
Managing Plugins
209
----------------
210
If you want to manage CKEditor plugins for a profile, go to the "Administration panel > Configuration > Content Authoring > CKEditor" section. This section lets you choose plugins relevant for each CKEditor profile from a list.
211
In order to activate a plugin, go to the "Editor appearance > Plugins" section and select the checkbox next to a required plugin name.
212

    
213
If a plugin contains toolbar buttons, you will need to drag and drop them to an appropriate toolbar position by using the toolbar wizard. If this is the case, the button should be added to the CKEditor toolbar by using the method described below:
214
- Enter the "Editor appearance > Toolbar" section.
215
- Check whether the plugin button that you want to use is present in the "Used buttons" sections. If not, find it in the "All buttons" section and drag and drop to the toolbar configuration from the "Used buttons" section.
216

    
217
Alternatively, if you turned off the toolbar wizard and prefer to enter the toolbar configuration manually, you will need to add the plugin button by yourself by appending it to your toolbar definition code.
218

    
219
Please note that some plugins require installing additional modules to work correctly.
220

    
221
Installing Additional Plugins
222
-----------------------------
223
The installation process is based on placing the plugin folder in the "plugins" directory of the CKEditor module (usually "sites/all/modules/ckeditor").
224
The plugin folder should contain at least the plugin.js file that is responsible for the plugin logic.
225
The plugin description will be displayed in the "Administration panel" if it is added to the plugin.js file by using the following special comment:
226
/**
227
 * @file Plugin description
228
 */
229
Hint: The "Administration panel" automatically detects the toolbar buttons available in the plugin and adds them to the toolbar wizard.
230

    
231
A plugin can be enabled by using the same method as described above - see the "Managing Plugins" section.
232

    
233
Integrating a Plugin with the CKEditor Module (for Plugin Developers)
234
---------------------------------------------------------------------
235
Integrating your application with the CKEditor module by adding a plugin works through a special hook.
236
An example of the hook is shown below:
237

    
238
function MODULENAME_ckeditor_plugin() {
239
  return array(
240
        'plugin_name' => array(
241
            // Plugin name.
242
            'name' => 'plugin_name',
243
            // Plugin description - it will be displayed in the plugins management section of the profile settings.
244
            'desc' => t('Plugin description'),
245
            // The full path to the CKEditor plugin directory, trailing slash included.
246
            'path' => drupal_get_path('module', 'my_module') . '/plugin_dir/',
247
            // Plugin buttons definition (optional).
248
            'buttons' => array(
249
              'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
250
              'button_name' => array('label' => 'Button label', 'icon' => '/path/to/icon/image'),
251
              ...
252
            )
253
        )
254
    );
255
}
256
Please note that MODULENAME in the code above is the name of the module.
257

    
258
After the hook is used the plugin will automatically appear on the plugin list for each CKEditor profile where you will be able to enable it as described in the "Managing Plugins" section.
259

    
260
Setting up Security Filters
261
---------------------------
262
The CKEditor security system protects you from executing malicious code that is already in your database. In plain textareas database content is harmless because it is not executed, but a WYSIWYG editor interprets HTML like a Web browser and thus the content needs to be filtered before it is loaded.
263

    
264
In order to configure the security filters, go to the "Administration panel > Configuration > Content Authoring > CKEditor" section. Enter the profile configuration and go to the "Security" section.
265

    
266
The "Security" section lists all the security filters that are currently supported by the CKEditor for Drupal module along with their status for each text format.
267

    
268
The CKEditor for Drupal module has built-in support for some popular security filter modules which you will need to download and install by yourself first. Visit the official websites for each module in order to get the files and find installation and configuration instructions.
269

    
270
When a filter module is installed, you will be able to configure its security filters and enable for a given text format. The list of active text formats is displayed in the "Security" section along with the links that will take you to the "Administration panel > Configuration > Content authoring > Text formats" section where you will be able to configure the filters for each of the text formats. The filters will then be run on the content during the filtering process.
271

    
272
The "Security Settings" option in the "Security" section lets you choose whether to always run the security filters on CKEditor content (recommended and default option) or run them only when CKEditor is set to start automatically. If you change this setting to only run the filters when CKEditor starts automatically, you will not be protected when toggling manually between a plain textarea and the WYSIWYG editor.
273

    
274
The following security filter modules are currently supported:
275
 - HTML Purifier - http://drupal.org/project/htmlpurifier
276
 - htmLawed - http://drupal.org/project/htmLawed
277
 - Htmltidy - http://drupal.org/project/htmltidy
278
 - WYSIWYG Filter - http://drupal.org/project/wysiwyg_filter
279

    
280
HTML Filters and Inline Styling
281
-------------------------------
282
In the "Administration panel > Configuration > Content Authoring > Text fromats" section, Filtered HTML is the default filter.
283
Due to security reasons enabling Full HTML is only an option for trusted users.
284

    
285
To take full advantage of using CKEditor you can extend the list of allowed tags in the HTML filter that is enabled in the Filtered HTML input format. If you do not do this, you may notice that a page created in CKEditor looks different after saving.
286

    
287
Unfortunately, even if you extend the list of allowed tags, one problem still remains: Filtered HTML not only strips disallowed tags, but also strips inline style definitions. It basically means that you are unable to apply a different font color, size or family, align images etc. using CKEditor out of the box.
288

    
289
You can solve this problem by creating another input format that will work in a similar way as Filtered HTML (will only allow specified tags), but in a much better way - i.e. it will not strip inline styles that CKEditor is using when
290
formatting text or images after the page is saved. To create such an input format, you will need an HTML filter. See the list of HTML filter modules that are supported by the CKEditor module in the "Setting up Security Filters" section above.
291

    
292
It is up to you to decide which one to use. Just make sure that you will only allow to use proper inline styles, tags, and attributes.
293

    
294
Integrating a Custom Security Filter with the CKEditor Module (for Developers)
295
------------------------------------------------------------------------------
296
Integrating your application with the CKEditor module by adding a security filter works through a special hook.
297
An example of the hook is shown below:
298

    
299
function MODULENAME_ckeditor_security_filter() {
300
    return array(
301
        'security_filter_name' => array(
302
            // Security filter title - it would be displayed in the "Security > Security filters" section of profile settings.
303
            'title' => t('Security filter title'),
304
            // Security filter description - it would be displayed in the "Security > Security filters" section of profile settings.
305
            'description' => t('Security filter description'),
306
        )
307
    );
308
}
309
Please note that MODULENAME in the code above is the name of the module.
310

    
311
After the hook is used the security filter will automatically appear on the filters list for each CKEditor profile where you will be able to enable it as described in the "Setting up Filters" section.
312

    
313
Upgrading Instructions
314
----------------------
315
This instruction assumes that you are upgrading the CKEditor module [M] and CKEditor (the editor) [E] at the same time.
316
Instructions specific for module upgrades are tagged with [M]. Steps that must be taken when upgrading CKEditor (the editor) are marked with [E].
317

    
318
   1. [M] Download the latest version of the CKEditor module from http://drupal.org/project/ckeditor (it is advised to read the release notes before going further).
319
   2. [E] Download the latest version of CKEditor from http://ckeditor.com/download (it is advised to read the "What's New" page before going further: http://ckeditor.com/whatsnew).
320
   3. [M] Back up your database.
321
   4. [EM] Place the site in the "Off-line" mode to let the database updates run without interruption and to avoid displaying errors to end users of the site.
322
   5. [E] If you are using CKFinder, make sure you will not delete it, and move it to a safe place.
323
   6. [E] If you introduced any changes (e.g. custom toolbar definitions etc.) in the sites/all/modules/ckeditor/ckeditor.config.js file (or sites/all/modules/ckeditor/ckeditor/config.js), write down your changes and add them again after uploading new files.
324
          In general, try to avoid making any changes to CKEditor's config.js file and add everything to ckeditor.config.js.
325
   7. Delete old files:
326
      [EM]* Simply remove the "modules/ckeditor" directory if upgrading both the editor and the module.
327
      [M] If you are upgrading the module only, remember to leave the "modules/ckeditor/ckeditor" directory untouched.
328
      [E] When upgrading the editor, remove the contents of the "modules/ckeditor/ckeditor" directory only.
329
      WARNING: If you do not remove old files and just rename the "ckeditor" directory instead (e.g. to "ckeditor_old"), Drupal may use the module from the renamed "ckeditor_old" directory.
330
   8. [M] Upload the CKEditor module (extracted files and folders) to the "sites/all/modules" directory.
331
   9. [E] Upload standalone CKEditor (extracted files and folders from the "ckeditor" directory) to the "sites/modules/ckeditor/ckeditor" directory (i.e. where the COPY HERE.txt file exists).
332
   10. [E] Restore the CKFinder  files from where you copied them (see step 5).
333
   11. [E] Apply your modifications to default configuration in the ckeditor.config.js file (see step 6).
334
   12. [M] Run update.php.
335
   13. [EM] Put the site back online.
336

    
337
Help & Contribution
338
-------------------
339
If you are looking for more information, have any trouble with the configuration of the module
340
or if you found an issue, please visit the official project page:
341
  http://drupal.org/project/ckeditor
342

    
343
Having problems? Take a look at the list of common problems when installing CKEditor:
344
  http://docs.cksource.com/CKEditor_for_Drupal/Troubleshooting
345

    
346
Learn how to adjust CKEditor to your theme and configure the spellchecker:
347
  http://docs.cksource.com/CKEditor_for_Drupal/Tricks
348

    
349
If you would like to help in the development of the module, we encourage you to join our team.
350
Any help will be greatly appreciated!
351

    
352
Credits
353
-------
354
 - CKEditor for Drupal is currently maintained by the CKEditor team and Jorrit Schippers.
355
     http://ckeditor.com/
356

    
357
 - CKEditor - The text editor for the Internet
358
     Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
359
     http://cksource.com/