uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.65k stars 132 forks source link

Codemirror 6 #88

Closed mraghuram closed 3 years ago

mraghuram commented 3 years ago

Hi, just curious to know if there is a plan to upgrade this to CodeMirror 6.

Thanks for all the amazing stuff so far.

jaywcjlove commented 3 years ago

@mraghuram Wait for the official version to released.

mraghuram commented 3 years ago

Thanks. Looks like final beta is out.

addingama commented 3 years ago

Any update on this?

jaywcjlove commented 3 years ago

@addingama Still waiting...

jaywcjlove commented 3 years ago

Upgrade @uiw/react-codemirror@4.0.0-rc.4 +++

jaywcjlove commented 3 years ago

npm bundle size

⚠️ 3.0 cannot be upgraded to 4.0+

import CodeMirror from '@uiw/react-codemirror';
- import 'codemirror/mode/javascript/javascript';
+ import { javascript } from "@codemirror/lang-javascript";

const code = 'console.log("hello world!");';

<CodeMirror
  value={code}
-  options={{
-    mode: 'js',
-  }}
+  extensions={[
+    javascript({ jsx: true })
+  ]}
/>
gitluck1314 commented 2 years ago

I have not found any language packs that support yaml. Can you help me?

gitluck1314 commented 2 years ago

@jaywcjlove

gitluck1314 commented 2 years ago

@jaywcjlove 我看这个链接,没有发现可以支持yaml的语言包,这是怎么回事呢?我需要你的帮助

jaywcjlove commented 2 years ago

@gitluck1314 https://gitee.com/uiw/react-codemirror

https://github.com/uiwjs/react-codemirror/blob/a84030f04286912a3f414022b2f386dc545258f0/extensions/langs/src/index.ts#L124

import CodeMirror from '@uiw/react-codemirror';
import { StreamLanguage } from '@codemirror/language';
import { yaml } from '@codemirror/legacy-modes/mode/yaml';

const yamlLang = `yaml......`;

export default function App() {
  return (
    <CodeMirror
      value={yamlLang}
      height="200px"
      extensions={[StreamLanguage.define(yaml)]}
    />
  );
}
ArchanaSharma95 commented 1 year ago

I am getting this error after adding any language extension:: Cannot read properties of null (reading 'extension')