diff --git a/src/components/Application/_config.scss b/src/components/Application/_config.scss index 90617486..7c751bb2 100644 --- a/src/components/Application/_config.scss +++ b/src/components/Application/_config.scss @@ -5,7 +5,7 @@ */ /// should be already imported -//@import '~@carbon/react/scss/colors'; +// @import '~@carbon/react/scss/colors'; /* //---------------------------------------------------------------------------- diff --git a/src/components/AutoSuggestion/AutoSuggestion.scss b/src/components/AutoSuggestion/AutoSuggestion.scss index 7d4ea2ce..8bd5083b 100644 --- a/src/components/AutoSuggestion/AutoSuggestion.scss +++ b/src/components/AutoSuggestion/AutoSuggestion.scss @@ -27,37 +27,50 @@ } } +.#{$eccgui}-autosuggestion__inputfield { + background-color: $eccgui-color-textfield-background; +} + .#{$eccgui}-singlelinecodeeditor { - position: relative; - padding: 0 1px; + padding: 0; [class^="cm-theme"] { width: 100%; } + &:has(.cm-editor.cm-focused) { + box-shadow: input-transition-shadow($input-shadow-color-focus, true), $input-box-shadow-focus; + } + .cm-editor { - top: 2px; + top: 1px; height: calc(#{$eccgui-size-textfield-height-regular} - 2px); padding: 0; margin: 0; overflow: hidden; + background-color: transparent; + border-radius: 0; + box-shadow: none; &.cm-focused { outline: none; + box-shadow: none; } .cm-scroller { + height: 100%; padding: 0; margin: 0; overflow: auto hidden !important; } - .CodeMirror-vscrollbar { - display: none !important; - } - .cm-content { - vertical-align: middle; + display: flex; + flex-direction: column; + justify-content: center; + height: 100%; + min-height: 100%; + padding: 0; border: none; } diff --git a/src/components/AutoSuggestion/AutoSuggestion.tsx b/src/components/AutoSuggestion/AutoSuggestion.tsx index df963117..f2cd8231 100644 --- a/src/components/AutoSuggestion/AutoSuggestion.tsx +++ b/src/components/AutoSuggestion/AutoSuggestion.tsx @@ -609,6 +609,25 @@ const AutoSuggestion = ({ [] ); + const codeEditor = React.useMemo(() => { + return + + }, [mode, setCM, handleChange, initialValue, useTabForCompletions, placeholder, showScrollBar, multiline, handleInputMouseDown]) + const hasError = !!value.current && !pathIsValid && !pathValidationPending; const autoSuggestionInput = (
} > - + {codeEditor} {!!value.current && ( diff --git a/src/components/TextField/textfield.scss b/src/components/TextField/textfield.scss index bd73d22f..07812c6c 100644 --- a/src/components/TextField/textfield.scss +++ b/src/components/TextField/textfield.scss @@ -4,8 +4,7 @@ // own vars $eccgui-size-textfield-height-small: $eccgui-size-block-whitespace * 2 !default; $eccgui-size-textfield-height-regular: $eccgui-size-textfield-height-small * $eccgui-size-type-levelratio !default; -$eccgui-size-textfield-height-large: $eccgui-size-textfield-height-regular * $eccgui-size-type-levelratio * - $eccgui-size-type-levelratio !default; +$eccgui-size-textfield-height-large: $eccgui-size-textfield-height-regular * $eccgui-size-type-levelratio * $eccgui-size-type-levelratio !default; $eccgui-size-textfield-padding-horizontal-regular: $eccgui-size-inline-whitespace !default; $eccgui-size-textfield-padding-horizontal-small: $eccgui-size-inline-whitespace * 0.5 !default; $eccgui-typo-textfield-fontweight: $eccgui-font-weight-regular !default; diff --git a/src/components/index.scss b/src/components/index.scss index 191b8ebd..c9ea4fd1 100644 --- a/src/components/index.scss +++ b/src/components/index.scss @@ -38,6 +38,5 @@ @import "./Typography/typography"; @import "./Workspace/workspace"; @import "./Accordion/accordion"; -@import "./AutoSuggestion/AutoSuggestion"; @import "./Badge/badge"; @import "./PropertyValuePair/propertyvalue"; diff --git a/src/extensions/_index.scss b/src/extensions/_index.scss index 8f23e9af..41450c42 100644 --- a/src/extensions/_index.scss +++ b/src/extensions/_index.scss @@ -1,9 +1,4 @@ @import "./react-flow/react-flow"; - -/* -CodeMirror styles are already included by the base component styles -because it is used as lib for elements there already. @import "./codemirror/codemirror"; -*/ - +@import "./../components/AutoSuggestion/AutoSuggestion"; // the whole element should moved to extensions forlder @import "./uppy/fileupload"; diff --git a/src/extensions/codemirror/CodeMirror.tsx b/src/extensions/codemirror/CodeMirror.tsx index 29748ae0..102b3459 100644 --- a/src/extensions/codemirror/CodeMirror.tsx +++ b/src/extensions/codemirror/CodeMirror.tsx @@ -1,13 +1,11 @@ -import React, { AllHTMLAttributes, useRef } from "react"; +import React, { useRef } from "react"; import { defaultKeymap, indentWithTab } from "@codemirror/commands"; import { foldKeymap } from "@codemirror/language"; import { EditorState, Extension } from "@codemirror/state"; import { DOMEventHandlers, EditorView, KeyBinding, keymap, Rect, ViewUpdate } from "@codemirror/view"; -//CodeMirror import { minimalSetup } from "codemirror"; import { markField } from "../../components/AutoSuggestion/extensions/markText"; -//constants import { CLASSPREFIX as eccgui } from "../../configuration/constants"; //hooks @@ -27,6 +25,7 @@ import { adaptedLineNumbers, adaptedPlaceholder, } from "./tests/codemirrorTestHelper"; + export interface CodeEditorProps { // Is called with the editor instance that allows access via the CodeMirror API setEditorView?: (editor: EditorView | undefined) => any; @@ -92,7 +91,7 @@ export interface CodeEditorProps { /** Long lines are wrapped and displayed on multiple lines */ wrapLines?: boolean; - outerDivAttributes?: Partial>; + outerDivAttributes?: Omit, "id" | "data-test-id">; /** * Size in spaces that is used for a tabulator key. @@ -276,11 +275,15 @@ export const CodeEditor = ({ return (
); }; diff --git a/src/extensions/codemirror/_codemirror.scss b/src/extensions/codemirror/_codemirror.scss index 82197c48..0197c622 100644 --- a/src/extensions/codemirror/_codemirror.scss +++ b/src/extensions/codemirror/_codemirror.scss @@ -29,7 +29,6 @@ $eccgui-color-codeeditor-background: $eccgui-color-textfield-background !default // fix size to prevent wrong calculation of other elements padding: 0; margin: 1px; - cursor: text; } &.cm-focused { @@ -54,6 +53,7 @@ $eccgui-color-codeeditor-background: $eccgui-color-textfield-background !default } .cm-content { + cursor: text; border-right-width: $eccgui-size-inline-whitespace !important; } diff --git a/src/index.scss b/src/index.scss index 50b05555..c0ff9fd7 100644 --- a/src/index.scss +++ b/src/index.scss @@ -50,7 +50,6 @@ $prefix-carbon: $prefix; // == Load basic components styles ============================================= @import "./components"; -@import "./extensions/codemirror/codemirror"; // set more readable variable for prefix $prefix-eccgui: $eccgui;