diff --git a/docs/APIReference-Editor.md b/docs/APIReference-Editor.md index 76dc54f..190430f 100644 --- a/docs/APIReference-Editor.md +++ b/docs/APIReference-Editor.md @@ -245,10 +245,21 @@ onTab?: (e: SyntheticKeyboardEvent) => void onUpArrow?: (e: SyntheticKeyboardEvent) => void ``` +#### onRightArrow +``` +onRightArrow?: (e: SyntheticKeyboardEvent) => void +``` + #### onDownArrow ``` onDownArrow?: (e: SyntheticKeyboardEvent) => void ``` + +#### onLeftArrow +``` +onLeftArrow?: (e: SyntheticKeyboardEvent) => void +``` + ### Mouse events ### onFocus diff --git a/src/component/base/DraftEditorProps.js b/src/component/base/DraftEditorProps.js index 9b5d1f6..0631fa5 100644 --- a/src/component/base/DraftEditorProps.js +++ b/src/component/base/DraftEditorProps.js @@ -156,7 +156,9 @@ export type DraftEditorProps = { onEscape?: (e: SyntheticKeyboardEvent<>) => void, onTab?: (e: SyntheticKeyboardEvent<>) => void, onUpArrow?: (e: SyntheticKeyboardEvent<>) => void, + onRightArrow?: (e: SyntheticKeyboardEvent<>) => void, onDownArrow?: (e: SyntheticKeyboardEvent<>) => void, + onLeftArrow?: (e: SyntheticKeyboardEvent<>) => void, onBlur?: (e: SyntheticEvent<>) => void, onFocus?: (e: SyntheticEvent<>) => void, diff --git a/src/component/handlers/edit/editOnKeyDown.js b/src/component/handlers/edit/editOnKeyDown.js index 1e95d60..4cb1698 100644 --- a/src/component/handlers/edit/editOnKeyDown.js +++ b/src/component/handlers/edit/editOnKeyDown.js @@ -109,9 +109,15 @@ function editOnKeyDown(editor: DraftEditor, e: SyntheticKeyboardEvent<>): void { case Keys.UP: editor.props.onUpArrow && editor.props.onUpArrow(e); return; + case Keys.RIGHT: + editor.props.onRightArrow && editor.props.onRightArrow(e); + return; case Keys.DOWN: editor.props.onDownArrow && editor.props.onDownArrow(e); return; + case Keys.LEFT: + editor.props.onLeftArrow && editor.props.onLeftArrow(e); + return; case Keys.SPACE: // Handling for OSX where option + space scrolls. if (isChrome && isOptionKeyCommand(e)) {