Question: how to get the instance ?
See original GitHub issueHi, I am a newbie. I had read the doc several times , but could not find how to get the instance. I try to use useRef to get the editor instance but fail. so is there any sample code to show me. Extra question , How to set a default text ? useState or other methods? I wish i can get the sample code.
@lexical/react: 0.3.7
lexical: 0.3.7
what i want is following code
function App (){
const toggleReadOnly = () => {
instance.setReadOnly(false)
}
const [defaultValue] = useState('Dude, typing something on here.')
return <>
<LexicalComposer initialConfig={{
...editorConfig,
readOnly: true,
}}
/>
<PlainTextPlugin
initialEditorState={defaultValue}
contentEditable={<ContentEditable className="editor-input" />}
/>
</LexicalComposer>
<button onClick={toggleReadOnly}></button>
</>
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to get the instance of class - Stack Overflow
I have made three classes classA, classB and classC in the same package. Now I make three objects of classA inside classB and...
Read more >How to get instance name/key via API
I don't know if this will help or not, but in Workbench, you can go to Session Information > Connection > Endpoint and...
Read more >General prerequisites for connecting to your instance
Get the ID of the instance. You can get the ID of your instance using the Amazon EC2 console (from the Instance ID...
Read more >I want to get the instance ID from the item name.
I want to get the instance ID from the name of the item in the player's inventory. How can I do this? Player...
Read more >Get instance name for JBOSS servers - ServiceNow Community
you should find your Instance ID in the standalone.xml in the config directory of JBOSS. In the pattern you can use "Parse File"...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh!!! Thx. I get it.
@HZZformGD Move everything within the context of
LexicalComposer
:You can set an editor as
readOnly
without needing to reset theinitialConfig
prop of theLexicalComposer
component. Calleditor.setReadOnly
within yourtoggleReadOnly
function instead.