(LanguageIdEnum.FLINK);
useEffect(() => {
if (hostRef.current && !editorRef.current) {
editorRef.current = monaco.editor.create(hostRef.current, {
- language: LanguageIdEnum.FLINK
+ language: lang
});
}
}, []);
+ useEffect(() => {
+ const model = editorRef.current?.getModel();
+ if (model && model.getLanguageId() !== lang) {
+ monaco.editor.setModelLanguage(model, lang);
+ setTimeout(() => {
+ console.log(
+ 'language changed, current is: ',
+ editorRef.current?.getModel()?.getLanguageId()
+ );
+ }, 200);
+ }
+ }, [lang]);
+
return (
<>
- FlinkSQL Demo
+ ESM Vite Demo
+
+
+