1.2.1 • Published 8 months ago

tiptap-unique-id v1.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

TipTap Unique ID extension

npm version

An extension that enables unique IDs for nodes. A JS fork of the original MIT licensed extension-unique-id that has since been abandoned in favour of a closed source internal version.

Installation

npm i tiptap-unique-id

Usage

import { Editor } from "@tiptap/core";
// ... extensions
import UniqueId from "tiptap-unique-id";

new Editor({
  element: document.body,
  extensions: [
    // ... extensions
    UniqueId.configure({
      attributeName: "id",
      types: ["paragraph", "heading", "orderedList", "bulletList", "listItem"],
      createId: () => window.crypto.randomUUID(),
    }),
  ],
})

This package is ESM only, transpiled to ES2019.

Configuration

ParameterDefaultDescription
attribute"id"The attribute to assign the value of the id to
types[]A list of node types that should receive ids. The exact list you need will depend on your requirements and tiptap extensions you use.
createId() => window.crypto.randomUUID()A function, returning a different string everytime it is called. Instead of UUIDv4 created by default, nanoid, hyperid or other options can be used
1.2.1

8 months ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago