mirror of
https://github.com/suren-atoyan/monaco-react.git
synced 2026-01-25 16:02:35 +00:00
Activity adoption changes (#752)
This commit is contained in:
parent
1e3c3efc29
commit
2630e1a1fd
@ -8,8 +8,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"monaco-editor": "^0.36.1",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react": "^19.2.0-canary-5e0c951b-20250916",
|
||||
"react-dom": "^19.2.0-canary-5e0c951b-20250916",
|
||||
"state-local": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
import React from "react";
|
||||
import React, { useState, Activity } from 'react';
|
||||
|
||||
import Editor from "../../dist";
|
||||
import Editor from '../../dist';
|
||||
|
||||
function App() {
|
||||
const [isVisible, setIsVisible] = useState(true);
|
||||
|
||||
return (
|
||||
<Editor
|
||||
height="100vh"
|
||||
defaultLanguage="javascript"
|
||||
defaultValue="// some comment"
|
||||
/>
|
||||
<div>
|
||||
<button onClick={() => setIsVisible((v) => !v)}>{isVisible ? 'Hide' : 'Show'} Editor</button>
|
||||
<Activity mode={isVisible ? 'visible' : 'hidden'}>
|
||||
<Editor height="100vh" defaultLanguage="javascript" defaultValue="// some comment" />
|
||||
</Activity>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -253,6 +253,10 @@ function Editor({
|
||||
}
|
||||
|
||||
editorRef.current!.dispose();
|
||||
|
||||
editorRef.current = null;
|
||||
preventCreation.current = false;
|
||||
setIsEditorReady(false);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user