Skip to content
pandacoderz/ui

Editor Copilot

Selection toolbar with rewrite actions, inline diff acceptance, and ghost-text completion.

Open in new tab ↗

What’s inside

  • Selection toolbar appears above selected text with improve, shorten, expand, fix grammar, and translate.
  • Diff View shows the proposed rewrite sentence by sentence before you accept.
  • Ghost text offers a continuation after a pause; Tab accepts it.

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/editor-copilot.json

The registry item pulls in every component it depends on.

Usage

import EditorCopilot from "@/components/blocks/editor-copilot/editor-copilot";

export default function Page() {
  return (
    <div className="h-dvh p-4">
      <EditorCopilot />
    </div>
  );
}

Give the parent a bounded height. The block fills it and scrolls internally.

Going live

Swap rewrite for a model call that receives the paragraph and the action, and the ghost completion for a call that receives the trailing context. The selection math works on any block-level elements marked with data-para.