{"id":13808495,"url":"https://github.com/sibiraj-s/ngx-tiptap","last_synced_at":"2025-05-15T23:03:58.069Z","repository":{"id":39482612,"uuid":"363642401","full_name":"sibiraj-s/ngx-tiptap","owner":"sibiraj-s","description":"Angular bindings for tiptap v2","archived":false,"fork":false,"pushed_at":"2025-04-26T20:01:22.000Z","size":7368,"stargazers_count":149,"open_issues_count":3,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-12T01:05:45.556Z","etag":null,"topics":["angular-tiptap","ngx-tiptap","tiptap-editor","tiptap-v2"],"latest_commit_sha":null,"homepage":"https://sibiraj-s.github.io/ngx-tiptap/","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/sibiraj-s.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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},"funding":{"github":["sibiraj-s"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2021-05-02T12:11:02.000Z","updated_at":"2025-05-04T21:33:58.000Z","dependencies_parsed_at":"2023-01-30T13:15:27.223Z","dependency_job_id":"203c9109-8db4-4baa-9efb-97e657557c26","html_url":"https://github.com/sibiraj-s/ngx-tiptap","commit_stats":{"total_commits":300,"total_committers":8,"mean_commits":37.5,"dds":0.2766666666666666,"last_synced_commit":"2fdad743d11961cda2ef29d41a61fccdc1ee7b30"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fngx-tiptap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fngx-tiptap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fngx-tiptap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fngx-tiptap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sibiraj-s","download_url":"https://codeload.github.com/sibiraj-s/ngx-tiptap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436944,"owners_count":22070946,"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":["angular-tiptap","ngx-tiptap","tiptap-editor","tiptap-v2"],"created_at":"2024-08-04T01:01:44.246Z","updated_at":"2025-05-15T23:03:57.793Z","avatar_url":"https://github.com/sibiraj-s.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sibiraj-s"],"categories":["Angular","Third Party Components"],"sub_categories":["Editors"],"readme":"# NgxTiptap\n\n\u003e Angular bindings for [tiptap v2](https://www.tiptap.dev/)\n\n[![Tests](https://github.com/sibiraj-s/ngx-tiptap/actions/workflows/tests.yml/badge.svg)](https://github.com/sibiraj-s/ngx-tiptap/actions/workflows/tests.yml)\n[![NPM Version](https://badgen.net/npm/v/ngx-tiptap)](https://www.npmjs.com/package/ngx-tiptap)\n[![Total Downloads](https://badgen.net/npm/dt/ngx-tiptap)](https://www.npmjs.com/package/ngx-tiptap)\n[![Monthly Downloads](https://badgen.net/npm/dm/ngx-tiptap)](https://www.npmjs.com/package/ngx-tiptap)\n[![License](https://badgen.net/npm/license/ngx-tiptap)](https://github.com/sibiraj-s/ngx-tiptap/blob/master/LICENSE)\n\n[demo on stackblitz](https://ngx-tiptap.stackblitz.io/) | [edit stackblitz](https://stackblitz.com/edit/ngx-tiptap)\n\nFind a example on how to use the editor [here at project/demo directory](./projects/demo).\n\n## Installation\n\n```bash\nnpm i ngx-tiptap\n\n# or\n\nyarn add ngx-tiptap\n```\n\n\u003e [!NOTE]\n\u003e This package just provides the bindings for angular. For configuring/customizing the editor, refer [tiptap's official documentation](https://www.tiptap.dev/).\n\nFor any issues with the editor. You may need to open the issue on [tiptap's repository](https://github.com/ueberdosis/tiptap/issues)\n\n## Usage\n\nAll components are now standalone. Import the component you need.\n\nCreate an instance of the editor\n\n```ts\nimport { Component, OnDestroy } from '@angular/core';\nimport { Editor } from '@tiptap/core';\nimport StarterKit from '@tiptap/starter-kit';\nimport { TiptapEditorDirective } from 'ngx-tiptap';\n\n@Component({\n  selector: 'app-root',\n  template: './app.component.html',\n  imports: [CommonModule, FormsModule, TiptapEditorDirective],\n})\nexport class AppComponent implements OnDestroy {\n  editor = new Editor({\n    extensions: [StarterKit],\n  });\n\n  value = '\u003cp\u003eHello, Tiptap!\u003c/p\u003e'; // can be HTML or JSON, see https://www.tiptap.dev/api/editor#content\n\n  ngOnDestroy(): void {\n    this.editor.destroy();\n  }\n}\n```\n\nand in HTML\n\n```html\n\u003ctiptap-editor [editor]=\"editor\" [(ngModel)]=\"value\"\u003e\u003c/tiptap-editor\u003e\n```\n\n\u003e [!NOTE]\n\u003e No styling is provided by default. You are in full control of how your editor looks. Refer [tiptaps's styling guide](https://www.tiptap.dev/guide/styling) for more information.\n\n\u003e [!TIP]\n\u003e Since the editor is dynamically created, You may need to set [ViewEncapsulation](https://angular.io/guide/view-encapsulation) to `None` or target the class/element via [::ng-deep](https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep) to apply the styles. See [Component Styles docs](https://angular.io/guide/component-styles#component-styles) for more info.\n\n## Options\n\n- outputFormat [`json` or `html`] - defaults to html.\n\nYou can get the json or html format from the editor directly as well.\n\nRefer https://www.tiptap.dev/guide/output#export\n\n## Extensions\n\nRefer: https://www.tiptap.dev/api/extensions\n\n### Floating Menu\n\nThis will make a contextual menu appear near a selection of text. The markup and styling are totally up to you.\n\nImport the `TiptapFloatingMenuDirective` to your component and use it. For example:\n\n```html\n\u003ctiptap-editor [editor]=\"editor\"\u003e\u003c/tiptap-editor\u003e\n\u003ctiptap-floating-menu [editor]=\"editor\"\u003e\n  \u003c!-- Anything that should be rendered inside floating menu --\u003e\n\u003c/tiptap-floating-menu\u003e\n```\n\nRefer: https://www.tiptap.dev/api/extensions/floating-menu\n\n### Bubble Menu\n\nThis will make a contextual menu appear near a selection of text. Use it to let users apply marks to their text selection. The markup and styling are totally up to you.\n\nImport the `TiptapBubbleMenuDirective` to your component and use it. For example:\n\n```html\n\u003ctiptap-editor [editor]=\"editor\"\u003e\u003c/tiptap-editor\u003e\n\u003ctiptap-bubble-menu [editor]=\"editor\"\u003e\n  \u003c!-- Anything that should be rendered inside bubble menu --\u003e\n\u003c/tiptap-bubble-menu\u003e\n```\n\nRefer: https://www.tiptap.dev/api/extensions/bubble-menu\n\n## AngularNodeViewRenderer\n\nThis enables rendering Angular Components as NodeViews.\n\n### Create a Node Extension\n\n```ts\nimport { Injector } from '@angular/core';\nimport { Node, mergeAttributes } from '@tiptap/core';\nimport { AngularNodeViewRenderer } from 'ngx-tiptap';\n\nimport { NodeviewCounterComponent } from './nodeview-counter/nodeview-counter.component';\n\nconst CounterComponentExtension = (injector: Injector): Node =\u003e {\n  return Node.create({\n    // ...other configuration hidden for brevity\n    parseHTML() {\n      return [{ tag: 'angular-component-counter' }];\n    },\n    renderHTML({ HTMLAttributes }) {\n      return ['angular-component-counter', mergeAttributes(HTMLAttributes)];\n    },\n    addNodeView() {\n      return AngularNodeViewRenderer(NodeviewCounterComponent, { injector });\n    },\n  });\n};\n\nexport default CounterComponentExtension;\n```\n\nRefer: https://tiptap.dev/guide/custom-extensions\n\n### Create a Component\n\n```ts\nimport { Component } from '@angular/core';\nimport { AngularNodeViewComponent } from 'ngx-tiptap';\n\n@Component({\n  selector: 'app-nodeview-counter',\n})\nexport class NodeviewCounterComponent extends AngularNodeViewComponent {\n  increment(): void {\n    const updateAttributes = this.updateAttributes();\n\n    updateAttributes({\n      count: this.node.attrs.count + 1,\n    });\n  }\n}\n```\n\n### Use the extension\n\n```ts\nimport { Component, Injector, OnInit, OnDestroy } from '@angular/core';\nimport { Editor } from '@tiptap/core';\nimport StarterKit from '@tiptap/starter-kit';\n\nimport CounterComponentExtension from './CounterComponentExtension';\n\n@Component({\n  selector: 'app-root',\n  template: './app.component.html',\n})\nexport class AppComponent implements OnInit, OnDestroy {\n  editor: Editor;\n\n  constructor(private injector: Injector) {}\n\n  ngOnInit(): void {\n    this.editor = new Editor({\n      content: `\n        \u003cp\u003eThis is still the text editor you’re used to, but enriched with node views.\u003c/p\u003e\n        \u003cangular-component-counter count=\"0\"\u003e\u003c/angular-component-counter\u003e\n      `,\n      extensions: [StarterKit, CounterComponentExtension(this.injector)],\n      editorProps: {\n        attributes: {\n          class: 'p-2 border-black focus:border-blue-700 border-2 rounded-md outline-none',\n        },\n      },\n    });\n  }\n\n  ngOnDestroy(): void {\n    this.editor.destroy();\n  }\n}\n```\n\n### Access/Update Attributes\n\nRefer https://www.tiptap.dev/guide/node-views/react/#all-available-props for the list of all available attributes. You can access them by extending the `AngularNodeViewComponent`\n\n```ts\nimport { AngularNodeViewComponent } from 'ngx-tiptap';\n\nexport class NodeviewCounterComponent extends AngularNodeViewComponent {\n  increment(): void {\n    const updateAttributes = this.updateAttributes();\n\n    updateAttributes({\n      count: this.node.attrs.count + 1,\n    });\n  }\n}\n```\n\n### Adding a content editable\n\nThere is another directive called `tiptapNodeViewContent` which helps you adding editable content to your node view. Make sure to import the `TiptapNodeViewContentDirective` to your component.\n\nHere is an example.\n\n```html\n\u003c!-- editable.component.html --\u003e\n\u003cdiv class=\"angular-component-with-content\"\u003e\n  \u003cp tiptapNodeViewContent\u003e\u003c/p\u003e\n\u003c/div\u003e\n```\n\nRefer: https://www.tiptap.dev/guide/node-views/react/#adding-a-content-editable\n\n### Dragging\n\nTo make your node views draggable, import the `TiptapDraggableDirective` to your component and set `draggable: true` in the tiptap extension. Add `tiptapDraggable` directive to the DOM element inside the component that should function as the drag handle.\n\n### AngularRenderer\n\nYou can also manually render the angular components using `AngularRenderer`.\n\n```ts\nimport { AngularRenderer } from 'ngx-tiptap';\n\nconst renderer = new AngularRenderer(Component, injector, props);\n\nrenderer.instance; // get the instance of the component, can be used to update `@Input` properties\nrenderer.dom; // get the HTMLElement for the component\nrenderer.destroy(); // destroy the component and its instance\n```\n\n## Contributing\n\nAll types of contributions are welcome. See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) to get started.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibiraj-s%2Fngx-tiptap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsibiraj-s%2Fngx-tiptap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibiraj-s%2Fngx-tiptap/lists"}