Expose a `editorWillMount` callback
See original GitHub issueHi, first of all thanks for this wonderful lib!
Is it possible to expose a prop for a callback to fire after the monaco.init()
and before the call to monacoInstance.editor.create()
?
something like:
async function someFunc() {
const monacoInstance = await monaco.init();
// fire a callback that returns a promise here...
if (props.editorWillMount) {
await props.editorWillMount(monacoInstance);
}
const wrapper = document.getElementById('some-id');
const editor = monacoInstance.editor.create(wrapper, options);
if (props.editorDidMount) {
props.editorDidMount(editor);
}
}
Thing is, I need to do some async operations before the editor is being created.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Passing callbacks down with React Hooks - Medium
A pattern to pass callbacks down through component's hierarchy by sharing a memoized API object through the React Context.
Read more >Monaco Editor for React - Morioh
editorWillMount (monaco) an event emitted before the editor mounted (similar to componentWillMount of React). editorDidMount(editor, monaco) an event emitted ...
Read more >How to effectively initialise client register callback in react ...
I am trining use factory class in react functional component. I need initialise base on components props and do it in first render...
Read more >Feature - expose the raw doc object to Canvas's paint callback ...
I'd like to use svg-to-pdfkit to render an SVG into a PDF I'm building. It requires a handle to the PDFKit document, which...
Read more >React 5-Minute Tips: React Callback Hooks - YouTube
This quick video will teach you how to improve React functional component performance with Callback Hooks. You can also download the code ...
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
Hi, Thanks for the update, I’ll post a feedback here as soon as I’ll upgrade to v4. I read the changelog, and seems like I’ll be using most of the new additions! Currently I have a wrapper around your Editor component which does all these new stuff 😀.
BTW your docs are also very well written, it’s obvious you care a lot for your consumers!
Hello @danielemesh
The new version is here 🙂 And as I promised, there is something like
editorWillMount
, it’s calledbeforeMount
. I would love to get feedback about the new version.