Disabling the underline shortcut in TinyMCE 4.x

It's easy to remove the underline button from TinyMCE's interface, but clever users can still use keyboard shortcuts (CTRL+U / CMD+U) to throw in a nasty underline here and there. Here's one way to disable it once and for all.

Just throw the following into your TinyMCE init:

tinymce.init({
    ...
    formats: {
        underline: {}
    }
});

This overrides the underline format so, even if you use the shortcut, nothing will happen. Just make sure you also remove the underline button from the UI so you don't confuse users.

Author avatar

About the author

New Hampshirite building web apps in Florida. Creator of Surreal CMS, Postleaf, and DirtyMarkup.

Need to get in touch? Catch me on Twitter.