Etherpad contains a built-in rich text editor called ACE2 (originally the AppJet code editor), which appears to be responsible for managing keyboard shortcuts.
The ace.js file, built-in by default, is used to minimize and therefore is difficult to read in the old version of Etherpad, but you can read the source files directly into the infrastructure/ace part of the source code from which the mini version is made. For more information about this, see ACE2 README . In later versions (at least on etherpad.org), there seems to be a regular ACE2 JS source.
The keyboard shortcut handling code is in ace2_inner.js , inside the handleKeyEvent() function. Based on this, it seems that the shortcuts supported by the ready-made keys are as follows (at the top of the browser shortcuts, such as Cut / Copy / Paste):
- Enter - Relay Emblem Return
- Tab or Shift + Tab - lists of indents or indents for indents
- Ctrl + Z - special cancel EPSpad
- Ctrl + Y - special ether for reprinting
- Ctrl + B - Bold
- Ctrl + I - Italics
- Ctrl + U - underline
- Ctrl + H - delete
- Ctrl + S - Save Changes
Nothing for strikethrough lists or bullet lists, and nothing that looks like a simple extension mechanism for shortcuts, so you might need to clean your hands ;-)
If you have your own Etherpad deployment, the easiest way is to modify the ACE2 source code to handle additional shortcuts, and then re-build the smaller version of ace2.js (as instructed in the README ) if necessary. Here is an example of how to use the Ctrl + S shortcut to switch strikethrough and Ctrl + L to switch the list of markers. A crossed out shortcut disables the built-in browser Save As ... a shortcut that I consider a bonus, but if you do not like it, you can always choose a different key than S.
Paste the following snippet into ace2_inner.js between similar blocks that handle other labels around line 3200:
if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "s" && (evt.metaKey || evt.ctrlKey)) {
If you cannot rebuild the mini version, you can also try to fix it directly using the shortened names. Here is the version of the above snippet for me, although YMMV, I did not check if minimalism is stable and uses the same shortened names each time. Search for "y" (with quotes) to find the shortened version of handleKeyEvent() inside ace.js :
if ((!Cp)&&Cu&&String.fromCharCode(Ct).toLowerCase()=="s"&&(i.metaKey || i.ctrlKey)){G(13);\\ni.preventDefault();c("strikethrough");Cp=true;}if((!Cp)&&Cu&&String.fromCharCode(Ct).toLowerCase()=="l"&&(i.metaKey||i.ctrlKey)){G(9);\\ni.preventDefault();As();Cp=true;}
Finally, if you do not control the deployment of etherpad, you can implement something similar using the GreaseMonkey script built-in browser that fixes the default function handleKeyEvent() . As a starting point for connecting to the editor, try checking out window.pad* objects, such as window.padeditor . For example, select the text in the editor and try in the console:
> window.padeditor.ace.execCommand('bold') > window.padeditor.ace.execCommand('insertunorderedlist')