Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/core

Package Overview
Dependencies
Maintainers
5
Versions
327
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/core

headless rich text editor

  • 2.7.0-pre.0
  • pre
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
697K
decreased by-40.39%
Maintainers
5
Weekly downloads
 
Created

What is @tiptap/core?

@tiptap/core is a headless, framework-agnostic, and highly customizable rich-text editor built on top of ProseMirror. It provides a flexible and extensible API to create and manage rich-text content, making it suitable for a wide range of applications from simple text editors to complex content management systems.

What are @tiptap/core's main functionalities?

Creating an Editor

This code demonstrates how to create a basic editor instance with initial content and an update handler that logs the current HTML content to the console.

const { Editor } = require('@tiptap/core');
const editor = new Editor({
  content: '<p>Hello World!</p>',
  onUpdate: ({ editor }) => {
    console.log(editor.getHTML());
  },
});

Adding Extensions

This code shows how to add extensions to the editor. The `StarterKit` extension provides a set of basic functionalities like bold, italic, and bullet lists.

const { Editor } = require('@tiptap/core');
const { StarterKit } = require('@tiptap/starter-kit');
const editor = new Editor({
  extensions: [StarterKit],
  content: '<p>Hello World!</p>',
});

Custom Extensions

This code demonstrates how to create a custom node extension. The `CustomNode` is defined with specific parsing and rendering rules, and then added to the editor.

const { Node, mergeAttributes } = require('@tiptap/core');
const CustomNode = Node.create({
  name: 'customNode',
  group: 'block',
  content: 'inline*',
  parseHTML() {
    return [{ tag: 'custom-node' }];
  },
  renderHTML({ HTMLAttributes }) {
    return ['custom-node', mergeAttributes(HTMLAttributes), 0];
  },
});
const editor = new Editor({
  extensions: [CustomNode],
  content: '<custom-node>Hello World!</custom-node>',
});

Other packages similar to @tiptap/core

Keywords

FAQs

Package last updated on 27 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc