diff --git a/extensions/void/src/sidebar/markdown/BlockCode.tsx b/extensions/void/src/sidebar/markdown/BlockCode.tsx index 3ba7b5a0..e40a8549 100644 --- a/extensions/void/src/sidebar/markdown/BlockCode.tsx +++ b/extensions/void/src/sidebar/markdown/BlockCode.tsx @@ -1,15 +1,17 @@ import React, { ReactNode, useCallback, useEffect, useState } from "react" -import MonacoEditor from '@monaco-editor/react' +import SyntaxHighlighter from "react-syntax-highlighter"; +import { atomOneDarkReasonable } from "react-syntax-highlighter/dist/esm/styles/hljs"; -import * as monaco from 'monaco-editor'; -import { loader } from '@monaco-editor/react'; -loader.config({ monaco }); +const BlockCode = ({ text, buttonsOnHover, language }: { text: string, buttonsOnHover?: ReactNode, language?: string }) => { -// code block with toolbar (Apply, Copy, etc) at top -const BlockCode = ({ text, buttonsOnHover, }: { text: string, buttonsOnHover?: ReactNode, }) => { - - const [editorHeight, setEditorHeight] = useState(0) + const customStyle = { + ...atomOneDarkReasonable, + 'code[class*="language-"]': { + ...atomOneDarkReasonable['code[class*="language-"]'], + background: "none", + }, + } return (<>
@@ -20,42 +22,18 @@ const BlockCode = ({ text, buttonsOnHover, }: { text: string, buttonsOnHover?: R
)} - { - // const model = editor.getModel() - const fn = () => setEditorHeight!(editor.getContentHeight()) - editor.onDidContentSizeChange(fn) - fn() - }} - loading='loading' - value={text} - language={'python'} +
+ + {text} + - // onChange={() => { onChangeText?.() }} - height={editorHeight} - theme={'vs-dark'} - - options={{ - // fontSize: 15, - wordWrapColumn: 10000, // we want this to be infinity - wordWrap: 'bounded', // 'off' - lineNumbers: 'off', - renderLineHighlight: 'none', - minimap: { enabled: false }, - scrollBeyondLastColumn: 0, - scrollBeyondLastLine: false, - scrollbar: { - alwaysConsumeMouseWheel: true, // height !== undefined - }, - - overviewRulerLanes: 0, - readOnly: true, - readOnlyMessage: { value: "" }, - quickSuggestions: false, - - }} - /> +
)