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
- id: should contain the id of the textarea that should be converted into an editor
- 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 - 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: false - display: specify when the textarea will be converted into an editor.
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", "help", "save", "load", "new_document")
Default: "search, go_to_line, |, undo, redo, |, select_font, change_smooth_selection, highlight, reset_highlight, |, 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.
Type: String (need to defined a monospaced font)
Default: "monospace"
- 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.
- 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_toogle: define if a toogle button must be added under the editor in order to allow to toogle between the editor and the orginal textarea.
Type: Boolean
Default: true - max_undo: number of undo action allowed
Type: Integer
Default: 20 - 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
- 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 parameters that will an instance of the textarea element. You can update the content of the textarea by using "textarea_ref.value= new_content;".
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 one parameters that will contain the content of the textarea
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.