๐Ÿ“Œ About the Project: Click-Line

๐Ÿš€ Inspiration

Click-Line was born out of frustration with messy, off-by-one text selections and endless copy-paste cleanup while working on research pages, docs, and chat apps.

I wanted three things:

  1. Clean, word-perfect selection โ€” no dangling spaces or chopped words.
  2. Fast multi-selection โ€” grab multiple snippets and copy them all at once.
  3. Smarter Enter key control โ€” avoid fighting sites when sending vs. adding a newline.

That โ€œone small annoyance, repeated thousands of timesโ€ feeling was the real spark behind this project.


๐Ÿ›  How I Built It

๐Ÿ”น Platform

  • Chrome Extension (Manifest V3)

๐Ÿ”น Architecture

  • Content script
    Handles selection snapping, multi-selection, highlighting, Alt+Drag link copy, and Enter behavior tweaks.
  • Background service worker
    Powers right-click (context menu) search actions.
  • Popup UI (HTML/CSS/JS)
    Settings, rules, and quick toggles.

๐Ÿ”น Data Flow

  • Settings stored in chrome.storage.local
  • Live sync via chrome.storage.onChanged
  • No tabs permission or broadcasting

๐Ÿ”น Selection & Highlighting

  • Word snapping: via DOM Range API + configurable regex (e.g., \w\-)
  • Highlighting:
    • Uses CSS Custom Highlight API when available
    • Falls back to a lightweight overlay div system
  • Performance: redraws handled with requestAnimationFrame, scroll/resize safe

๐Ÿ”น Editor Handling

  • Smart Enter behavior
    • Enter = newline
    • Shift+Enter = send
  • Heuristics include:
    • enterkeyhint detection (send, go, search)
    • helper text like โ€œShift+Enter to add a new lineโ€
  • Special case: ChatGPT (ProseMirror quirks โ†’ fixed spacing + true breaks)
  • Exclusions: Code editors like Monaco, CodeMirror, Ace

๐Ÿ”น UX Shortcuts

  • Ctrl+Drag โ†’ add selections
  • Ctrl+C โ†’ copy combined (newline / space / bullet separated)
  • Ctrl+Z / Ctrl+Y โ†’ undo/redo
  • Ctrl+Shift+L โ†’ lock selections
  • Esc โ†’ clear
  • Alt+Drag on a link โ†’ copy URL (subtle toast confirmation)
  • Context menu โ†’ quick search (Google / YouTube / Wikipedia)

๐Ÿ”น Permissions

  • storage, clipboardWrite, contextMenus
  • host_permissions: <all_urls> โ†’ runs automatically everywhere
  • No: tabs, optional permissions, remote code, or analytics

โšก Challenges & Solutions

  • Consistent word snapping across complex DOMs
    โ†’ Robust Range boundary logic + TreeWalker fallback

  • Reliable highlighting across browsers
    โ†’ CSS Highlight API where possible; overlay fallback otherwise

  • Avoid breaking site/editor behavior
    โ†’ Capture-phase key handling with strict editable checks

  • ProseMirror quirks (ChatGPT newlines/spaces)
    โ†’ Careful caret + node handling

  • Performance with multiple selections
    โ†’ Batched DOM updates + requestAnimationFrame rendering

  • Chrome Web Store review hurdles
    โ†’ Trimmed unused code & permissions, aligned justifications with actual features


๐Ÿ“š What I Learned

  • The CSS Custom Highlight API gives smooth UX with almost no DOM churnโ€”but fallbacks are mandatory.
  • MV3 service workers + content scripts work best when the heavy lifting stays in the content layer.
  • Input behavior heuristics need to be conservativeโ€”editor ecosystems vary a lot.
  • Fewer permissions + clear docs = easier reviews and higher user trust.
  • Tiny UX touches (toast notifications, lock mode, undo/redo) add disproportionate value to perceived quality.

โœจ Thatโ€™s Click-Line: a small tool to fix the tiny paper-cuts of everyday browsing, so you can stay focused on your work instead of fighting the UI.

Built With

Share this project:

Updates