Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@tiptap/extension-paragraph
Advanced tools
@tiptap/extension-paragraph is an extension for the Tiptap editor that provides support for paragraph nodes. It allows you to define and manipulate paragraphs within the Tiptap rich-text editor, enabling you to create, format, and manage text content in a structured way.
Basic Paragraph Node
This code demonstrates how to include the Paragraph extension in a Tiptap editor instance. It allows the editor to recognize and handle paragraph nodes.
import { Paragraph } from '@tiptap/extension-paragraph';
const editor = new Editor({
extensions: [
Paragraph,
],
});
Custom Paragraph Attributes
This code shows how to extend the Paragraph extension to add custom attributes. In this example, a custom attribute named 'customAttribute' is added to the paragraph node.
import { Paragraph } from '@tiptap/extension-paragraph';
const CustomParagraph = Paragraph.extend({
addAttributes() {
return {
customAttribute: {
default: null,
},
};
},
});
const editor = new Editor({
extensions: [
CustomParagraph,
],
});
Custom Paragraph Styling
This code demonstrates how to extend the Paragraph extension to apply custom styling. The 'renderHTML' method is overridden to add a custom CSS class to the paragraph element.
import { Paragraph } from '@tiptap/extension-paragraph';
const CustomParagraph = Paragraph.extend({
renderHTML({ HTMLAttributes }) {
return ['p', { ...HTMLAttributes, class: 'custom-paragraph' }, 0];
},
});
const editor = new Editor({
extensions: [
CustomParagraph,
],
});
The 'prosemirror-schema-basic' package provides a basic schema for ProseMirror, including paragraph nodes. It is similar to @tiptap/extension-paragraph in that it defines the structure and behavior of paragraph nodes, but it is more low-level and requires more manual setup compared to Tiptap's extension.
Draft.js is a rich text editor framework for React, developed by Facebook. It includes support for paragraph nodes and other text formatting features. While it offers similar functionality to @tiptap/extension-paragraph, Draft.js is a more comprehensive framework with a different architecture and API.
Quill is a powerful, open-source WYSIWYG editor that supports paragraph nodes and various text formatting options. It provides a user-friendly interface and a rich set of features, making it comparable to @tiptap/extension-paragraph in terms of functionality, but with a different approach to customization and extension.
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.
2.1.10 (2023-09-15)
Note: Version bump only for package tiptap
FAQs
paragraph extension for tiptap
The npm package @tiptap/extension-paragraph receives a total of 977,420 weekly downloads. As such, @tiptap/extension-paragraph popularity was classified as popular.
We found that @tiptap/extension-paragraph 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.