Skip to content

Commit d1d524c

Browse files
committed
set outerDivAttributes as deprecated on CodeEditor
1 parent f49171b commit d1d524c

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ This is a major release, and it might be not compatible with your current usage
6464
- `<OverviewItemList />`
6565
- `densityHigh` property was removed
6666
- `<CodeEditor />`
67-
- static test id `codemirror-wrapper` was removed, add `data-test-id` (or your test id data attribute) to `outerDivAttributes` property of the component
67+
- static fallback for test id `codemirror-wrapper` was removed, add `data-test-id` (or your test id data attribute) always directly to `CodeEditor`.
6868
- `nodeTypes` and `edgeTypes` exports were removed
6969
- use `<ReactFlow/` with `configuration`, or define it yourself
7070
- SCSS variables `$eccgui-color-application-text` and `$eccgui-color-application-background` were removed

src/components/AutoSuggestion/ExtendedCodeEditor.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ export const ExtendedCodeEditor = ({
111111
name=""
112112
enableTab={enableTab}
113113
additionalExtensions={[...multilineExtensions]}
114-
outerDivAttributes={{
115-
className: `${eccgui}-${
116-
multiline ? "codeeditor" : `singlelinecodeeditor ${BlueprintClassNames.INPUT}`
117-
}`,
118-
}}
114+
className={multiline ? undefined : `${eccgui}-singlelinecodeeditor ${BlueprintClassNames.INPUT}`}
119115
{...codeEditorProps}
120116
/>
121117
);

src/extensions/codemirror/CodeMirror.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
} from "./tests/codemirrorTestHelper";
3737
import { ExtensionCreator } from "./types";
3838

39-
export interface CodeEditorProps extends TestableComponent {
39+
export interface CodeEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "translate" | "onChange" | "onKeyDown" | "onMouseDown" | "onScroll">, TestableComponent {
4040
// Is called with the editor instance that allows access via the CodeMirror API
4141
setEditorView?: (editor: EditorView | undefined) => void;
4242
/**
@@ -100,7 +100,11 @@ export interface CodeEditorProps extends TestableComponent {
100100
/** Long lines are wrapped and displayed on multiple lines */
101101
wrapLines?: boolean;
102102

103-
outerDivAttributes?: Omit<React.HTMLAttributes<HTMLDivElement>, "id">;
103+
/**
104+
* Add properties to the `div` used as warpper element.
105+
* @deprecated (v26) You can now use all properties directly on `CodeEditor`.
106+
*/
107+
outerDivAttributes?: Omit<React.HTMLAttributes<HTMLDivElement>, "id" | "data-test-id" | "data-testid" | "translate" | "onChange" | "onKeyDown" | "onMouseDown" | "onScroll">;
104108

105109
/**
106110
* Size in spaces that is used for a tabulator key.
@@ -186,6 +190,7 @@ const ModeToolbarSupport: ReadonlyArray<SupportedCodeEditorModes> = ["markdown"]
186190
* Includes a code editor, currently we use CodeMirror library as base.
187191
*/
188192
export const CodeEditor = ({
193+
className,
189194
onChange,
190195
onSelection,
191196
onMouseDown,
@@ -489,12 +494,13 @@ export const CodeEditor = ({
489494
// overwrite/extend some attributes
490495
id={id ? id : name ? `codemirror-${name}` : undefined}
491496
ref={parent}
497+
{...otherCodeEditorProps}
492498
className={
493499
`${eccgui}-codeeditor ${eccgui}-codeeditor--mode-${mode}` +
500+
(className ? ` ${className}` : "") +
494501
(outerDivAttributes?.className ? ` ${outerDivAttributes?.className}` : "") +
495502
(hasToolbarSupport ? ` ${eccgui}-codeeditor--has-toolbar` : "")
496503
}
497-
{...otherCodeEditorProps}
498504
>
499505
{hasToolbarSupport && editorToolbar(mode)}
500506
</div>

0 commit comments

Comments
 (0)