Skip to content

Commit

Permalink
React v18.0.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kieran-ryan committed Mar 18, 2024
1 parent e26ad00 commit 063644a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions try/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { WasmParserAdapter } from '@cucumber/language-service/wasm'
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
import React from 'react'
import { render } from 'react-dom'
import { createRoot } from 'react-dom/client'

import { ConfigureEditor, configureMonaco } from '../src/index.js'
import { MonacoEditor } from './MonacoEditor.js'
Expand Down Expand Up @@ -75,13 +75,15 @@ const options = {
'semanticHighlighting.enabled': true,
}

const domEditor = document.getElementById('editor1')
const reactEditor = document.getElementById('editor2')

makeConfigureEditor()
.then((configureEditor) => {
// @ts-ignore
configureEditor(monaco.editor.create(document.getElementById('editor1'), options))
render(
<MonacoEditor options={options} className="editor" configure={configureEditor} />,
document.getElementById('editor2')
)
configureEditor(monaco.editor.create(domEditor, options))
// @ts-ignore
const root = createRoot(reactEditor)
root.render(<MonacoEditor options={options} className="editor" configure={configureEditor} />)
})
.catch((err) => console.error(err.stack))

0 comments on commit 063644a

Please sign in to comment.