From d3cb04f0335b6bb81e8875193199fad35392fe3e Mon Sep 17 00:00:00 2001 From: Chris Montrois Date: Fri, 16 Dec 2016 13:10:32 -0800 Subject: [PATCH] Prevent shortcuts for disabled formats --- modules/keyboard.js | 2 ++ 1 file changed, 2 insertions(+) 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); } };