The most thorough documentation I can find of how to add a new keyboard shortcut to TinyMC is at this page: http://www.lifeinsuranceonmyterms.com/other/custom-keyboard-shortcuts-for-tinymce-how-to
It involves adding this code to the main TinyMCE source file, tiny_mce_src.js (and then recompressing):
t.addShortcut([keyboard command], [shortcut name], [command name]);
Is there a way to add a shortcut without hacking the core/TinyMCE?
Update: Specifically, I want to add shortcuts to apply h2/h3/h4 or other TinyMCE button actions to selected text in TinyMCE.
Last time i added a keybord shortcut it was using jQuery.
take a look at jquery.hotkeys plugin which lets you enable keyboard shortcuts with a simple one liner:
update
if you want to check if the TinyMCE editor is active and it has a selected text then here are the functions you need:
now once you have these functions the rest is easy:
I had this problem. And figured it out. Hope it still helps (someone) #Threadnecro
in
functions.php
I add a tinyMCE plugin:the file /js/tinymce.js has:
This adds a code button to the
wysiwyg
editor. And it mapsctrl+k
as hotkey for that action.Sources