in blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/htmlarea/htmlarea.js [1641:1726]
HTMLArea.prototype._editorEvent = function(ev) {
var editor = this;
var keyEvent = (HTMLArea.is_ie && ev.type == "keydown") || (ev.type == "keypress");
if (keyEvent) {
for (var i in editor.plugins) {
var plugin = editor.plugins[i].instance;
if (typeof plugin.onKeyPress == "function") plugin.onKeyPress(ev);
}
}
if (keyEvent && ev.ctrlKey) {
var sel = null;
var range = null;
var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase();
var cmd = null;
var value = null;
switch (key) {
case 'a':
if (!HTMLArea.is_ie) {
// KEY select all
sel = this._getSelection();
sel.removeAllRanges();
range = this._createRange();
range.selectNodeContents(this._doc.body);
sel.addRange(range);
HTMLArea._stopEvent(ev);
}
break;
// simple key commands follow
case 'b': cmd = "bold"; break;
case 'i': cmd = "italic"; break;
case 'u': cmd = "underline"; break;
case 's': cmd = "strikethrough"; break;
case 'l': cmd = "justifyleft"; break;
case 'e': cmd = "justifycenter"; break;
case 'r': cmd = "justifyright"; break;
case 'j': cmd = "justifyfull"; break;
case 'z': cmd = "undo"; break;
case 'y': cmd = "redo"; break;
case 'v': cmd = "paste"; break;
case '0': cmd = "killword"; break;
// headings
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
cmd = "formatblock";
value = "h" + key;
if (HTMLArea.is_ie) {
value = "<" + value + ">";
}
break;
}
if (cmd) {
// execute simple command
this.execCommand(cmd, false, value);
HTMLArea._stopEvent(ev);
}
}
/*
else if (keyEvent) {
// other keys here
switch (ev.keyCode) {
case 13: // KEY enter
// if (HTMLArea.is_ie) {
this.insertHTML("<br />");
HTMLArea._stopEvent(ev);
// }
break;
}
}
*/
// update the toolbar state after some time
if (editor._timerToolbar) {
clearTimeout(editor._timerToolbar);
}
editor._timerToolbar = setTimeout(function() {
editor.updateToolbar();
editor._timerToolbar = null;
}, 50);
};