diff --git a/libs/components/editor-blocks/src/blocks/code/CodeView.tsx b/libs/components/editor-blocks/src/blocks/code/CodeView.tsx index e72928f29d..b5e76b628b 100644 --- a/libs/components/editor-blocks/src/blocks/code/CodeView.tsx +++ b/libs/components/editor-blocks/src/blocks/code/CodeView.tsx @@ -45,7 +45,9 @@ import { dockerFile } from '@codemirror/legacy-modes/mode/dockerfile'; import { julia } from '@codemirror/legacy-modes/mode/julia'; import { r } from '@codemirror/legacy-modes/mode/r'; import { Extension } from '@codemirror/state'; -import { Select } from '../../components/select'; +// import { Select } from '../../components/select'; +import { Option, Select } from '@toeverything/components/ui'; + import { useOnSelect, WrapperWithPendantAndDragDrop, @@ -102,8 +104,9 @@ const langs: Record = { }; const CodeBlock = styled('div')(({ theme }) => ({ - backgroundColor: '#f8f9fa', - border: '1px solid #e0e0e0', + backgroundColor: '#F2F5F9', + padding: '8px 24px', + borderRadius: theme.affine.shape.borderRadius, '&:hover': { '.operation': { display: 'flex', @@ -113,28 +116,16 @@ const CodeBlock = styled('div')(({ theme }) => ({ display: 'flex', flexWrap: 'wrap', justifyContent: 'space-between', - borderBottom: '1px solid #e0e0e0', - padding: '0 8px 0px', }, '.delete-block': { - padding: '10px 4px 10px 10px', + padding: '6px 10px', + backgroundColor: '#fff', + borderRadius: theme.affine.shape.borderRadius, + cursor: 'pointer', }, '.cm-focused': { outline: 'none !important', }, - '.select': { - marginTop: '10px', - select: { - border: 'none', - outline: 'none', - height: '22px', - lineHeight: theme.affine.typography.body1.lineHeight, - paddingLeft: '10px', - maxHeight: '400px', - background: '#f1f1f1', - borderRadius: '6px', - }, - }, })); export const CodeView: FC = ({ block, editor }) => { const init_value: string = block.getProperty('text')?.value?.[0]?.text; @@ -180,19 +171,38 @@ export const CodeView: FC = ({ block, editor }) => { >
- { + // setSelectedOption(selectedValue); + handleLangChange(selectedValue); + }} + > + {Object.keys(langs).map(item => { + return ( + + ); + })} +
- = ({ block, editor }) => { cursor: 'pointer', '&:hover': { color: 'rgba(0,0,0,.9)' }, }} - /> + /> */}
diff --git a/libs/components/editor-blocks/src/blocks/code/use-code-mirror.ts b/libs/components/editor-blocks/src/blocks/code/use-code-mirror.ts index 29d5ed1d85..c3a28f2141 100644 --- a/libs/components/editor-blocks/src/blocks/code/use-code-mirror.ts +++ b/libs/components/editor-blocks/src/blocks/code/use-code-mirror.ts @@ -41,9 +41,9 @@ export interface UseCodeMirror extends ReactCodeMirrorProps { } const basicSetup: Extension = [ - lineNumbers(), - highlightActiveLineGutter(), - highlightSpecialChars(), + // lineNumbers(), + // highlightActiveLineGutter(), + // highlightSpecialChars(), history(), foldGutter(), drawSelection(), @@ -89,7 +89,10 @@ export function useCodeMirror(props: UseCodeMirror) { const defaultLightThemeOption = EditorView.theme( { '&': { - backgroundColor: '#fff', + backgroundColor: '#F2F5F9', + }, + '.cm-gutters': { + display: 'none', }, }, {