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:

    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

Creator of Surreal CMS and other web things. Follow me for tweets about JavaScript, CSS, and web programming.