Payload Visual Editor screenshot

Payload Visual Editor

Author Avatar Theme by Pemedia
Updated: 14 Mar 2024
278 Stars

Payload CMS plugin which provides a visual live editor directly in the Admin UI. Works for collections and globals. Compatible with any kind of JS/TS based frontend technology.

Categories

Overview:

The Payload Visual Editor Plugin is a plugin that provides a visual live preview with a user-friendly interface for the Payload CMS. It is compatible with different versions of Payload. The plugin adds a visual editor component to collections and globals, creating a visual editor UI in the Admin UI’s edit view. It also handles the live data exchange with the frontend.

Features:

  • Adds visual editor component to collections and globals
  • Creates visual editor UI in the Admin UI’s edit view
  • Handles live data exchange with the frontend

Installation:

To install the Payload Visual Editor Plugin, follow these steps:

  1. Add the plugin to the plugins array in your Payload configuration with the following options:
{
  previewUrl: ({ locale: string }) => string,
  defaultPreviewMode: "iframe" | "popup" | "none",
  previewWidthInPercentage: number,
  collections / globals: Record<string, { previewUrl?: ({ locale: string }) => string }>
}
  1. Customize the options based on your needs. Make sure to provide a function that returns the URL to your frontend preview route. You can also specify the default preview mode and the width of the iframe preview.
  2. If you are using Localization with multiple locales, you can pass the locale to the previewUrl function in your Payload config to adjust the preview URL based on the selected/current locale.
  3. If you want to set up fallbacks for required fields in collections or globals, you can pass an object with configs for all collections/globals.
  4. Integrate the frontend preview in your React/Next.js route by using the provided code snippet to fetch the live post data from Payload.

Summary:

The Payload Visual Editor Plugin is a useful tool for the Payload CMS that adds a visual editor with a live preview to collections and globals. It simplifies the editing process and allows for real-time data exchange with the frontend. Installation is straightforward, and additional customization options are available for preview modes, width, and localization. The plugin also provides features like relation fallbacks and frontend integration in React/Next.js.