@@ -16,6 +16,10 @@ import {
1616 ESLintPlaygroundTheme ,
1717 ESLintPlaygroundHighlightStyle ,
1818} from "@/utils/codemirror-themes" ;
19+ import {
20+ highlightRangesExtension ,
21+ type HighlightRange ,
22+ } from "@/utils/highlight-ranges" ;
1923
2024const languageExtensions : Record < string , ( isJSX ?: boolean ) => LanguageSupport > =
2125 {
@@ -28,10 +32,16 @@ const languageExtensions: Record<string, (isJSX?: boolean) => LanguageSupport> =
2832type EditorProperties = {
2933 readOnly ?: boolean ;
3034 value ?: string ;
35+ highlightRanges ?: HighlightRange [ ] ;
3136 onChange ?: ( value : string ) => void ;
3237} ;
3338
34- export const Editor : FC < EditorProperties > = ( { readOnly, value, onChange } ) => {
39+ export const Editor : FC < EditorProperties > = ( {
40+ readOnly,
41+ value,
42+ highlightRanges = [ ] ,
43+ onChange,
44+ } ) => {
3545 const { wrap, language, jsOptions } = useExplorer ( ) ;
3646 const { isJSX } = jsOptions ;
3747 const [ isDragOver , setIsDragOver ] = useState < boolean > ( false ) ;
@@ -50,6 +60,7 @@ export const Editor: FC<EditorProperties> = ({ readOnly, value, onChange }) => {
5060 readOnly ? EditorState . readOnly . of ( true ) : [ ] ,
5161 ESLintPlaygroundTheme ,
5262 ESLintPlaygroundHighlightStyle ,
63+ highlightRangesExtension ( highlightRanges ) ,
5364 ] ;
5465
5566 const debouncedOnChange = useCallback (
0 commit comments