An open API service indexing awesome lists of open source software.

https://github.com/albertarakelyan/tiptap-extensions-line-height

A Tiptap line-height extension for React, Next.
https://github.com/albertarakelyan/tiptap-extensions-line-height

leading line-height paragraph text tiptap tiptap-extension tiptap-line-height

Last synced: 4 months ago
JSON representation

A Tiptap line-height extension for React, Next.

Awesome Lists containing this project

README

          

# tiptap-extensions-line-height

![tiptap-extension-line-height](https://github.com/AlbertArakelyan/tiptap-extensions-line-height-assets/blob/main/screenshot.gif?raw=true)

[Tiptap](https://tiptap.dev/) is a suite of open source content editing and real-time collaboration tools for developers building apps like Notion or Google Docs.

This package provides the ability to adjust the line height of the tip tap text or paragraph.

Make sure you already have installed all Tiptap related packages in you project

```bash
$ npm install @tiptap/react @tiptap/pm @tiptap/starter-kit
```

## Installation

You can install it using npm:

```bash
$ npm install tiptap-extensions-line-height
```

## Usage

```tsx
import { EditorContent, useEditor } from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';
import LineHeight from 'tiptap-extensions-resize-image';

export const Editor = () => {
const editor = useEditor({
extensions: [StarterKit, LineHeight],
});

const lineHeights = [
{ label: 'Normal', value: 'normal' },
{ label: 'Simple', value: '1' },
{ label: '1.15', value: '1.15' },
{ label: '1.5', value: '1.5' },
{ label: 'Double', value: '2' },
];

const handleLineHeightChange = (e: React.ChangeEvent) => {
editor?.chain().focus().setLineHeight(e.target.value).run();
};

return (



{lineHeights.map((lineHeight) => (

{lineHeight.label}

))}



);
};

```