Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@tiptap/core
Advanced tools
@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.
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>',
});
ProseMirror is a toolkit for building rich-text editors. It provides a lot of flexibility and control over the editor's behavior and appearance. @tiptap/core is built on top of ProseMirror, making it easier to use and extend.
Slate is another highly customizable framework for building rich-text editors. It offers a more React-centric approach compared to @tiptap/core, which is framework-agnostic.
Draft.js is a rich-text editor framework built by Facebook. It is highly extensible and provides a lot of control over the editor's state and behavior. However, it is more tightly coupled with React compared to @tiptap/core.
Tiptap is a headless wrapper around ProseMirror – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as New York Times, The Guardian or Atlassian.
Documentation can be found on the Tiptap website.
Tiptap is open sourced software licensed under the MIT license.
FAQs
headless rich text editor
The npm package @tiptap/core receives a total of 939,922 weekly downloads. As such, @tiptap/core popularity was classified as popular.
We found that @tiptap/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.