From 8cbf8fdcfdceab8a330bdc82e4260a55c125c37d Mon Sep 17 00:00:00 2001
From: Kristóf Marussy <marussy@mit.bme.hu>
Date: Sun, 22 Aug 2021 19:54:51 +0200
Subject: Covert language-web to TypeScript

---
 language-web/src/main/js/editor/Editor.tsx | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 language-web/src/main/js/editor/Editor.tsx

(limited to 'language-web/src/main/js/editor/Editor.tsx')

diff --git a/language-web/src/main/js/editor/Editor.tsx b/language-web/src/main/js/editor/Editor.tsx
new file mode 100644
index 00000000..f81c5c37
--- /dev/null
+++ b/language-web/src/main/js/editor/Editor.tsx
@@ -0,0 +1,20 @@
+import { observer } from 'mobx-react-lite';
+import React from 'react';
+import { Controlled as CodeMirror } from 'react-codemirror2';
+
+import { useRootStore } from '../RootStore';
+
+export default observer(() => {
+  const { editorStore } = useRootStore();
+
+  return (
+    <CodeMirror
+      value={editorStore.value}
+      options={editorStore.codeMirrorOptions}
+      editorDidMount={(editor) => editorStore.editorDidMount(editor)}
+      editorWillUnmount={() => editorStore.editorWillUnmount()}
+      onBeforeChange={(_editor, _data, value) => editorStore.updateValue(value)}
+      onChange={() => editorStore.reportChanged()}
+    />
+  );
+});
-- 
cgit v1.2.3-70-g09d2

