omaroubari

payloadcms visual editor

by omaroubari
Publishing workflow
v3
^3.82.1

Overview

Summary generated from the README

Adds a frontend toolbar that lets editors click CMS-managed text on a draft page to edit, save a draft or publish without opening the admin panel. The plugin adds a virtual source map field to configured collections, and a helper turns it into attributes for your elements. An annotation mode places numbered markers with comments and can export markdown or send events to a webhook. Requires draft mode on the collections.

Features

  • Click-to-edit for text fields directly on the live page
  • Save draft or publish from the toolbar
  • Annotation mode with numbered markers and comments
  • Export annotations as markdown or send them to a webhook
  • Per-collection enablement through plugin config
  • Draggable toolbar with dark and light theme and keyboard shortcut

Use cases

  • Let content editors fix copy on a draft page without switching to the admin panel
  • Collect visual feedback on layout and styling and route it to developers or GitHub issues
  • Send page annotations to an AI agent or CI pipeline through a webhook

From the author

A Payload CMS plugin for inline editing and visual feedback.

Installation

npm i payloadcms-visual-editor

18

Stars

1

Forks

6

Open Issues

4 days ago

Last Updated

79

Weekly Downloads

v0.0.2

npm Version

1.0 MB

Unpacked Size

0

Dependencies

GitHub stars

18+6 since Sep 7

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 202618
Dec 5, 202618
Dec 4, 202618
Dec 3, 202618
Dec 2, 202618
Dec 1, 202618
Nov 30, 202618
Nov 29, 202618
Nov 28, 202618
Nov 27, 202618
Nov 26, 202618
Nov 25, 202618
Nov 24, 202618
Nov 23, 202618
Nov 22, 202618
Nov 21, 202618
Nov 20, 202618
Nov 19, 202618
Nov 18, 202618
Nov 17, 202618
Nov 16, 202618
Nov 15, 202618
Nov 14, 202618
Nov 13, 202618
Nov 12, 202618
Nov 11, 202618
Nov 10, 202618
Nov 9, 202617
Nov 8, 202618
Nov 7, 202618
Nov 6, 202618
Nov 5, 202618
Nov 4, 202618
Nov 3, 202618
Nov 2, 202618
Nov 1, 202618
Oct 31, 202618
Oct 30, 202618
Oct 29, 202618
Oct 28, 202617
Oct 27, 202617
Oct 26, 202617
Oct 25, 202617
Oct 24, 202617
Oct 23, 202617
Oct 22, 202617
Oct 21, 202616
Oct 20, 202616
Oct 19, 202616
Oct 18, 202616
Oct 17, 202616
Oct 16, 202616
Oct 15, 202616
Oct 14, 202615
Oct 13, 202615
Oct 12, 202615
Oct 11, 202615
Oct 10, 202615
Oct 9, 202615
Oct 8, 202615
Oct 7, 202615
Oct 6, 202615
Oct 5, 202614
Oct 4, 202614
Oct 3, 202614
Oct 2, 202614
Oct 1, 202614
Sep 30, 202614
Sep 29, 202613
Sep 28, 202613
Sep 27, 202613
Sep 26, 202613
Sep 25, 202613
Sep 24, 202613
Sep 23, 202613
Sep 22, 202613
Sep 21, 202613
Sep 20, 202613
Sep 19, 202613
Sep 18, 202613
Sep 17, 202613
Sep 16, 202612
Sep 15, 202612
Sep 14, 202612
Sep 13, 202612
Sep 12, 202612
Sep 11, 202612
Sep 10, 202612
Sep 9, 202612
Sep 8, 202612
Sep 7, 202612
npm weekly downloads

