mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-06 21:05:50 +00:00
27 lines
671 B
TypeScript
27 lines
671 B
TypeScript
import { linter, lintGutter } from '@codemirror/lint'
|
|
import { json, jsonParseLinter } from '@codemirror/lang-json'
|
|
import { Extension } from '@codemirror/state'
|
|
|
|
import { Editor, EditorWrapperProps } from './editor'
|
|
|
|
export const JsonEditor = ({value, onChange, readOnly, lineNumbers }: EditorWrapperProps) => {
|
|
const extensions: Extension[] = [
|
|
json()
|
|
]
|
|
|
|
if(!readOnly) {
|
|
extensions.push(
|
|
lintGutter(),
|
|
linter(jsonParseLinter())
|
|
)
|
|
}
|
|
|
|
return <Editor
|
|
value={value}
|
|
onChange={onChange}
|
|
readOnly={readOnly}
|
|
extensions={extensions}
|
|
lineNumbers={lineNumbers}
|
|
/>
|
|
}
|