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