diff --git a/modules/keyboard.js b/modules/keyboard.js index ef779a870d..99d19e6be7 100644 --- a/modules/keyboard.js +++ b/modules/keyboard.js @@ -340,6 +340,8 @@ function makeFormatHandler(format) { key: format[0].toUpperCase(), shortKey: true, handler: function(range, context) { + const isFormatEnabled = (Array.isArray(this.quill.formats) && this.quill.formats.indexOf(format) !== -1); + if (!isFormatEnabled) return false; this.quill.format(format, !context.format[format], Quill.sources.USER); } };