X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e63198a93d7b537ffbb68b8210c99f76041fd112..649e7547de25a0500478c01f1609d9638a8803b0:/src/components/text-field/text-field.tsx diff --git a/src/components/text-field/text-field.tsx b/src/components/text-field/text-field.tsx index f7564f6128..0ba9e35974 100644 --- a/src/components/text-field/text-field.tsx +++ b/src/components/text-field/text-field.tsx @@ -4,8 +4,16 @@ import * as React from 'react'; import { WrappedFieldProps } from 'redux-form'; -import { ArvadosTheme } from '../../common/custom-theme'; -import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '../../../node_modules/@material-ui/core'; +import { ArvadosTheme } from '~/common/custom-theme'; +import { + TextField as MaterialTextField, + StyleRulesCallback, + WithStyles, + withStyles, + PropTypes +} from '@material-ui/core'; +import RichTextEditor from 'react-rte'; +import Margin = PropTypes.Margin; type CssRules = 'textField'; @@ -15,14 +23,69 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }, }); -export const TextField = withStyles(styles)((props: WrappedFieldProps & WithStyles & { label?: string }) => +type TextFieldProps = WrappedFieldProps & WithStyles; + +export const TextField = withStyles(styles)((props: TextFieldProps & { + label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string, + helperText?: string, +}) => ); \ No newline at end of file + />); + + +interface RichEditorTextFieldData { + label?: string; +} + +type RichEditorTextFieldProps = RichEditorTextFieldData & TextFieldProps; + +export const RichEditorTextField = withStyles(styles)( + class RichEditorTextField extends React.Component { + state = { + value: RichTextEditor.createValueFromString(this.props.input.value, 'html') + }; + + onChange = (value: any) => { + this.setState({ value }); + this.props.input.onChange(value.toString('html')); + } + + render() { + return ; + } + } +); + +export const DateTextField = withStyles(styles) + ((props: TextFieldProps) => + + );