# @rexby/draftjs-to-tiptap

> draftjs to tiptap markup converter

Latest version **1.0.3** (published 2024-03-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rexby/draftjs-to-tiptap
pnpm add @rexby/draftjs-to-tiptap
yarn add @rexby/draftjs-to-tiptap
bun add @rexby/draftjs-to-tiptap
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2024-03-13 |
| First published | 2023-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rexbylabs |
| Maintainers | maggisk |
| Keywords | tiptap, draftjs |

## Links

- npm: https://www.npmjs.com/package/@rexby/draftjs-to-tiptap
- Repository: https://github.com/Life-Swap/rexbylabs/
- npm.io page: https://npm.io/package/@rexby/draftjs-to-tiptap

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 1.0.3 (latest) — 2024-03-13
- 1.0.2 — 2024-01-02
- 1.0.1 — 2023-11-17
- 1.0.0 — 2023-11-17
- 0.1.1 — 2023-11-17
- 0.1.0 — 2023-11-17

## README

# draftjs-to-tiptap

draftjs to tiptap markup converter

## install

`npm i @rexby/draftjs-to-tiptap` 
or  
`yarn add @rexby/draftjs-to-tiptap`

### Usage

	import { draftjsToTiptap } from "@rexby/draftjs-to-tiptap";

	draftjsToTiptap(draftjsDocument, {
		// If you have @mentions in your draftjs documents you need to supply a
		// function to convert draftjs entity to tiptap mention attributes.
		// `entity.data.mention` will depend on how you configured your draftjs
		// editor, and you need to return an object with id and label as tiptap
		// expects
		getMentionAttrs: (entity) => {
			return {
				id: entity.data.mention.id,
				label: entity.data.mention.name
			};
		},
	})

Input and output are json objects. If you store your documents as strings you will need to `JSON.parse` the input and `JSON.stringify` the output yourself.

---
_Source: https://npm.io/package/@rexby/draftjs-to-tiptap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
