CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-tiptap--extension-typography

tessl install tessl/npm-tiptap--extension-typography@3.4.0

Typography extension for Tiptap that automatically converts common text input patterns into proper typographic characters.

Agent Success

Agent success rate when using this tile

73%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.86x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-5/

Rich Text Link Manager

Build a link management utility for a rich text editor that allows users to insert, update, and query hyperlinks with proper URL and attribute handling.

Capabilities

Link Insertion

  • It inserts a new hyperlink at the current selection with a given URL and optional attributes @test
  • It creates a link with custom attributes like target and rel @test

Link Updates and Removal

  • It updates the URL of an existing link without changing the link text @test
  • It removes a link while preserving the text content @test

Link Query

  • It detects whether the current selection contains an active link @test
  • It retrieves the URL and attributes of a link at the current cursor position @test

Implementation

The implementation should create a wrapper around the editor's link management capabilities that provides a clean API for common link operations.

@generates

API

import { Editor } from '@tiptap/core';

/**
 * Link management utility for rich text editors
 */
export class LinkManager {
  /**
   * Creates a new LinkManager instance
   * @param editor - The editor instance to manage links for
   */
  constructor(editor: Editor);

  /**
   * Inserts or updates a link at the current selection
   * @param url - The URL for the link
   * @param options - Optional link attributes
   * @returns true if successful, false otherwise
   */
  setLink(url: string, options?: { target?: string; rel?: string }): boolean;

  /**
   * Removes the link at the current selection while preserving text
   * @returns true if successful, false otherwise
   */
  removeLink(): boolean;

  /**
   * Checks if the current selection contains an active link
   * @returns true if a link is active, false otherwise
   */
  hasActiveLink(): boolean;

  /**
   * Gets the attributes of the link at the current selection
   * @returns Object containing link attributes (href, target, rel) or null
   */
  getLinkAttributes(): { href: string; target?: string; rel?: string } | null;

  /**
   * Updates specific attributes of an existing link
   * @param attributes - Attributes to update
   * @returns true if successful, false otherwise
   */
  updateLinkAttributes(attributes: { href?: string; target?: string; rel?: string }): boolean;
}

Dependencies { .dependencies }

@tiptap/core { .dependency }

Provides the core editor framework and extension system.

@tiptap/extension-link { .dependency }

Provides link node type and link-specific commands for creating and managing hyperlinks in the editor.

@tiptap/starter-kit { .dependency }

Provides basic editor functionality including document structure, paragraphs, and text formatting.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@tiptap/extension-typography@3.4.x
tile.json