# niclasdev63/tiptap-extension-global-drag-handle architecture

> Architecture diagram of the GitHub repository niclasdev63/tiptap-extension-global-drag-handle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/niclasdev63/tiptap-extension-global-drag-handle
- Repository: https://github.com/niclasdev63/tiptap-extension-global-drag-handle

## Overview

##### Main Components

a) Core Components:
- Tiptap Editor Integration Point
- GlobalDragHandle Extension Core
- Configuration Manager
- Event Handler System
- DOM Manipulation Layer

b) Feature Modules:
- Drag Handle Manager
- Auto-scroll Controller
- Node Selection System
- Custom Node Handler

**┌─ Application Layer ─────────────────────┐**
- [Tiptap Editor Instance]               │
- ↕                            │
- [GlobalDragHandle Extension]           │
- Core Services ──────────────────────────┤
- ┌─ Configuration ─┐ ┌─ DOM Handler ─┐  │
- dragHandle    │ │ - Selection   │  │
- Width         │ │ - Node        │  │
- scrollThresh  │ │   Manipulation│  │
- ┘ └──────────────┘   │
- Feature Services ────────────────────────┤
- ┌─ Drag System ──┐ ┌─ Scroll ──────┐  │
- Handle       │ │ - Threshold    │  │
- Management   │ │   Control      │  │
- Event        │ │ - Auto-scroll  │  │
- Handling     │ │   Logic        │  │
- ┘ └──────────────┘   │
- ┘

##### Important Elements to Highlight

a) Integration Points:
- How the extension connects to Tiptap
- Configuration injection points

b) Data Flow:
- DOM manipulation paths
- Configuration data flow

c) External Dependencies:
- Optional integration with AutoJoiner extension
- CSS styling integration points

**┌─ Configuration Options ─────────┐**
- dragHandleWidth              │
- scrollTreshold               │
- dragHandleSelector           │
- excludedTags                 │
- customNodes                  │
- ┘

##### Implementation Details

Relationship between:
- Custom node handling
- Excluded tags processing
- DOM event listeners
- Scroll threshold monitoring

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Application
        TiptapEditor["Tiptap Editor Instance"]
        GlobalDragHandle["GlobalDragHandle Extension"]:::extension
    end

    subgraph Core
        ConfigManager["Configuration Manager"]:::config
        DOMHandler["DOM Handler"]:::core
        EventSystem["Event Handler System"]:::core
    end

    subgraph Features
        DragManager["Drag Handle Manager"]:::feature
        ScrollController["Auto-scroll Controller"]:::feature
        NodeSelection["Node Selection System"]:::feature
        CustomNodeHandler["Custom Node Handler"]:::feature
    end

    subgraph Configuration
        ConfigOptions["Configuration Options"]:::config
        style ConfigOptions fill:#f9f,stroke:#333,stroke-width:2px
        ConfigParams[" - dragHandleWidth<br/> - scrollThreshold<br/> - dragHandleSelector<br/> - excludedTags<br/> - customNodes"]:::config
    end

    %% Relationships
    TiptapEditor <--> GlobalDragHandle
    GlobalDragHandle --> ConfigManager
    GlobalDragHandle --> DOMHandler
    GlobalDragHandle --> EventSystem

    ConfigManager --> ConfigOptions
    ConfigOptions --> ConfigParams

    DOMHandler --> NodeSelection
    DOMHandler --> CustomNodeHandler

    EventSystem --> DragManager
    EventSystem --> ScrollController

    %% Component Mappings
    click GlobalDragHandle "https://github.com/NiclasDev63/tiptap-extension-global-drag-handle/blob/master/src/index.ts"
    click ConfigManager "https://github.com/NiclasDev63/tiptap-extension-global-drag-handle/blob/master/package.json"
    click ConfigOptions "https://github.com/NiclasDev63/tiptap-extension-global-drag-handle/blob/master/tsconfig.json"

    %% Styling
    classDef extension fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef feature fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef config fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Extension Component"]:::extension
        L2["Core Component"]:::core
        L3["Feature Component"]:::feature
        L4["Configuration Component"]:::config
    end
```