59+41 since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202659
Dec 5, 202636
Dec 4, 202636
Dec 3, 202630
Dec 2, 202627
Dec 1, 202639
Nov 30, 202651
Nov 29, 202671
Nov 28, 202683
Nov 27, 2026102
Nov 26, 202697
Nov 25, 2026102
Nov 24, 202695
Nov 23, 202690
Nov 22, 202692
Nov 21, 202699
Nov 20, 2026102
Nov 19, 2026119
Nov 18, 2026117
Nov 17, 2026112
Nov 16, 2026105
Nov 15, 202691
Nov 14, 202696
Nov 13, 202684
Nov 12, 202671
Nov 11, 202663
Nov 10, 202665
Nov 9, 202666
Nov 8, 202660
Nov 7, 202640
Nov 6, 202633
Nov 5, 202628
Nov 4, 202627
Nov 3, 202625
Nov 2, 202626
Nov 1, 202626
Oct 31, 202627
Oct 30, 202625
Oct 29, 202620
Oct 28, 202616
Oct 27, 202616
Oct 26, 202615
Oct 25, 202615
Oct 24, 202619
Oct 23, 202615
Oct 22, 202628
Oct 21, 202636
Oct 20, 202636
Oct 19, 202634
Oct 18, 202635
Oct 17, 202630
Oct 16, 202635
Oct 15, 202624
Oct 14, 202618
Oct 13, 202618
Oct 12, 202619
Oct 11, 202620
Oct 10, 202637
Oct 9, 202635
Oct 8, 202693
Oct 7, 202695
Oct 6, 202698
Oct 5, 202698
Oct 4, 202694
Oct 3, 202676
Oct 2, 202676
Oct 1, 202618
Sep 30, 202615
Sep 29, 202612
Sep 28, 202612
Sep 27, 202613
Sep 26, 202615
Sep 25, 202613
Sep 24, 202616
Sep 23, 202623
Sep 22, 202625
Sep 21, 202625
Sep 20, 202625
Sep 19, 202622
Sep 18, 202622
Sep 17, 202619
Sep 16, 202614
Sep 15, 202613
Sep 14, 202615
Sep 13, 202614
Sep 12, 202613
Sep 11, 202616
Sep 10, 202615
Sep 9, 202616
Sep 8, 202615
Sep 7, 202618

Each point is npm's rolling 7-day download count.

Health Score

