0.0.2 • Published 11 months ago

tiptap-clean-paste v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

tiptap-clean-paste

The Tiptap Clean Paste Extension is a plugin for Tiptap that provides a clean paste functionality for your editor. It allows you to strip unwanted content from pasted text, such as formatting, styles, or non-printable characters.

Installation

You can install the Tiptap Clean Paste Extension via npm:

npm install tiptap-clean-paste

Installation

To use the tiptap-clean-paste Extension in your Tiptap editor, import it and add it to your extensions list:

import { CleanPaste } from "tiptap-clean-paste";
// or
import CleanPaste from "tiptap-clean-paste";

// Using the default regex pattern
const extensions = [CleanPaste];

// Or define your custom regex pattern
const customRegex = /[^\x20-\x7E\s]/g;
const extensions = [
  CleanPaste.configure({
    regexPattern: customRegex, // customize the regex pattern used for cleaning pasted text
  }),
];

const TiptapEditor = () => {
  const editor = useEditor({
    extensions,
    content: "<p>Hello World!</p>",
  });
};
0.0.2

11 months ago

0.0.1

1 year ago