{"id":13770173,"url":"https://github.com/natterstefan/editorjs-inline-tool","last_synced_at":"2025-04-10T01:14:40.082Z","repository":{"id":57219622,"uuid":"224275344","full_name":"natterstefan/editorjs-inline-tool","owner":"natterstefan","description":"Create an inline tool for (editorjs.io) with text formatting tags (eg. bold, strong, em, u, ...).","archived":false,"fork":false,"pushed_at":"2020-09-01T15:28:14.000Z","size":728,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T01:14:24.617Z","etag":null,"topics":["editorjs","editorjs-component","editorjs-inline-tool","editorjs-inlinetool"],"latest_commit_sha":null,"homepage":"https://editorjs-inline-tool.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-26T20:00:23.000Z","updated_at":"2025-01-23T18:11:15.000Z","dependencies_parsed_at":"2022-08-28T23:22:32.740Z","dependency_job_id":null,"html_url":"https://github.com/natterstefan/editorjs-inline-tool","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Feditorjs-inline-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Feditorjs-inline-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Feditorjs-inline-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natterstefan%2Feditorjs-inline-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natterstefan","download_url":"https://codeload.github.com/natterstefan/editorjs-inline-tool/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":["editorjs","editorjs-component","editorjs-inline-tool","editorjs-inlinetool"],"created_at":"2024-08-03T17:00:34.993Z","updated_at":"2025-04-10T01:14:40.062Z","avatar_url":"https://github.com/natterstefan.png","language":"TypeScript","funding_links":[],"categories":["Tools"],"sub_categories":["Inline Tools"],"readme":"# editorjs-inline-tool\n\n[![npm version](https://badge.fury.io/js/editorjs-inline-tool.svg)](https://badge.fury.io/js/editorjs-inline-tool)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\nCreate an inline tool for ([https://editorjs.io/][1]) with [text formatting tags](https://www.w3schools.com/html/html_formatting.asp)\n(eg. `bold`, `strong`, `em`, `u`, ...).\n\n## Getting started\n\n```sh\nnpm i editorjs-inline-tool --save\n\n# or\nyarn add editorjs-inline-tool\n```\n\n## PeerDependencies\n\nYou have to install the required peerDependencies, which are listed by the\nfollowing command:\n\n```sh\nnpm info \"editorjs-inline-tool\" peerDependencies\n```\n\nIf using npm 5+, use this shortcut:\n\n```sh\nnpx install-peerdeps --dev editorjs-inline-tool\n\n# or\nyarn add editorjs-inline-tool -D --peer\n```\n\n## Usage\n\nThis is an example where `GenericInlineTool` is used in a React app (using\n[@natterstefan/react-editor-js](https://www.npmjs.com/package/@natterstefan/react-editor-js)).\nBut this should work for any other framework as well.\n\n```jsx\n// index.js\nimport EditorJs from '@natterstefan/react-editor-js'\nimport Header from '@editorjs/header'\nimport Paragraph from '@editorjs/paragraph'\n\nimport createGenericInlineTool, {\n  ItalicInlineTool,\n  UnderlineInlineTool,\n} from 'editorjs-inline-tool'\n\nconst TOOLS = {\n  header: Header,\n  paragraph: {\n    class: Paragraph,\n    inlineToolbar: true,\n  },\n  // add custom tags or overwrite default tools of editorjs by using the same\n  // name (eg. `bold` or `italic`)\n  bold: {\n    class: createGenericInlineTool({\n      sanitize: {\n        strong: {},\n      },\n      shortcut: 'CMD+B',\n      tagName: 'STRONG',\n      toolboxIcon:\n        '\u003csvg class=\"icon icon--bold\" width=\"12px\" height=\"14px\"\u003e\u003cuse xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#bold\"\u003e\u003c/use\u003e\u003c/svg\u003e',\n    }),\n  },\n  // or use a pre-defined tool instead\n  italic: ItalicInlineTool,\n  underline: UnderlineInlineTool,\n}\n\nconst App = () =\u003e {\n  return \u003cEditorJs tools={TOOLS} data={data} /\u003e\n}\n```\n\n### Configuration\n\n`createGenericInlineTool` returns an `InlineTool` for `EditorJS`. The following\noptions are available:\n\n| Name        | Required |   Type   | Default     | Description                                                                                                                                        |\n| :---------- | :------: | :------: | :---------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| sanitize    | `false`  | `object` | `undefined` | Object that defines rules for [automatic sanitizing](https://editorjs.io/tools-api#sanitize).                                                      |\n| shortcut    | `false`  | `string` | `undefined` | [Shortcut](https://github.com/codex-team/codex.shortcuts) to apply [Tool's render and inserting behaviour](https://editorjs.io/tools-api#shortcut) |\n| tagName     |  `true`  | `string` | `undefined` | text [formatting tag](https://www.w3schools.com/html/html_formatting.asp) (eg. `bold`)                                                             |\n| toolboxIcon |  `true`  | `string` | `undefined` | Icon for the tools [inline toolbar](https://editorjs.io/inline-tools-api-1#render)                                                                 |\n\nAdditionally, there are pre-defined inline tools available: `ItalicInlineTool`,\n`StrongInlineTool` and `UnderlineInlineTool` (they can be found\n[here](src/inline-tools.tsx)).\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/editorjs-inline-tool/commits?author=natterstefan\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/natterstefan/editorjs-inline-tool/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%2Feditorjs-inline-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatterstefan%2Feditorjs-inline-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatterstefan%2Feditorjs-inline-tool/lists"}