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

To help you get started, we’ve selected a few @monaco-editor/react 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 prvnbist / transcode / src / pages / URL / Decode.js View on Github external
import React from 'react'
import Editor, { monaco } from '@monaco-editor/react'

import { EditorWrapper } from '../../styles/index'
import { inputEditorOptions, outputEditorOptions } from '../../editor'

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github prvnbist / transcode / src / pages / Text Transform / CamelCase.jsx View on Github external
import React from 'react'
import Editor, { monaco } from '@monaco-editor/react'

import { EditorWrapper } from '../../styles/index'
import { inputEditorOptions, outputEditorOptions } from '../../editor'

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github prvnbist / transcode / src / pages / Morse / TextToMorse.jsx View on Github external
n: [1, 0],
	o: [1, 1, 1],
	p: [0, 1, 1, 0],
	q: [1, 1, 0, 1],
	r: [0, 1, 0],
	s: [0, 0, 0],
	t: [1],
	u: [0, 0, 1],
	v: [0, 0, 0, 1],
	w: [0, 1, 1],
	x: [1, 0, 0, 1],
	y: [1, 0, 1, 1],
	z: [1, 1, 0, 0]
}

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github prvnbist / transcode / src / pages / Text Transform / LowerCase.jsx View on Github external
import React from 'react'
import Editor, { monaco } from '@monaco-editor/react'

import { EditorWrapper } from '../../styles/index'
import { inputEditorOptions, outputEditorOptions } from '../../editor'

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github prvnbist / transcode / src / pages / URL / Encode.js View on Github external
import React from 'react'
import Editor, { monaco } from '@monaco-editor/react'

import { EditorWrapper } from '../../styles/index'
import { inputEditorOptions, outputEditorOptions } from '../../editor'

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github prvnbist / transcode / src / pages / Morse / MorseToText.jsx View on Github external
'10': 'n',
	'111': 'o',
	'0110': 'p',
	'1101': 'q',
	'010': 'r',
	'000': 's',
	'1': 't',
	'001': 'u',
	'0001': 'v',
	'011': 'w',
	'1001': 'x',
	'1011': 'y',
	'1100': 'z'
}

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github prvnbist / transcode / src / pages / Text Transform / UpperCase.jsx View on Github external
import React from 'react'
import Editor, { monaco } from '@monaco-editor/react'

import { EditorWrapper } from '../../styles/index'
import { inputEditorOptions, outputEditorOptions } from '../../editor'

monaco
	.init()
	.then(monaco => {
		fetch('/solarized-dark.json')
			.then(res => res.json())
			.then(data => {
				monaco.editor.defineTheme('solarized-dark', data)
				monaco.editor.setTheme('solarized-dark')
			})
	})
	.catch(error =>
		console.error(
			'An error occurred during initialization of Monaco: ',
			error
		)
	)
github Heigvd / Wegas / wegas-app / src / main / webapp / 2 / src / Editor / Components / ScriptEditors / SrcEditor.tsx View on Github external
React.useEffect(() => {
    if (!reactMonaco) {
      monaco.init().then(setReactMonaco);
    }
  }, [reactMonaco]);
github embark-framework / embark / packages / cockpit / ui / src / components / TextEditor.js View on Github external
const initMonaco = async (value, theme) => {
  let model;
  if (editorResolved) {
    model = (await editor).getModel();
  }
  freshEditorPromise();

  let _monaco;
  if (monacoResolved) {
    _monaco = await monaco;
  } else {
    freshMonacoPromise();
    try {
      _monaco = await monacoReact.init();
      resolveMonaco(_monaco);
    } catch (err) {
      rejectMonaco(err);
      rejectEditor(new Error('could not initialize monaco-editor'));
      return;
    }
  }
  try {
    resolveEditor(_monaco.editor.create(document.getElementById(EDITOR_ID), {
      glyphMargin: true,
      value,
      model
    }));
  } catch (err) {
    rejectEditor(err);
  }

@monaco-editor/react

Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins

MIT
Latest version published 1 year ago

Package Health Score

76 / 100
Full package analysis