feat: json mode + code folding in response view

This commit is contained in:
Anoop M D 2021-12-05 21:15:20 +05:30
parent 8b586bdfae
commit 12d0890b83
2 changed files with 14 additions and 1 deletions

View File

@ -12,7 +12,13 @@ const QueryResult = ({data, isLoading, width}) => {
if (editor.current && !cmEditor) {
const _cmEditor = CodeMirror.fromTextArea(editor.current, {
value: '',
lineNumbers: true
lineNumbers: true,
matchBrackets: true,
autoCloseBrackets: true,
mode: "application/json",
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
lineWrapping: true
});
setCmEditor(_cmEditor);

View File

@ -9,6 +9,13 @@ import actions from 'providers/Store/actions';
import { useStore } from '../../providers/Store/index';
import StyledWrapper from './StyledWrapper';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/addon/fold/brace-fold';
import 'codemirror/addon/fold/foldgutter';
import 'codemirror/addon/fold/foldgutter.css';
const RequestTabPanel = dynamic(import('@grafnode/components').then(mod => mod.RequestTabPanel), { ssr: false });
export default function Main() {