From 4e96c4f61702fe81b634a3f6c4db9beb92d7ddaa Mon Sep 17 00:00:00 2001 From: Sujith PS Date: Tue, 14 Jun 2022 18:59:33 +0530 Subject: [PATCH] Add onCursorChange property inorder to make custom actions based on cursor position --- src/components/GherkinEditor/index.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/GherkinEditor/index.jsx b/src/components/GherkinEditor/index.jsx index b023cad5..ce36fcc3 100644 --- a/src/components/GherkinEditor/index.jsx +++ b/src/components/GherkinEditor/index.jsx @@ -85,7 +85,8 @@ const GherkinEditor = React.forwardRef((props, ref) => { showGutter, theme, toolbarContent, - uniqueId + uniqueId, + onCursorChange } = props const setGherkinDialect = setGherkinDialectFunctions[mode] || setDialect @@ -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`} @@ -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, @@ -256,6 +259,7 @@ GherkinEditor.defaultProps = { onChange: () => {}, onSubmit: () => {}, autoCompleteFunction: () => Promise.resolve([]), + onCursorChange: () => {}, onLanguageChange: () => {}, autoFocus: false, initialHeight: 500,