{"id":14503868,"url":"https://github.com/PirateDevCom/editorjs-anchor","last_synced_at":"2025-08-31T08:31:25.225Z","repository":{"id":239987930,"uuid":"801164629","full_name":"PirateDevCom/editorjs-anchor","owner":"PirateDevCom","description":"Anchor Block Tune for Editor.js","archived":false,"fork":false,"pushed_at":"2024-12-05T03:27:19.000Z","size":28,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-15T21:01:48.940Z","etag":null,"topics":["anchor","block-tune","codex-editor","coolbytes","editorjs","editorjs-plugin"],"latest_commit_sha":null,"homepage":"https://apps.coolbytes.in/editorjs-anchor","language":"JavaScript","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/PirateDevCom.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2024-05-15T18:05:36.000Z","updated_at":"2025-07-01T04:53:27.000Z","dependencies_parsed_at":"2024-05-16T06:50:43.903Z","dependency_job_id":"c458187c-d5c2-4d74-9f3b-52acae0f9ad1","html_url":"https://github.com/PirateDevCom/editorjs-anchor","commit_stats":null,"previous_names":["coolbytesin/editorjs-anchor","piratedevcom/editorjs-anchor"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/PirateDevCom/editorjs-anchor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PirateDevCom%2Feditorjs-anchor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PirateDevCom%2Feditorjs-anchor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PirateDevCom%2Feditorjs-anchor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PirateDevCom%2Feditorjs-anchor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PirateDevCom","download_url":"https://codeload.github.com/PirateDevCom/editorjs-anchor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PirateDevCom%2Feditorjs-anchor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272958309,"owners_count":25022051,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["anchor","block-tune","codex-editor","coolbytes","editorjs","editorjs-plugin"],"created_at":"2024-09-03T20:00:34.654Z","updated_at":"2025-08-31T08:31:24.947Z","avatar_url":"https://github.com/PirateDevCom.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":["Block Tune Tools"],"readme":"# Anchor block tune for Editor.js\n\nThis [Editor.js](https://editorjs.io/) block tune enables users to add or remove an anchor to any block tool. Anchors provide the ability to target specific HTML elements within a webpage, aiding in seamless navigation.\n\nA few points to note:\n* This block tune can be accessed from the Block Settings menu (see [Preview](https://github.com/CoolBytesIN/editorjs-anchor?tab=readme-ov-file#preview)).\n* This button functions as a toggle, allowing you to effortlessly add or remove an anchor with a click. When an anchor is added, the button color changes to indicate its selected state.\n* No string input is required for the anchor. When this block tune is selected, it automatically picks the first 30 characters (or user-configured length) from the block text. And if the block text is empty, no anchor will be added.\n* The anchor value does not automatically update with changes to the block text.\n* To avoid unsafe URL chracters and to improve readability, only a few characters (from the block text) are retained for the anchor value.\n  * All characters except these will be ignored: a-z, 0-9, _ (underscore), - (hyphen).\n  * The anchor value will begin and end with a alpha-numeric character, other trailing and leading characters are ignored.\n  * Whitespace between the words is replaced with an underscore.\n\n## Preview\n\n![preview](https://api.coolbytes.in/media/handle/view/image/733dd8b3-68a7-4cf1-bcf6-5888fb526656/)\n\n## Installation\n\n**Using `npm`**\n\n```sh\nnpm install @coolbytes/editorjs-anchor\n```\n\n**Using `yarn`**\n\n```sh\nyarn add @coolbytes/editorjs-anchor\n```\n\n## Usage\n\nTo make it available to all block tools:\n\n```js\nconst editor = new EditorJS({\n  tools: {\n    anchor: Anchor\n  },\n  tunes: ['anchor']\n});\n```\n\nTo make it available to a particular block tool:\n\n```js\nconst editor = new EditorJS({\n  tools: {\n    anchor: Anchor,\n    paragraph: {\n      class: Paragraph,\n      tunes: ['anchor']\n    }\n  }\n});\n```\n\n## Config Params\n\n|Field|Type|Description|\n|---|---|---|\n|maxWords|number|Maximum number of words for the anchor value|\n|maxChars|number|Maximum number of characters for the anchor value|\n\n\u0026nbsp;\n\n\u003e [!NOTE]\n\u003e (Default behavior) If neither `maxWords` nor `maxChars` are specified, the entire inner text of the element is used (ideal for adding anchors to header elements).\n\n\u003e [!NOTE]\n\u003e Only alphabets, numbers, and underscores are retained. Spaces and hyphens are replaced with underscores.\n\n\u003e [!NOTE]\n\u003e When both `maxWords` and `maxChars` are provided, `maxWords` takes precedence.\n\n\u0026nbsp;\n\n```js\nconst editor = EditorJS({\n  tools: {\n    anchor: {\n      class: Anchor,\n      config: {\n        maxWords: 4\n      }\n    }\n  },\n  tunes: ['anchor']\n});\n```\n\n## Output data\n\n|Type|Description|\n|---|---|\n|string|Anchor value|\n\n\u0026nbsp;\n\nExample for [Paragraph Tool](https://github.com/editor-js/paragraph):\n\n```json\n{\n  \"type\": \"paragraph\",\n  \"data\": {\n    \"text\": \"Some paragraph to test the anchor block tune\"\n  },\n  \"tunes\": {\n    \"anchor\": \"Some paragraph to test\"\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPirateDevCom%2Feditorjs-anchor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPirateDevCom%2Feditorjs-anchor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPirateDevCom%2Feditorjs-anchor/lists"}