Skip to content

Commit

Permalink
fix: wrap lines
Browse files Browse the repository at this point in the history
  • Loading branch information
snorrees committed Jan 16, 2023
1 parent c151e95 commit 301640e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/PreviewCode.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {Suspense, useCallback, useEffect, useRef} from 'react'
import React, {Suspense, useEffect, useRef} from 'react'
import styled from 'styled-components'
import {Box, Card} from '@sanity/ui'
import {CodeInputValue} from './types'
Expand Down Expand Up @@ -34,10 +34,6 @@ export default function PreviewCode(props: PreviewCodeProps) {
}
}, [])

const handleEditorChange = useCallback(() => {
// do nothing when the editor changes
}, [])

const {selection, schemaType: type} = props
const fixedLanguage = type?.options?.language

Expand All @@ -51,7 +47,6 @@ export default function PreviewCode(props: PreviewCodeProps) {
<Suspense fallback={<Card padding={2}>Loading code preview...</Card>}>
<CodeMirror
ref={aceEditorRef}
onChange={handleEditorChange}
readOnly
editable={false}
value={selection?.code || ''}
Expand Down
1 change: 1 addition & 0 deletions src/codemirror/CodeMirrorProxy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const CodeMirrorProxy = forwardRef<ReactCodeMirrorRef, CodeMirrorProps>((props,
highlightLine({
onHighlightChange,
}),
EditorView.lineWrapping,
]
if (languageExtension) {
return [...baseExtensions, languageExtension]
Expand Down

0 comments on commit 301640e

Please sign in to comment.