Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const commands: ShortcutCommand[] = [
createCommand(Keys.Ctrl | Keys.B, Keys.Meta | Keys.B, toggleBold),
createCommand(Keys.Ctrl | Keys.I, Keys.Meta | Keys.I, toggleItalic),
createCommand(Keys.Ctrl | Keys.U, Keys.Meta | Keys.U, toggleUnderline),
createCommand(Keys.Ctrl | Keys.Z, Keys.Meta | Keys.Z, editor => editor.undo()),
createCommand(Keys.Ctrl | Keys.Y, Keys.Meta | Keys.Shift | Keys.Z, editor => editor.redo()),
createCommand(Keys.Ctrl | Keys.PERIOD, Keys.Meta | Keys.PERIOD, toggleBullet),
createCommand(Keys.Ctrl | Keys.FORWARDSLASH, Keys.Meta | Keys.FORWARDSLASH, toggleNumbering),
createCommand(
Keys.Ctrl | Keys.Shift | Keys.PERIOD,
Keys.Meta | Keys.Shift | Keys.PERIOD,
editor => changeFontSize(editor, FontSizeChange.Increase)
),
createCommand(
Keys.Ctrl | Keys.Shift | Keys.COMMA,
Keys.Meta | Keys.Shift | Keys.COMMA,
editor => changeFontSize(editor, FontSizeChange.Decrease)
),
];
/**
* DefaultShortcut edit feature, provides shortcuts for the following features:
* Ctrl/Meta+B: toggle bold style
* Ctrl/Meta+I: toggle italic style
* Ctrl/Meta+U: toggle underline style
* Ctrl/Meta+Z: undo
* Ctrl+Y/Meta+Shift+Z: redo
* Ctrl/Meta+PERIOD: toggle bullet list
* Ctrl/Meta+/: toggle numbering list
* Ctrl/Meta+Shift+>: increase font size
* Ctrl/Meta+Shift+<: decrease font size