Skip to content

Instantly share code, notes, and snippets.

@jules0x
Last active March 1, 2020 23:00
Show Gist options
  • Save jules0x/2c54270ec8f3285eb7916deb465368fe to your computer and use it in GitHub Desktop.
Save jules0x/2c54270ec8f3285eb7916deb465368fe to your computer and use it in GitHub Desktop.
# TinyMCE hotkeys to trigger editor actions

#TinyMCE hotkeys

Add 'format' to initalization:

formats: {text_center: {selector: 'p,h1,h2,h3,h4,h5,table', classes: 'text-center'}}

Then add the shortcut in 'setup':

setup: function (ed) {
  ed.addShortcut('ctrl+alt+c', 'text_center', function(){
    ed.formatter.apply('text_center');
  });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment