Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXP] how to use monaco-editor or @monaco-editor/react in plasmo? #1157

Open
2 tasks done
sanheng opened this issue Jan 14, 2025 · 0 comments
Open
2 tasks done

[EXP] how to use monaco-editor or @monaco-editor/react in plasmo? #1157

sanheng opened this issue Jan 14, 2025 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@sanheng
Copy link

sanheng commented Jan 14, 2025

What is the example you wish to see?

how to use monaco-editor or @monaco-editor/react in plasmo?

Is there any context that might help us understand?

I found this example is not work.

import React from 'react';

import Editor from '@monaco-editor/react';

import { loader } from '@monaco-editor/react';

loader.config({ paths: { vs: '../vs' } });

function App() {
  function handleEditorChange(value, event) {
    // here is the current value
  }

  function handleEditorDidMount(editor, monaco) {
    console.log('onMount: the editor instance:', editor);
    console.log('onMount: the monaco instance:', monaco);
  }

  function handleEditorWillMount(monaco) {
    console.log('beforeMount: the monaco instance:', monaco);
  }

  function handleEditorValidation(markers) {
    // model markers
    // markers.forEach(marker => console.log('onValidate:', marker.message));
  }

  return (
    <Editor
      height="90vh"
      defaultLanguage="javascript"
      defaultValue="// some comment"
      onChange={handleEditorChange}
      onMount={handleEditorDidMount}
      beforeMount={handleEditorWillMount}
      onValidate={handleEditorValidation}
    />
  );
}

export default App;
image image

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@sanheng sanheng added the documentation Improvements or additions to documentation label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant