{"id":12148,"library":"tiptap-utils","title":"Tiptap Utility Functions","description":"tiptap-utils is an older, standalone JavaScript package providing a collection of general utility functions designed for the Tiptap editor. Its current stable version is 1.13.1, with its last release approximately five years ago. This package is distinct from the modern `@tiptap/core` (v2/v3) monorepo and its associated extensions, which now integrate many of the functionalities previously offered by `tiptap-utils` directly into the core library or specific extensions. As such, `tiptap-utils` does not adhere to the active and rapid release cadence of the current Tiptap ecosystem. Developers are generally advised to use the utilities provided by `@tiptap/core` for modern Tiptap implementations, as `tiptap-utils` may have compatibility issues with newer editor versions due to significant API changes.","status":"deprecated","version":"1.13.1","language":"javascript","source_language":"en","source_url":"https://github.com/ueberdosis/tiptap","tags":["javascript"],"install":[{"cmd":"npm install tiptap-utils","lang":"bash","label":"npm"},{"cmd":"yarn add tiptap-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add tiptap-utils","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"While CommonJS `require` might work in some older Node environments, `tiptap-utils` is primarily designed for browser usage and ES module imports are standard. Note that modern Tiptap (@tiptap/core v2/v3) handles mark attributes differently, often directly on the editor state.","wrong":"const { getMarkAttrs } = require('tiptap-utils')","symbol":"getMarkAttrs","correct":"import { getMarkAttrs } from 'tiptap-utils'"},{"note":"This package uses named exports for its utility functions. Attempting a default import will result in `undefined`. Modern Tiptap offers equivalent functionality via `editor.isActive()` methods.","wrong":"import markIsActive from 'tiptap-utils'","symbol":"markIsActive","correct":"import { markIsActive } from 'tiptap-utils'"},{"note":"For `tiptap-utils` (v1.x), prefer explicit named imports. Modern Tiptap (@tiptap/core v2/v3) provides `editor.isActive('nodeName')` for checking node activity.","wrong":"require('tiptap-utils').nodeIsActive","symbol":"nodeIsActive","correct":"import { nodeIsActive } from 'tiptap-utils'"}],"quickstart":{"code":"import { Editor } from 'tiptap';\nimport { markIsActive, nodeIsActive } from 'tiptap-utils';\nimport { Bold, Paragraph, Document } from 'tiptap-extensions'; // Example extensions for older Tiptap\n\n// This example is for older Tiptap v1.x, which `tiptap-utils` was designed for.\n// It is NOT compatible with @tiptap/core v2/v3.\nconst editor = new Editor({\n  extensions: [\n    new Document(),\n    new Paragraph(),\n    new Bold(),\n  ],\n  content: '<p>This is <strong>bold</strong> text.</p>',\n  onUpdate: ({ editor }) => {\n    const state = editor.state;\n    console.log('Is bold mark active?', markIsActive(state, 'bold'));\n    console.log('Is paragraph node active?', nodeIsActive(state, 'paragraph'));\n  },\n});\n\n// To simulate usage in a non-interactive environment or test:\nsetTimeout(() => {\n  const state = editor.state;\n  console.log('Is bold mark active after timeout?', markIsActive(state, 'bold'));\n  console.log('Is paragraph node active after timeout?', nodeIsActive(state, 'paragraph'));\n  editor.destroy();\n}, 1000);","lang":"javascript","description":"Demonstrates importing and using `markIsActive` and `nodeIsActive` with an older Tiptap v1.x Editor instance to check the active state of marks and nodes."},"warnings":[{"fix":"For `@tiptap/core` v2/v3, use the built-in utility functions and methods provided by the `Editor` instance or the `@tiptap/core` package itself (e.g., `editor.isActive()`, `editor.getAttributes()`, `editor.chain().focus()`). Consult the official Tiptap v2/v3 documentation for current best practices.","message":"The `tiptap-utils` package (v1.x) is designed for the original Tiptap v1.x editor. It is generally not compatible with `@tiptap/core` v2 or v3 due to fundamental changes in the editor's architecture, state management, and API surface. Attempting to use `tiptap-utils` with modern Tiptap will likely lead to runtime errors or incorrect behavior.","severity":"breaking","affected_versions":"all"},{"fix":"Migrate to the equivalent functionalities offered by `@tiptap/core` (v2/v3) or relevant `@tiptap/*` extensions. This might require refactoring parts of your editor logic.","message":"This package has not received updates in approximately five years. Many of its functionalities have been superseded or integrated directly into the core `@tiptap/core` package and its extensions. Continuing to use `tiptap-utils` in new projects is strongly discouraged.","severity":"deprecated","affected_versions":"all"},{"fix":"Always verify the specific package you are intending to use. If targeting `@tiptap/core` v2/v3, rely solely on the official documentation and packages prefixed with `@tiptap/`.","message":"The package metadata provided in the prompt (recent releases) pertains to the *modern* `@tiptap` monorepo (v3.x) and not to the `tiptap-utils` package (v1.x) itself. Do not confuse `tiptap-utils`'s versioning and release history with the active development of `@tiptap/core`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using `tiptap-utils` with a Tiptap v1.x editor. If using Tiptap v2/v3, use the built-in `editor.state` property and the `editor.isActive()` method directly on the editor instance instead of `tiptap-utils` functions.","cause":"Attempting to pass a modern Tiptap v2/v3 `editor` instance or its internal state to a `tiptap-utils` function, which expects the structure of Tiptap v1.x.","error":"TypeError: editor.state is undefined"},{"fix":"Verify that `tiptap-utils` is installed correctly (`npm install tiptap-utils`). For ESM projects, use `import { markIsActive } from 'tiptap-utils';`. Ensure your bundler is configured to handle older CommonJS or UMD packages if necessary, though it's recommended to avoid this package entirely for modern projects.","cause":"Incorrect import statement (e.g., using `require` in an ESM project, or bundling issues) or attempting to access a non-existent export.","error":"Error: Cannot find module 'tiptap-utils' or SyntaxError: Named export 'markIsActive' not found."}],"ecosystem":"npm"}