Skip to content

Commit d667c94

Browse files
authored
Merge pull request #291 from eccenca/feature/supportProjectVariableAutocompletionForTemplateOperators-CMEM-5572
Passed down props needed for codeAutocomplete
2 parents 24b73e8 + bcae528 commit d667c94

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- Extended existing height and readOnly props from `CodeEditorProps` to `AutoSuggestionProps` & `ExtendedCodeEditorProps` to be configurable from `<CodeAutocompleteField />`
12+
913
## [24.3.0] - 2025-06-05
1014

1115
### Added

src/components/AutoSuggestion/AutoSuggestion.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ export interface AutoSuggestionProps {
166166
/** If this is enabled the value of the editor is replaced with the initialValue if it changes.
167167
* FIXME: This property is a workaround for some "controlled" usages of the component via the initialValue property. */
168168
reInitOnInitialValueChange?: boolean;
169+
/** Optional height of the component */
170+
height?: number | string;
171+
/** Set read-only mode. Default: false */
172+
readOnly?: boolean;
169173
}
170174

171175
// Meta data regarding a request
@@ -198,6 +202,8 @@ const AutoSuggestion = ({
198202
mode,
199203
multiline = false,
200204
reInitOnInitialValueChange = false,
205+
height,
206+
readOnly
201207
}: AutoSuggestionProps) => {
202208
const value = React.useRef<string>(initialValue);
203209
const cursorPosition = React.useRef(0);
@@ -653,6 +659,8 @@ const AutoSuggestion = ({
653659
showScrollBar={showScrollBar}
654660
multiline={multiline}
655661
onMouseDown={handleInputMouseDown}
662+
height={height}
663+
readOnly={readOnly}
656664
/>
657665
);
658666
}, [

src/components/AutoSuggestion/ExtendedCodeEditor.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ export interface ExtendedCodeEditorProps {
6161
| "additionalExtensions"
6262
| "outerDivAttributes"
6363
>;
64+
/** Optional height of the component */
65+
height?: number | string;
66+
/** Set read-only mode. Default: false */
67+
readOnly?: boolean;
6468
}
6569

6670
export type IEditorProps = ExtendedCodeEditorProps;
@@ -80,6 +84,8 @@ export const ExtendedCodeEditor = ({
8084
onCursorChange,
8185
onSelection,
8286
codeEditorProps,
87+
height,
88+
readOnly
8389
}: ExtendedCodeEditorProps) => {
8490
const initialContent = React.useRef(multiline ? initialValue : initialValue.replace(/[\r\n]/g, " "));
8591
const multilineExtensions = multiline
@@ -102,6 +108,8 @@ export const ExtendedCodeEditor = ({
102108
shouldHaveMinimalSetup={false}
103109
preventLineNumbers={!multiline}
104110
mode={mode}
111+
height={height}
112+
readOnly={readOnly}
105113
name=""
106114
enableTab={enableTab}
107115
additionalExtensions={[...multilineExtensions]}

0 commit comments

Comments
 (0)