How to use the @uifabric/monaco-editor.editor function in @uifabric/monaco-editor

To help you get started, we’ve selected a few @uifabric/monaco-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / packages / tsx-editor / src / components / Editor.tsx View on Github external
React.useEffect(() => {
    const model = (modelRef.current = monaco.editor.createModel(code, language, filename ? monaco.Uri.parse(filename) : undefined));
    const editor = monaco.editor.create(divRef.current!, {
      minimap: { enabled: false },
      fontFamily: CODE_FONT_FAMILY,
      ariaLabel,
      accessibilityHelpUrl: 'https://github.com/Microsoft/monaco-editor/wiki/Monaco-Editor-Accessibility-Guide',
      // add editorOptions default value here (NOT in main destructuring) to avoid re-calling the effect
      ...(editorOptions || {}),
      model
    });

    // Handle changes (debounced)
    // tslint:disable-next-line:no-any due to mismatch between Node and browser typings
    let debounceTimeout: any;
    editor.onDidChangeModelContent(() => {
      // Destructure these locally to get the latest values
      const { debounceTime: currDebounceTime, onChange: currOnChange } = internalState.current!;
      if (!currOnChange) {

@uifabric/monaco-editor

Version of monaco-editor with configuration helpers and transformed CSS files

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Similar packages