From 8c9676402bf5b60d503f538b633c900df14d43c0 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 10 Jul 2019 09:25:25 +0300 Subject: [PATCH] Switch check from !isMac to isWindows for specificity. Only Windows uses Mod+y, this avoids adding the shortcut to other operating systems (such as Linux or iOS). This adds better support for spoofed user-agents when testing mobile sites on desktop devices. You could also add `|| /Pocket/.test(navigator.platform)` but it really is optional --- packages/tiptap-extensions/src/extensions/History.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tiptap-extensions/src/extensions/History.js b/packages/tiptap-extensions/src/extensions/History.js index 003314af7..1d1448fd4 100644 --- a/packages/tiptap-extensions/src/extensions/History.js +++ b/packages/tiptap-extensions/src/extensions/History.js @@ -15,13 +15,13 @@ export default class History extends Extension { } keys() { - const isMac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false + const isWindows = typeof navigator !== 'undefined' ? /Win/.test(navigator.platform) : false const keymap = { 'Mod-z': undo, 'Shift-Mod-z': redo, } - if (!isMac) { + if (isWindows) { keymap['Mod-y'] = redo }