Skip to content

Commit

Permalink
Add onCursorChange property inorder to make custom actions based on c…
Browse files Browse the repository at this point in the history
…ursor position
  • Loading branch information
sujith-p-s committed Jun 30, 2022
1 parent 906ea47 commit 4e96c4f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/GherkinEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const GherkinEditor = React.forwardRef((props, ref) => {
showGutter,
theme,
toolbarContent,
uniqueId
uniqueId,
onCursorChange
} = props

const setGherkinDialect = setGherkinDialectFunctions[mode] || setDialect
Expand Down Expand Up @@ -203,6 +204,7 @@ const GherkinEditor = React.forwardRef((props, ref) => {
theme={theme}
value={initialValue}
name={uniqueId}
onCursorChange={onCursorChange}
editorProps={{ $blockScrolling: true }}
setOptions={options}
height={`${height}px`}
Expand All @@ -229,6 +231,7 @@ GherkinEditor.propTypes = {
onChange: PropTypes.func,
onSubmit: PropTypes.func,
autoCompleteFunction: PropTypes.func,
onCursorChange: PropTypes.func,
onLanguageChange: PropTypes.func,
autoFocus: PropTypes.bool,
initialHeight: PropTypes.number,
Expand Down Expand Up @@ -256,6 +259,7 @@ GherkinEditor.defaultProps = {
onChange: () => {},
onSubmit: () => {},
autoCompleteFunction: () => Promise.resolve([]),
onCursorChange: () => {},
onLanguageChange: () => {},
autoFocus: false,
initialHeight: 500,
Expand Down

0 comments on commit 4e96c4f

Please sign in to comment.