add cancel button to markdown

This commit is contained in:
chenos 2021-08-27 11:30:12 +08:00
parent 52699b0302
commit 35cafad0ff

View File

@ -63,8 +63,15 @@ function MarkdownTextArea(props: any) {
setValue(e.target.value);
}}
/>
<Space style={{ position: 'absolute', bottom: 5, right: 5 }}>
<Button
onClick={(e) => {
props.onCancel && props.onCancel(e);
}}
>
</Button>
<Button
style={{ position: 'absolute', bottom: 5, right: 5 }}
type={'primary'}
onClick={() => {
props.onSubmit && props.onSubmit(value);
@ -72,6 +79,7 @@ function MarkdownTextArea(props: any) {
>
</Button>
</Space>
</div>
);
}
@ -90,6 +98,9 @@ Markdown.Void = observer((props: any) => {
<MarkdownTextArea
{...props}
defaultValue={schema['default']}
onCancel={() => {
field.readPretty = true;
}}
onSubmit={async (value) => {
field.readPretty = true;
schema['default'] = value;