{"id":18044741,"url":"https://github.com/natterstefan/react-editor-js","last_synced_at":"2025-04-10T01:14:40.013Z","repository":{"id":57129429,"uuid":"220678866","full_name":"natterstefan/react-editor-js","owner":"natterstefan","description":"⚛️📝 The unofficial react component for editorjs (https://editorjs.io/). Install: npm i @natterstefan/react-editor-js --save","archived":false,"fork":false,"pushed_at":"2020-07-13T22:35:52.000Z","size":815,"stargazers_count":27,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T01:14:33.990Z","etag":null,"topics":["editor-js-component","editorjs","editorjs-component","react-editor","react-editor-js","react-editorjs","typescript","wysiwyg-editor","wysiwyg-js-editor"],"latest_commit_sha":null,"homepage":"https://react-editor-js.netlify.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natterstefan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-11-09T17:34:55.000Z","updated_at":"2025-02-08T22:08:17.000Z","dependencies_parsed_at":"2022-08-25T18:21:55.542Z","dependency_job_id":null,"html_url":"https://github.com/natterstefan/react-editor-js","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Freact-editor-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Freact-editor-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Freact-editor-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Freact-editor-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natterstefan","download_url":"https://codeload.github.com/natterstefan/react-editor-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"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-js-component","editorjs","editorjs-component","react-editor","react-editor-js","react-editorjs","typescript","wysiwyg-editor","wysiwyg-js-editor"],"created_at":"2024-10-30T18:10:31.252Z","updated_at":"2025-04-10T01:14:39.986Z","avatar_url":"https://github.com/natterstefan.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# react-editor-js\n\n[![npm version](https://badge.fury.io/js/%40natterstefan%2Freact-editor-js.svg)](https://badge.fury.io/js/%40natterstefan%2Freact-editor-js)\n[![Build Status](https://travis-ci.com/natterstefan/react-editor-js.svg?branch=master)](https://travis-ci.com/natterstefan/react-editor-js)\n[![Cypress.io tests](https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square)](https://cypress.io)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Netlify Status](https://api.netlify.com/api/v1/badges/98a2eaf6-7b36-4136-adbd-38d7d68085b3/deploy-status)](https://app.netlify.com/sites/react-editor-js/deploys)\n\nUnofficial react component for Editor.js ([https://editorjs.io/][1]).\n\n## Demo\n\nYou can see [react-editor-js](https://github.com/natterstefan/react-editor-js)\nin action on both [codesandbox](https://codesandbox.io/s/react-editor-js-example-m9e49)\nand [netlify](https://react-editor-js.netlify.com/).\n\n## Getting started\n\n```sh\nnpm i @natterstefan/react-editor-js --save\n\n# or\nyarn add @natterstefan/react-editor-js\n```\n\n## PeerDependencies\n\nYou have to install the required peerDependencies (eg. `React \u003e= 16.8`), which\nare listed by the command:\n\n```sh\nnpm info \"@natterstefan/react-editor-js@latest\" peerDependencies\n```\n\nIf using npm 5+, use this shortcut:\n\n```sh\nnpx install-peerdeps --dev @natterstefan/react-editor-js\n\n# or\nyarn add @natterstefan/react-editor-js -D --peer\n```\n\n## Usage\n\n```jsx\n// index.js\nimport EditorJs from '@natterstefan/react-editor-js'\n\nconst App = () =\u003e {\n  return \u003cEditorJs data={data} /\u003e\n}\n```\n\nWhereas `data` looks similar to this [example](cypress/fixtures/data.ts). It is\nbased on the example output presented on [editorjs.io][1].\n\n### Configuration\n\n`EditorJs` passes all given props straight to the `editorjs` instance. It is\nbasically just a wrapper component in React. Take a look at the\n[configuration page in the editor.js documentation](https://editorjs.io/configuration)\nfor more details.\n\n#### Advanced example with callbacks, custom element and instance access\n\n```jsx\n// index.js\nimport EditorJs from '@natterstefan/react-editor-js'\n\nconst App = () =\u003e {\n  const editor = null\n\n  const onReady = () =\u003e {\n    // https://editorjs.io/configuration#editor-modifications-callback\n    console.log('Editor.js is ready to work!')\n  }\n\n  const onChange = () =\u003e {\n    // https://editorjs.io/configuration#editor-modifications-callback\n    console.log(\"Now I know that Editor's content changed!\")\n  }\n\n  const onSave = async () =\u003e {\n    // https://editorjs.io/saving-data\n    try {\n      const outputData = await editor.save()\n      console.log('Article data: ', outputData)\n    } catch (e) {\n      console.log('Saving failed: ', e)\n    }\n  }\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={onSave}\u003eSave\u003c/button\u003e\n      {/* docs: https://editorjs.io/configuration */}\n      \u003cEditorJs\n        data={data}\n        // will be `editorjs` by default\n        holder=\"custom-editor-container\"\n        onReady={onReady}\n        onChange={onChange}\n        editorInstance={editorInstance =\u003e {\n          // invoked once the editorInstance is ready\n          editor = editorInstance\n        }}\n      \u003e\n        \u003cdiv id=\"custom-editor-container\" /\u003e\n      \u003c/EditorJs\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n## Plugins / Tools\n\nIf you want to add [more tools](https://editorjs.io/getting-started#tools-installation)\nsimply pass a `tools` property to the `EditorJs` component:\n\n```jsx\n// index.js\nimport EditorJs from '@natterstefan/react-editor-js'\nimport Header from '@editorjs/header'\n\nconst App = () =\u003e {\n  return \u003cEditorJs data={data} tools={{ header: Header }} /\u003e\n}\n```\n\n`EditorJs` already comes with a basic config for [@editorjs/paragraph](https://www.npmjs.com/package/@editorjs/paragraph)\nand [@editorjs/header](https://www.npmjs.com/package/@editorjs/header). Take a\nlook on their [Github](https://github.com/editor-js) page to find more available\nplugins (or take a look at [the storybook example](src/__stories__/config.ts)).\n\n## Additional Props\n\n| Name                      |   Type    | Default | Description                                                                                                              |\n| :------------------------ | :-------: | :-----: | :----------------------------------------------------------------------------------------------------------------------- |\n| reinitializeOnPropsChange | `boolean` | `false` | editor-js is initialised again on [componentDidUpdate](https://reactjs.org/docs/react-component.html#componentdidupdate) |\n\n## References\n\n- [Debug GitHub Action with tmate](https://github.com/marketplace/actions/debugging-with-tmate)\n\n## Licence\n\n[MIT](LICENCE)\n\nThis project is not affiliated, associated, authorized, endorsed by or in any\nway officially connected to EditorJS ([editorjs.io](https://editorjs.io/)).\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://twitter.com/natterstefan\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/1043668?v=4\" width=\"100px;\" alt=\"Stefan Natter\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eStefan Natter\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/natterstefan/react-editor-js/commits?author=natterstefan\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/natterstefan/react-editor-js/commits?author=natterstefan\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-natterstefan\" title=\"Examples\"\u003e💡\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n[1]: https://editorjs.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatterstefan%2Freact-editor-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatterstefan%2Freact-editor-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatterstefan%2Freact-editor-js/lists"}