UNPKG

rich-text-editor

Version:
17 lines (16 loc) 984 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.redoShortcut = exports.undoShortcut = exports.getCmdOrCtrlLabel = exports.isMac = void 0; exports.isMatch = isMatch; function isMatch(event, shortcut) { return (event.key.toLowerCase() === shortcut.key.toLowerCase() && !!event.metaKey === !!shortcut.meta && !!event.ctrlKey === !!shortcut.ctrl && !!event.shiftKey === !!shortcut.shift); } const isMac = () => { var _a; return (_a = navigator === null || navigator === void 0 ? void 0 : navigator.platform.startsWith('Mac')) !== null && _a !== void 0 ? _a : false; }; exports.isMac = isMac; const getCmdOrCtrlLabel = () => ((0, exports.isMac)() ? 'Cmd' : 'Ctrl'); exports.getCmdOrCtrlLabel = getCmdOrCtrlLabel; exports.undoShortcut = (0, exports.isMac)() ? { meta: true, key: 'z' } : { ctrl: true, key: 'z' }; exports.redoShortcut = (0, exports.isMac)() ? { meta: true, shift: true, key: 'z' } : { ctrl: true, key: 'y' };