Skip to content

itsarnaud/tiptap-fontsize-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiptap Font-Size Extension

A Tiptap extension for adjusting font size in text editors.

Installation

You can install the extension via npm:

npm i tiptap-fontsize-extension

Usage

import { Editor } from '@tiptap/core';
import FontSize from 'tiptap-fontsize-extension';

const editor = new Editor({
  extensions: [
    FontSize.configure({
      defaultSize: '16px',
      step: 1
    }),
    // other extensions
  ],
});

Commands

  • setFontSize(size): Sets the font size to the specified value.
  • getFontSize(): Get the selected font size.
  • increaseFontSize(): Increases the font size by 1px.
  • decreaseFontSize(): Decreases the font size by 1px.
// Get the selected font size
const fontSize = editor.commands.getFontSize();
console.log('Selected font size:', fontSize);

// Set font size to 20px
editor.commands.setFontSize('20px');

// Increase font size by 1px
editor.commands.increaseFontSize();

// Decrease font size by 1px
editor.commands.decreaseFontSize();

PRs are welcome 😃❤️

About

A Tiptap extension for adjusting font size in text editors.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published