@singapor/react
v0.1.1
Published
React bindings for `@singapor/core`.
Readme
@singapor/react
React bindings for @singapor/core.
Install
npm install @singapor/core @singapor/react react react-domUsage
import { EditorHost, useEditor } from '@singapor/react'
import '@singapor/core/style.css'
export function EditorPanel() {
const controller = useEditor({
document: {
documentId: 'example.ts',
text: 'const value = 1;\n',
languageId: 'typescript',
},
})
return <EditorHost controller={controller} />
}Exports
useEditorcreates and synchronizes an editor controller with React state.EditorHostmounts the editor into the DOM.useEditorSelectorsubscribes to selected editor store values.createReactEditorBlocksPluginrenders editor block surfaces through React portals.
