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

@tiptap/extension-text-style

Package Overview
Dependencies
Maintainers
5
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-text-style

text style extension for tiptap

  • 2.10.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created

What is @tiptap/extension-text-style?

@tiptap/extension-text-style is an extension for the Tiptap editor that allows you to apply various text styles to your content. It provides a flexible way to add custom styles to text, such as color, background color, font size, and more.

What are @tiptap/extension-text-style's main functionalities?

Apply Text Color

This feature allows you to apply a specific color to the text. The code sample demonstrates how to configure the TextStyle extension and apply a red color to the text.

import { TextStyle } from '@tiptap/extension-text-style';
import { Editor } from '@tiptap/core';

const editor = new Editor({
  extensions: [
    TextStyle.configure({ types: ['textStyle'] }),
  ],
  content: '<p>Hello World!</p>',
});

// Apply text color
editor.chain().focus().setTextStyle({ color: '#ff0000' }).run();

Apply Background Color

This feature allows you to apply a background color to the text. The code sample demonstrates how to configure the TextStyle extension and apply a green background color to the text.

import { TextStyle } from '@tiptap/extension-text-style';
import { Editor } from '@tiptap/core';

const editor = new Editor({
  extensions: [
    TextStyle.configure({ types: ['textStyle'] }),
  ],
  content: '<p>Hello World!</p>',
});

// Apply background color
editor.chain().focus().setTextStyle({ backgroundColor: '#00ff00' }).run();

Apply Font Size

This feature allows you to apply a specific font size to the text. The code sample demonstrates how to configure the TextStyle extension and apply a font size of 24px to the text.

import { TextStyle } from '@tiptap/extension-text-style';
import { Editor } from '@tiptap/core';

const editor = new Editor({
  extensions: [
    TextStyle.configure({ types: ['textStyle'] }),
  ],
  content: '<p>Hello World!</p>',
});

// Apply font size
editor.chain().focus().setTextStyle({ fontSize: '24px' }).run();

Other packages similar to @tiptap/extension-text-style

Keywords

FAQs

Package last updated on 20 Nov 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