Podświetlanie składni w edytorze XML dzięki editArea. Closes #17. Niestety dla tekstó...
[redakcja.git] / project / static / js / plugins / charmap / charmap.js
1 /**\r
2  * Charmap plugin\r
3  * by Christophe Dolivet\r
4  * v0.1 (2006/09/22)\r
5  * \r
6  *    \r
7  * This plugin allow to use a visual keyboard allowing to insert any UTF-8 characters in the text.\r
8  * \r
9  * - plugin name to add to the plugin list: "charmap"\r
10  * - plugin name to add to the toolbar list: "charmap" \r
11  * - possible parameters to add to EditAreaLoader.init(): \r
12  *              "charmap_default": (String) define the name of the default character range displayed on popup display\r
13  *                                                      (default: "arrows")\r
14  * \r
15  * \r
16  */\r
17    \r
18 var EditArea_charmap= {\r
19         /**\r
20          * Get called once this file is loaded (editArea still not initialized)\r
21          *\r
22          * @return nothing       \r
23          */                     \r
24         init: function(){       \r
25                 this.default_language="Arrows";\r
26         }\r
27         \r
28         /**\r
29          * Returns the HTML code for a specific control string or false if this plugin doesn't have that control.\r
30          * A control can be a button, select list or any other HTML item to present in the EditArea user interface.\r
31          * Language variables such as {$lang_somekey} will also be replaced with contents from\r
32          * the language packs.\r
33          * \r
34          * @param {string} ctrl_name: the name of the control to add      \r
35          * @return HTML code for a specific control or false.\r
36          * @type string or boolean\r
37          */     \r
38         ,get_control_html: function(ctrl_name){\r
39                 switch(ctrl_name){\r
40                         case "charmap":\r
41                                 // Control id, button img, command\r
42                                 return parent.editAreaLoader.get_button_html('charmap_but', 'charmap.gif', 'charmap_press', false, this.baseURL);\r
43                 }\r
44                 return false;\r
45         }\r
46         /**\r
47          * Get called once EditArea is fully loaded and initialised\r
48          *       \r
49          * @return nothing\r
50          */                     \r
51         ,onload: function(){ \r
52                 if(editArea.settings["charmap_default"] && editArea.settings["charmap_default"].length>0)\r
53                         this.default_language= editArea.settings["charmap_default"];\r
54         }\r
55         \r
56         /**\r
57          * Is called each time the user touch a keyboard key.\r
58          *       \r
59          * @param (event) e: the keydown event\r
60          * @return true - pass to next handler in chain, false - stop chain execution\r
61          * @type boolean         \r
62          */\r
63         ,onkeydown: function(e){\r
64                 \r
65         }\r
66         \r
67         /**\r
68          * Executes a specific command, this function handles plugin commands.\r
69          *\r
70          * @param {string} cmd: the name of the command being executed\r
71          * @param {unknown} param: the parameter of the command  \r
72          * @return true - pass to next handler in chain, false - stop chain execution\r
73          * @type boolean        \r
74          */\r
75         ,execCommand: function(cmd, param){\r
76                 // Handle commands\r
77                 switch(cmd){\r
78                         case "charmap_press":\r
79                                 win= window.open(this.baseURL+"popup.html", "charmap", "width=500,height=270,scrollbars=yes,resizable=yes");\r
80                                 win.focus();\r
81                                 return false;\r
82                 }\r
83                 // Pass to next handler in chain\r
84                 return true;\r
85         }\r
86         \r
87 };\r
88 \r
89 // Adds the plugin class to the list of available EditArea plugins\r
90 editArea.add_plugin("charmap", EditArea_charmap);\r