mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00

* perf: checkbox dom * perf: null check * perf: simple mode variables * perf: get csv encoding code * fix: dataset filter * perf: code editor ui
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import MyEditor, { type Props as EditorProps } from './Editor';
|
|
import { Button, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react';
|
|
import MyModal from '../../MyModal';
|
|
import { useTranslation } from 'next-i18next';
|
|
|
|
type Props = Omit<EditorProps, 'resize'> & {};
|
|
|
|
const CodeEditor = (props: Props) => {
|
|
const { t } = useTranslation();
|
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
|
|
return (
|
|
<>
|
|
<MyEditor {...props} resize onOpenModal={onOpen} />
|
|
<MyModal
|
|
isOpen={isOpen}
|
|
onClose={onClose}
|
|
iconSrc="modal/edit"
|
|
title={t('common:code_editor')}
|
|
w={'full'}
|
|
h={'85vh'}
|
|
isCentered
|
|
>
|
|
<ModalBody flex={'1 0 0'} overflow={'auto'}>
|
|
<MyEditor {...props} bg={'myGray.50'} height={'100%'} />
|
|
</ModalBody>
|
|
<ModalFooter>
|
|
<Button mr={2} onClick={onClose} px={6}>
|
|
{t('common:common.Confirm')}
|
|
</Button>
|
|
</ModalFooter>
|
|
</MyModal>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default React.memo(CodeEditor);
|