{"id":20914798,"url":"https://github.com/dtstack/dt-react-monaco-editor","last_synced_at":"2025-05-13T10:31:51.486Z","repository":{"id":43733428,"uuid":"279464016","full_name":"DTStack/dt-react-monaco-editor","owner":"DTStack","description":"Monaco editor for React.","archived":false,"fork":false,"pushed_at":"2024-04-25T03:07:36.000Z","size":10169,"stargazers_count":20,"open_issues_count":0,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-26T02:50:19.054Z","etag":null,"topics":["editor","monaco-editor","react"],"latest_commit_sha":null,"homepage":"https://dtstack.github.io/dt-react-monaco-editor/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DTStack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-14T02:45:45.000Z","updated_at":"2024-08-09T04:33:47.892Z","dependencies_parsed_at":"2024-01-04T04:23:26.363Z","dependency_job_id":"311b1cbf-7764-4ec1-9613-6e1236d9d82b","html_url":"https://github.com/DTStack/dt-react-monaco-editor","commit_stats":{"total_commits":151,"total_committers":14,"mean_commits":"10.785714285714286","dds":0.5695364238410596,"last_synced_commit":"8b130123f3b4d9ab6f9eb88b23e472d775a30895"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTStack%2Fdt-react-monaco-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTStack%2Fdt-react-monaco-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTStack%2Fdt-react-monaco-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DTStack%2Fdt-react-monaco-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DTStack","download_url":"https://codeload.github.com/DTStack/dt-react-monaco-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225205894,"owners_count":17437996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editor","monaco-editor","react"],"created_at":"2024-11-18T16:10:58.378Z","updated_at":"2024-11-18T16:10:59.866Z","avatar_url":"https://github.com/DTStack.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003edt-react-monaco-editor\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \n[Monaco Editor](https://github.com/Microsoft/monaco-editor) React Components\n\n[![NPM version][npm-image]][npm-url] [![NPM downloads][download-img]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/dt-react-monaco-editor.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/dt-react-monaco-editor\n[download-img]: https://img.shields.io/npm/dm/dt-react-monaco-editor.svg?style=flat\n[download-url]: https://www.npmjs.com/package/dt-react-monaco-editor\n\nEnglish | [简体中文](./README.zh-CN.md)\n\n\u003c/div\u003e\n\n## Introduction\n\nProvides `MonacoEditor` and `MonacoDiffEditor` component, make it easier to use Monaco Editor in React.\n\n\u003cbr/\u003e\n\n## Installation\n\nuse npm\n\n```shell\nnpm install dt-react-monaco-editor\n```\n\nor use yarn\n\n```shell\nyarn add dt-react-monaco-editor\n```\n\nor use pnpm\n\n```shell\npnpm install dt-react-monaco-editor\n```\n\n\u003cbr/\u003e\n\n## Integrating\n\nSee [Monaco Editor integrate Docs](https://github.com/microsoft/monaco-editor/blob/main/docs/integrate-esm.md).\n\n\u003cbr/\u003e\n\n## Usage\n\n### MonacoEditor Component\n\n```jsx\nimport { MonacoEditor } from 'dt-react-monaco-editor';\n\nfunction App() {\n    const editorRef = useRef();\n    return (\n        \u003cMonacoEditor\n            value=\"\"\n            language=\"javascript\"\n            style={{ height: 400, width: 600 }}\n            onChange={(value) =\u003e {\n                console.log(value);\n            }}\n            editorDidMount={(ins) =\u003e (editorRef.current = ins)}\n        /\u003e\n    );\n}\n```\n\n### MonacoDiffEditor Component\n\n```jsx\nimport { MonacoDiffEditor } from 'dt-react-monaco-editor';\n\nfunction App() {\n    const editorRef = useRef();\n    return (\n        \u003cMonacoDiffEditor\n            original=\"const a = 1;\"\n            value=\"const a = 2;\"\n            language=\"sql\"\n            style={{ height: 400, width: 1200 }}\n            onChange={(value) =\u003e {\n                console.log(value);\n            }}\n            editorDidMount={(ins) =\u003e (editorRef.current = ins)}\n        /\u003e\n    );\n}\n```\n\n\u003cbr/\u003e\n\n## Properties\n\n### Common Properties\n\ncommon properties can be used on `MonacoEditor` and `MonacoDiffEditor`.\n\n-   `theme` theme used when the editor renders, defaults to `vs`.\n-   `language` language of model in editor, defaults to `sql`.\n-   `sync` sync value to model when value change, if sync property is true, the editor is controlled, defaults to `false`.\n-   `onChange` an event emitted when the value of the editor model has changed.\n\n### MonacoEditor Own Properties\n\n-   `value` value of model in editor.\n-   `options` options for monaco editor, refer to monaco interface [IStandaloneEditorConstructionOptions](https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IStandaloneEditorConstructionOptions.html).\n-   **[deprecated]** `editorInstanceRef` get editor instance.\n-   `onCursorSelection` an event emitted when the selection of the editor model has changed.\n-   `onFocus` an event emitted when the editor is in focus.\n-   `onBlur` an event emitted when the editor is out of focus.\n-   `editorWillMount` called immediately before the editor is mounted (similar to componentWillMount of React).\n-   `editorDidMount` called immediately after the editor is mounted (similar to componentDidMount of React).\n-   `editorWillUnMount` called immediately before the editor is destroyed (similar to componentWillUnmount of React).\n\n### MonacoDiffEditor Own Properties\n\n-   `value` value of model in modifiedEditor.\n-   `original` value of model in originalEditor.\n-   `options` options for monaco diff editor, refer to monaco interface [IStandaloneDiffEditorConstructionOptions](https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IStandaloneDiffEditorConstructionOptions.html).\n-   **[deprecated]** `diffEditorInstanceRef` get diff editor instance.\n-   `editorWillMount` called immediately before the editor is mounted (similar to componentWillMount of React).\n-   `editorDidMount` called immediately after the editor is mounted (similar to componentDidMount of React).\n-   `editorWillUnMount` called immediately before the editor is destroyed (similar to componentWillUnmount of React).\n\n\u003cbr/\u003e\n\n## Support more sql languages\n\nPlease see [monaco-sql-languages](https://github.com/DTStack/monaco-sql-languages).\n\n`monaco-sql-languages` provides **highlighting**, **error prompts** and **auto-completion** functions for many kinds of SQL Languages for BigData domain. It supports on-demand import and is easy to integrate.\n\n\u003cbr/\u003e\n\n## CHANGELOG\n\n-   [changelog for zh-CN](./CHANGELOG.zh-CN.md)\n-   [changelog base on commits](./CHANGELOG.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtstack%2Fdt-react-monaco-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtstack%2Fdt-react-monaco-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtstack%2Fdt-react-monaco-editor/lists"}