File tree Expand file tree Collapse file tree
packages/react-live/src/components/Editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export type Props = {
1515} ;
1616
1717const CodeEditor = ( props : Props ) => {
18+ const { tabMode = "indentation" } = props ;
1819 const editorRef = useRef ( null ) ;
1920 const [ code , setCode ] = useState ( props . code || "" ) ;
2021 const { theme } = props ;
@@ -25,7 +26,7 @@ const CodeEditor = (props: Props) => {
2526
2627 useEditable ( editorRef , ( text ) => setCode ( text . slice ( 0 , - 1 ) ) , {
2728 disabled : props . disabled ,
28- indentation : props . tabMode === "indentation" ? 2 : undefined ,
29+ indentation : tabMode === "indentation" ? 2 : undefined ,
2930 } ) ;
3031
3132 useEffect ( ( ) => {
@@ -81,8 +82,4 @@ const CodeEditor = (props: Props) => {
8182 ) ;
8283} ;
8384
84- CodeEditor . defaultProps = {
85- tabMode : "indentation" ,
86- } as Pick < Props , "tabMode" > ;
87-
8885export default CodeEditor ;
You can’t perform that action at this time.
0 commit comments