How to use the roosterjs-editor-core.Keys.I function in roosterjs-editor-core

To help you get started, we’ve selected a few roosterjs-editor-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / roosterjs / packages / roosterjs-editor-plugins / lib / ContentEdit / features / shortcutFeatures.ts View on Github external
winKey: number;
    macKey: number;
    action: (editor: Editor) => any;
}

function createCommand(winKey: number, macKey: number, action: (editor: Editor) => any) {
    return {
        winKey,
        macKey,
        action,
    };
}

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)
    ),
];