1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-12-29 12:31:22 +03:00
parent 44ae3d603d
commit eb3f49d7f6
3 changed files with 5 additions and 8 deletions

View File

@ -99,7 +99,7 @@ class NonInjectedConfigMapDetails extends React.Component<ConfigMapDetailsProps
<>
<DrawerTitle>Data</DrawerTitle>
{
data.map(([name, value]) => (
data.map(([name, value = ""]) => (
<div key={name} className="data">
<div className="name">{name}</div>
<MonacoEditor
@ -110,7 +110,7 @@ class NonInjectedConfigMapDetails extends React.Component<ConfigMapDetailsProps
border: "1px solid var(--borderFaintColor)",
borderRadius: "4px",
}}
value={value || ""}
value={value}
onChange={v => this.data.set(name, v)}
setInitialHeight
/>

View File

@ -5,8 +5,6 @@
import { getInjectable } from "@ogre-tools/injectable";
export type MonacoEditorSize = (linesCount: number) => number;
const getEditorHeightFromLinesCountInjectable = getInjectable({
id: "get-editor-height-from-lines-number",

View File

@ -18,7 +18,6 @@ import type { LensTheme } from "../../themes/lens-theme";
import { withInjectables } from "@ogre-tools/injectable-react";
import userStoreInjectable from "../../../common/user-store/user-store.injectable";
import activeThemeInjectable from "../../themes/active.injectable";
import type { MonacoEditorSize } from "./get-editor-height-from-lines-number.injectable";
import getEditorHeightFromLinesCountInjectable from "./get-editor-height-from-lines-number.injectable";
export type MonacoEditorId = string;
@ -45,7 +44,7 @@ export interface MonacoEditorProps {
interface Dependencies {
userStore: UserStore;
activeTheme: IComputedValue<LensTheme>;
getEditorHeightFromLinesCount: MonacoEditorSize;
getEditorHeightFromLinesCount: (linesCount: number) => number;
}
export function createMonacoUri(id: MonacoEditorId): Uri {
@ -297,11 +296,11 @@ class NonInjectedMonacoEditor extends React.Component<MonacoEditorProps & Depend
}
render() {
const { className, style, setInitialHeight } = this.props;
const { className, style } = this.props;
const css: React.CSSProperties = {
...style,
height: setInitialHeight ? this.initialHeight : style?.height,
height: style?.height ?? this.initialHeight,
};
return (