EditArea documentation

# Main script include

As you have seen it before in installation and configuration, in order to make EditArea work on a webpage, you must include one external javascript file and call an init function for each textarea you want to convert. In thoses examples the file "edit_area_full.js" whas the file included, but in fact there are 5 possible files to include EditArea scripts into your webpage. All thoses files are in the same directory, and they all have advantage and inconvenient.

## edit_area_full.js

> This is the easier file to use for script integration. The file is nearly 100Kb length.

>     <script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.js"></script>

> ### Advantage:

> - The simplest choice.
> - Load the core script in one call to server.

> ### Inconvient:

> - Not designed to allow core script modification.
> - Need to make additional server calls for plugins.

## edit_area_compressor.php

> This php file send in a gzipped file the whole core script to the brower (if the browser has not already an updated version in cache).
> If the source core script files have changed, it take thoses files and merge them into one file. Then it remove all comments, white-spaces, etc... and save it in "edit_area_full.js". It also save a gzip version in "edit_area_full.gz". Then it send the gzip content to the browser (except for IE for which it is not gzipped due to IE bug with compression).

>     <script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_compressor.php"></script>

> ### Advantage:

> - The script is very small if gzip is supported (~25Ko).
> - Designed to allow core script modification.
> - Load the core script in one call to server.

> ### Inconvient:

> - Need PHP to be installed on the server (and allowed to write in editarea directory for disk caching).
> - Need to make additional server calls for plugins.

> If you plan to use "edit_area_compressor.php" be sure that PHP scripts are allowed to write in editarea directory (at the same level than the file "edit_area_compressor.php") for disk caching.

## edit_area_compressor.php?plugins

##### recommanded version

> This include is very similar to "edit_area_compressor.php". The difference is that with "plugins" parameter, the compressor also include the main script of all the plugins in the merged file and also compress them. This will avoid later server calls for plugin main script.
> In this case, the saved files are "edit_area_full_with_plugins.js" and "edit_area_full_with_plugins.gz".

>     <script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_compressor.php?plugins"></script>

> ### Advantage:

> - The script is very small if gzip is supported.
> - Designed to allow core script modification.
> - Load the core script in one call to server.
> - Load plugins script in the same call.

> ### Inconvient:

> - Need PHP to be installed on the server (and allowed to write in editarea directory for disk caching).

> If you plan to use "edit_area_compressor.php" be sure that PHP scripts are allowed to write in editarea directory (at the same level than the file "edit_area_compressor.php") for disk caching.

## edit_area_full.gz

> This is the smaller file to use for script integration. The file is gzipped and is only 20Kb length.

>     <script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.gz"></script>

> ### Advantage:

> - The script is only 20Kb length.
> - Load the core script in one call to server.

> ### Inconvient:

> - Is server dependant: It will work only on servers that will return a "Content-Encoding: gzip" for *.gz files (can work with Apache). So you must test if it work on your server.
> - Not designed to allow core script modification.
> - Need to make additional server calls for plugins.

## edit_area_loader.js

> This is the original loading script of EditArea. Use this one only if you can't use any of the 3 other loading files. There is no code epuration nor gzip compression.

>     <script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_loader.js"></script>

> ### Advantage:

> - Designed to allow core script modification.

> ### Inconvient:

> - Load the core scripts in 12 call to the server.
> - Need to make additional server calls for plugins.