49/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1213841375-root.svg)](https://payloaddirectory.dev/plugins/1213841375-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1213841375-root"><img src="https://payloaddirectory.dev/badge/1213841375-root.svg" alt="Payload Directory"></a>
Updated Dec 1, 2026Created Apr 17, 2026Published May 5, 2026

README

Payload Visual Editor

License: MIT

Edit CMS content directly on your live pages. Annotate everything else.

Payload Visual Editor eliminates the round-trip between your frontend and the admin panel. Content editors click and edit text fields right where they appear on the page. For elements that live in code (layout, styling, components), switch to annotation mode — place visual markers with comments and send the feedback to your developers, GitHub issues, or an AI agent via webhooks.

Features

  • Inline Content Editing — Click any CMS-managed text field on your page to edit, save as draft, or publish without ever opening the admin panel (text fields only — other fields coming soon)
  • Visual Annotation Mode — Place numbered markers anywhere on the page — perfect for elements that live in code rather than your CMS
  • Route Feedback Anywhere — Export annotations as markdown, send them to a webhook (GitHub issues, CI pipelines, dev notifications), or connect to an AI agent via MCP (coming soon)
  • Draft-Aware — Full integration with Payload's draft mode, including save and publish from the toolbar
  • React Component Detection — Annotate with React component paths in development mode
  • Draggable & Customizable — Repositionable toolbar, dark/light theme, 7 marker colors, keyboard shortcuts (Cmd+Shift+F to toggle)
  • Per-Collection Configuration — Enable or disable editing per Payload collection

Demo

Installation

npm install payloadcms-visual-editor
# or
pnpm add payloadcms-visual-editor
# or
yarn add payloadcms-visual-editor

Requirements

  • Payload CMS 3.x
  • Draft mode configured on your collections

Note: The visual editor requires Payload's draft mode to be enabled. When fetching documents, pass contentSourceMap: true in the query context to populate the _sourceMap field.

Quick Start

1. Add the plugin to your Payload config

// payload.config.ts
import { payloadVisualEditor } from 'payloadcms-visual-editor'

export default buildConfig({
  plugins: [
    payloadVisualEditor({
      collections: {
        pages: true,
        posts: true,
      },
    }),
  ],
})

2. Mark your frontend elements as editable

Use the createEditableAttrs helper to extract editable paths from the _sourceMap field, then spread the attributes on your elements.

// app/(frontend)/[slug]/page.tsx
import { getPayload } from 'payload'
import { createEditableAttrs } from 'payloadcms-visual-editor'

export default async function Page({ params }) {
  const payload = await getPayload({ config: configPromise })

  const pageResult = await payload.find({
    collection: 'pages',
    context: {
      contentSourceMap: true,
    },
    draft: true,
    limit: 1,
  })

  const page = pageResult.docs[0]
  const editable = createEditableAttrs(page._sourceMap)

  return (
    <main>
      <h1 {...editable('title')}>{page.title}</h1>
      <p {...editable('description')}>{page.description}</p>
    </main>
  )
}

3. Mount the toolbar on your page

import { VisualEditorToolbar } from 'payloadcms-visual-editor/client'

{
  draft && page._sourceMap ? (
    <VisualEditorToolbar
      documentInfo={{
        id: page.id,
        collection: 'pages',
        hasDrafts: true,
      }}
    />
  ) : null
}

4. Start editing

Visit any draft page on your frontend. The toolbar appears at the bottom of the viewport. Click any editable element to edit it inline, or switch to annotation mode to leave visual feedback.

Configuration

Plugin Options

payloadVisualEditor({
  collections: {
    // Keys are collection slugs, values enable the plugin for that collection
    pages: true,
    posts: true,
  },
  // Set to true to disable the plugin without removing it from config
  disabled: false,
})

VisualEditorToolbar Props

Required:

PropTypeDescription
documentInfo{ id: string | number; collection: string; hasDrafts: boolean }Payload CMS document metadata for the current page

Optional:

PropTypeDefaultDescription
classNamestring-Custom class applied to the toolbar container
copyToClipboardbooleantrueCopy markdown output to clipboard when copy button is clicked
endpointstring-Server URL for sync (e.g. "http://localhost:4747")
sessionIdstring-Pre-existing session ID to join
webhookUrlstring-Webhook URL to receive annotation events
enableDemoModebooleanfalseEnable demo mode with sample annotations
demoAnnotationsDemoAnnotation[]-Array of demo annotations to display
demoDelaynumber1000Delay in ms before showing demo annotations
onAnnotationAdd(annotation: Annotation) => void-Callback fired when an annotation is added
onAnnotationDelete(annotation: Annotation) => void-Callback fired when an annotation is deleted
onAnnotationUpdate(annotation: Annotation) => void-Callback fired when an annotation comment is edited
onAnnotationsClear(annotations: Annotation[]) => void-Callback fired when all annotations are cleared
onCopy(markdown: string) => void-Callback fired when copy button is clicked
onSubmit(output: string, annotations: Annotation[])-Callback fired when "Send to Agent" is clicked
onSessionCreated(sessionId: string) => void-Called when a new session is created

How It Works

  1. Plugin injection — The plugin adds a virtual _sourceMap JSON field to each configured collection
  2. Query with contentSourceMap — When you query a document with context: { contentSourceMap: true }, Payload populates the _sourceMap field with content-to-path mappings
  3. createEditableAttrs() — Extracts paths from _sourceMap and returns data-payload-path attributes to spread on your elements
  4. Toolbar activation — The VisualEditorToolbar reads these attributes to identify editable elements, enabling click-to-edit and annotation on your live pages
┌─────────────────────────────────────────────────────────┐
│  Payload Query (contentSourceMap: true)                  │
│         ↓                                                │
│  _sourceMap field populated with content-to-path data    │
│         ↓                                                │
│  createEditableAttrs() → data-payload-path attributes    │
│         ↓                                                │
│  VisualEditorToolbar reads paths → enables editing       │
└─────────────────────────────────────────────────────────┘

Contributing

Clone the repo and install dependencies:

git clone https://github.com/<your-org>/payloadcms-visual-editor
cd payloadcms-visual-editor
pnpm install

Set up the dev environment:

cp dev/.env.example dev/.env
# Update DATABASE_URL and PAYLOAD_SECRET in dev/.env

Start the dev server:

pnpm dev

Visit http://localhost:3000 to see the demo app.

Testing & Linting

pnpm test        # Run integration + e2e tests
pnpm test:int    # Integration tests only
pnpm test:e2e    # E2E tests only
pnpm lint        # Lint source files
pnpm lint:fix    # Auto-fix lint issues
pnpm typecheck   # Run TypeScript type checking
pnpm build       # Build the package

Attribution

This plugin is based on Agentation by Benji Taylor. The original project provides an annotation toolbar for visual feedback on web pages. This plugin adapts those concepts and integrates them with Payload CMS for inline content editing and draft-aware annotation workflows.

The dev server website design is based on Tailark's Mist component kit by Méschac Irung.

License

MIT

Similar plugins