I have a json object that I display in codemirror
I also have an array of strings, and I need to apply styles to them in the editor, for example {color: red}. How can I do this?
const params = ["name", "phone"];
const jsonObj = JSON.stringify(
{ "name": "nik", "obj": { "phone": "5434", adress: "street" } },
null,
2
);
<CodeMirrorStyled
value={jsonObj}
options={{
theme: "default",
height: "auto",
viewportMargin: Infinity,
mode: {
name: "javascript",
json: true,
statementIndent: 4,
},
lineNumbers: true,
lineWrapping: true,
indentWithTabs: false,
indentUnit: 4,
tabSize: 4,
autoCloseBrackets: true,
readOnly: true,
}}