@slate-editor/font-size-plugin
Version:
SlateJS font size mark plugin.
27 lines (18 loc) • 894 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = require('@slate-editor/utils');
var _FontSizeUtils = require('./FontSizeUtils');
var FontSizeKeyboardShortcut = function FontSizeKeyboardShortcut(event, change, editor, options) {
var changeState = editor.props.changeState;
var initialFontSize = options.initialFontSize;
var modShift = _utils.keyboardEvent.isMod(event) && event.shiftKey;
var isDecrease = modShift && event.key === ',';
var isIncrease = modShift && event.key === '.';
var fontSize = initialFontSize;
if (isDecrease) return (0, _FontSizeUtils.fontSizeDecrease)({ change: change, fontSize: fontSize, changeState: changeState });
if (isIncrease) return (0, _FontSizeUtils.fontSizeIncrease)({ change: change, fontSize: fontSize, changeState: changeState });
return;
};
exports.default = FontSizeKeyboardShortcut;