admin管理员组文章数量:1277398
I want to get the same color CSS styling as shown on /
for theme: dark
and language: JSON
But when I tried it with react-codemirror
("@uiw/react-codemirror": "^4.23.8"
):
<CodeMirror
value={{ JSON .... }}
minHeight={"120px"}
theme={basicDark}
extensions={[
basicDark,
javascript({ jsx: true }),
// EditorView.lineWrapping
]}
onChange={onChange}
/>
it looks like this instead:
On the online example the HTML
for the JSON
"message": "Network Error"
have seperate CSS
classes for the JSON
key
and value
:
But the one on my localhost
both JSON
key
and value
have the same class:
It seems my localhost
react-codemirror
is missing alot of classes and styling, why is that?
Does anyone know why this is happening?
Why is it that the outcome is different from the example shown on /
?
I want to get the same color CSS styling as shown on https://uiwjs.github.io/react-codemirror/
for theme: dark
and language: JSON
But when I tried it with react-codemirror
("@uiw/react-codemirror": "^4.23.8"
):
<CodeMirror
value={{ JSON .... }}
minHeight={"120px"}
theme={basicDark}
extensions={[
basicDark,
javascript({ jsx: true }),
// EditorView.lineWrapping
]}
onChange={onChange}
/>
it looks like this instead:
On the online example the HTML
for the JSON
"message": "Network Error"
have seperate CSS
classes for the JSON
key
and value
:
But the one on my localhost
both JSON
key
and value
have the same class:
It seems my localhost
react-codemirror
is missing alot of classes and styling, why is that?
Does anyone know why this is happening?
Why is it that the outcome is different from the example shown on https://uiwjs.github.io/react-codemirror/
?
1 Answer
Reset to default 0Is it enough? I think you need to replace the JS extension with the JSON language extension to achieve this functionality as shown in the official demo. Instead of using basicDark, javascript({ jsx: true })
, you should use extensions={[json()]}
to achieve the desired result.
本文标签:
版权声明:本文标题:javascript - react-codemirror: Cannot get the same CSS color style as shown on https:uiwjs.github.ioreact-codemirror - Stack Ove 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741202317a2357471.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论