2 * Plugin designed for test prupose. It add a button (that manage an alert) and a select (that allow to insert tags) in the toolbar.
\r
3 * This plugin also disable the "f" key in the editarea, and load a CSS and a JS file
\r
7 * Get called once this file is loaded (editArea still not initialized)
\r
12 // alert("test init: "+ this._someInternalFunction(2, 3));
\r
13 editArea.load_css(this.baseURL+"css/test.css");
\r
14 editArea.load_script(this.baseURL+"test2.js");
\r
17 * Returns the HTML code for a specific control string or false if this plugin doesn't have that control.
\r
18 * A control can be a button, select list or any other HTML item to present in the EditArea user interface.
\r
19 * Language variables such as {$lang_somekey} will also be replaced with contents from
\r
20 * the language packs.
\r
22 * @param {string} ctrl_name: the name of the control to add
\r
23 * @return HTML code for a specific control or false.
\r
24 * @type string or boolean
\r
26 ,get_control_html: function(ctrl_name){
\r
29 // Control id, button img, command
\r
30 return parent.editAreaLoader.get_button_html('test_but', 'test.gif', 'test_cmd', false, this.baseURL);
\r
32 html= "<select id='test_select' onchange='javascript:editArea.execCommand(\"test_select_change\")' fileSpecific='no'>"
\r
33 +" <option value='-1'>{$test_select}</option>"
\r
34 +" <option value='h1'>h1</option>"
\r
35 +" <option value='h2'>h2</option>"
\r
36 +" <option value='h3'>h3</option>"
\r
37 +" <option value='h4'>h4</option>"
\r
38 +" <option value='h5'>h5</option>"
\r
39 +" <option value='h6'>h6</option>"
\r
46 * Get called once EditArea is fully loaded and initialised
\r
50 ,onload: function(){
\r
55 * Is called each time the user touch a keyboard key.
\r
57 * @param (event) e: the keydown event
\r
58 * @return true - pass to next handler in chain, false - stop chain execution
\r
61 ,onkeydown: function(e){
\r
62 var str= String.fromCharCode(e.keyCode);
\r
63 // desactivate the "f" character
\r
64 if(str.toLowerCase()=="f"){
\r
71 * Executes a specific command, this function handles plugin commands.
\r
73 * @param {string} cmd: the name of the command being executed
\r
74 * @param {unknown} param: the parameter of the command
\r
75 * @return true - pass to next handler in chain, false - stop chain execution
\r
78 ,execCommand: function(cmd, param){
\r
81 case "test_select_change":
\r
82 var val= document.getElementById("test_select").value;
\r
84 parent.editAreaLoader.insertTags(editArea.id, "<"+val+">", "</"+val+">");
\r
85 document.getElementById("test_select").options[0].selected=true;
\r
88 alert("user clicked on test_cmd");
\r
91 // Pass to next handler in chain
\r
96 * This is just an internal plugin method, prefix all internal methods with a _ character.
\r
97 * The prefix is needed so they doesn't collide with future EditArea callback functions.
\r
99 * @param {string} a Some arg1.
\r
100 * @param {string} b Some arg2.
\r
101 * @return Some return.
\r
104 ,_someInternalFunction : function(a, b) {
\r
109 // Adds the plugin class to the list of available EditArea plugins
\r
110 editArea.add_plugin("test", EditArea_test);
\r