Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.