EditArea documentation

# Configuration reference

This document is the index/reference page for all available core configuration options in EditArea.

## Configuration options

All configuration options below is to be placed within the init JavaScript call.

- Needed option
  - id: should contain the id of the textarea that should be converted into an editor
    Type: String
    Default: null
- General
  - language: should contain a code of the language pack to be used for translation. If EditArea doesn't have a language pack for your language you could always write your own and contribute this back to this project by uploading it as a Patch at SourceForge.
    Type: String
    Default: "en"
  - syntax: should contain a code of the syntax definition file that must be used for the highlight mode.
    Type: String
    Default: ""
  - start_highlight: set if the editor should start with highlighted syntax displayed.
    Type: Boolean
    Default: false
  - is_multi_files: determine if the editor load the content of the textarea (false) or if it wait for an openFile() call for allowing file editing.
    Type: Boolean
    Default: false
  - min_width: define the minimum width of the editor
    Type: Integer
    Default: 400
  - min_height: define the minimum height of the editor
    Type: Integer
    Default: 100
  - allow_resize: define one with axis the editor can be resized by the user.
    Type: String ("no" (no resize allowed), "both" (x and y axis), "x", "y")
    Default: "both"
  - allow_toggle: define if a toggle button must be added under the editor in order to allow to toggle between the editor and the orginal textarea.
    Type: Boolean
    Default: true
  - plugins: a comma separated list of plugins to load.
    Type: String
    Default: ""
  - browsers: define if the editor must be loaded only when the user navigotr is known to be a working one, or if it will be loaded for all navigators.
    Type: String ("all" or "known")
    Default: "known"
  - display: specify when the textarea will be converted into an editor. If set to "later", the toogle button will be displayed to allow later conversion.
    Type: String ("onload" or "later")
    Default: "onload"
  - toolbar: define the toolbar that will be displayed, each element being separated by a ",".
    Type: String (combinaison of: "|", "*", "search", "go_to_line", "undo", "redo", "change_smooth_selection", "reset_highlight", "highlight", "word_wrap", "help", "save", "load", "new_document", "syntax_selection")
    "|" or "separator" make appears a separator in the toolbar.
    "*" or "return" make appears a line-break in the toolbar
    Default: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help"
  - begin_toolbar: toolbar button list to add before the toolbar defined by the "toolbar" option.
    Type: String (cf. "toolbar" option)
    Default: ""
  - end_toolbar: toolbar button list to add after the toolbar defined by the "toolbar" option.
    Type: String (cf. "toolbar" option)
    Default: ""
  - font_size: define the font-size used to display the text in the editor.
    Type: Integer
    Default: 10
  - font_family: define the font-familly used to display the text in the editor. (eg: "monospace" or "verdana,monospace"). Opera will always use "monospace".
    Type: String
    Default: "monospace"
  - cursor_position: define if the cursor should be placed where it was in the textarea before replacement (auto) or at the beginning of the file (begin).
    Type: String ("begin" or "auto")
    Default: "begin"
  - gecko_spellcheck: allow to disable/enable the Firefox 2 spellchecker
    Type: Boolean
    Default: false
  - max_undo: number of undo action allowed
    Type: Integer
    Default: 20
  - fullscreen: determine if EditArea start in fullscreen mode or not
    Type: Boolean
    Default: false
  - is_editable: determine if EditArea display only the highlighted syntax (no edition possiblities, no toolbars). It's possible to switch the editable mode whenever you want (code example for a toggle edit mode: editAreaLoader.execCommand('editor_id', 'set_editable', !editAreaLoader.execCommand('editor_id', 'is_editable'));).
    Type: Boolean
    Default: true
  - word_wrap: determine if the text will be automatically wrapped to the next line when it reach the end of a line. This is linked ot the word_wrap icon available in the toolbar.
    Type: Boolean
    Default: false
  - replace_tab_by_spaces: define the number of spaces that will replace tabulations (\t) in text. If tabulation should stay tabulation, set this option to false.
    Type: Integer (or false)
    Default: false
  - debug: used to display some debug information into a newly created textarea. Can be usefull to display trace info in it if you want to modify the code.
    Type: Boolean
    Default: false
- Callback
  - load_callback: the function name that will be called when the user will press the "load" button in the toolbar. This function will reveice one parameter that will be the id of the textarea. You can update the content of the textarea by using "editAreaLoader.setValue(the_id, new_value);".
    Type: String
    Default: ""
  - save_callback: the function name that will be called when the user will press the "save" button in the toolbar. This function will reveice two parameters, the first being the id of the textarea and the second containing the content of the textarea.
    Type: String
    Default: ""
  - change_callback: the function name that will be called when the onchange event of the textarea of EditArea will be triggered. This function will reveice one parameter that will be the id of the textarea. Will be triggered only is EditArea is displayed.
    Type: String
    Default: ""
  - submit_callback: the function name that will be called when the form containing the EditArea will be submitted. This function will reveice one parameter that will be the id of the textarea. Will be triggered regardless the state of EditArea (displayed or not).
    Type: String
    Default: ""
  - EA_init_callback: the function name that will be called just after the editAreaLoader.init() function, once EditAreaLoader will be initalized but still not displayed. This function will receive one parameter that will be the id of the textarea.
    Type: String
    Default: ""
  - EA_delete_callback: the function name that will be called when EditArea will be destroyed regardless the fact that it has been displayed or not. This function will reveice one parameter that will be the id of the textarea.
    Type: String
    Default: ""
  - EA_toggle_on_callback: the function name that will be called when EditArea will be toogled on for. This function will reveice one parameter that will be the id of the textarea.
    Type: String
    Default: ""
  - EA_toggle_off_callback: the function name that will be called when EditArea will be toggled off. This function will reveice one parameter that will be the id of the textarea.
    Type: String
    Default: ""
  - EA_load_callback: the function name that will be called when EditArea will be displayed for the first time. This function will reveice one parameter that will be the id of the textarea.
    Type: String
    Default: ""
  - EA_unload_callback: the function name that will be called when EditArea will be destroyed (if it have been displayed at least one time). This function will reveice one parameter that will be the id of the textarea.
    Type: String
    Default: ""
  - EA_file_switch_on_callback: the function name that will be called when the tabulation of the file will be selected. This function will reveice one parameter that will be an associative array containing all file's infos.
    Type: String
    Default: ""
  - EA_file_switch_off_callback: the function name that will be called when the tabulation of the file will be blur (the file was selected, and another file receive focus). This function will reveice one parameter that will be an associative array containing all file infos.
    Type: String
    Default: ""
  - EA_file_close_callback: the function name that will be called when the tabulation of a file will be closed. This function will reveice one parameter that will be an associative array containing all file infos. If the callback function return false, the file won't be closed.
    Type: String
    Default: ""

## Initialization of EditArea

In order to initialize EditArea the following code must be placed within HEAD element of a document. The following example is configurated to convert the TEXTAREA element which has "textarea_1" as id into editor when the page loads. The "id" option is the only obligatory option.

    <html>
    <head>
    <script language="javascript" type="text/javascript" src="/editarea/edit_area/edit_area_full.js"></script>
    <script language="javascript" type="text/javascript">
    editAreaLoader.init({
    	id : "textarea_1"		// textarea id
    	,syntax: "css"			// syntax to be uses for highgliting
    	,start_highlight: true		// to display with highlight mode on start-up
    });
    </script>
    </head>

See the include document to learn more about the way to use the best script include.

If you want to convert several textarea on your webpage, just call several time the init function with a different id parameter.