rubn-g

payloadcms lexical ext

by rubn-g
Rich text & editors
v?
MIT

Overview

Summary generated from the README

Adds extra features to the Payload Lexical rich text editor. Each feature is imported and added to the lexicalEditor features array, and can be used on its own or combined. JSX and HTML converters are provided to render the content on the frontend, and a CSS file must be imported for the color features.

Features

  • Text color feature with configurable color buttons
  • Text highlight feature for background color on selected text
  • Block background color for whole content blocks
  • YouTube and Vimeo video embeds inside the editor
  • JSX and HTML converters for rendering the content

Use cases

  • Style article text with custom colors and highlights in the admin editor
  • Embed YouTube or Vimeo videos directly in rich text content
  • Render colored and embedded content on a frontend using the provided converters

From the author

Extended lexical editor features for Payload CMS

Installation

npm i payloadcms-lexical-ext

73

Stars

19

Forks

14

Open Issues

1 years ago

Last Updated

1.3k

Weekly Downloads

v0.5.3

npm Version

171.0 KB

Unpacked Size

2

Dependencies

GitHub stars

730 since Sep 6

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

1.1K−177 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20261,135
Dec 4, 20261,642
Dec 3, 20262,588
Dec 2, 20263,084
Dec 1, 20263,086
Nov 30, 20263,321
Nov 29, 20264,312
Nov 28, 20264,781
Nov 27, 20264,528
Nov 26, 20264,194
Nov 25, 20263,708
Nov 24, 20263,740
Nov 23, 20263,602
Nov 22, 20263,136
Nov 21, 20263,170
Nov 20, 20263,843
Nov 19, 20263,482
Nov 18, 20263,644
Nov 17, 20263,569
Nov 16, 20263,666
Nov 15, 20263,463
Nov 14, 20263,369
Nov 13, 20262,845
Nov 12, 20263,027
Nov 11, 20262,870
Nov 10, 20262,870
Nov 9, 20262,661
Nov 8, 20263,323
Nov 7, 20263,780
Nov 6, 20263,685
Nov 5, 20263,305
Nov 4, 20263,315
Nov 3, 20263,316
Nov 2, 20263,389
Nov 1, 20262,929
Oct 31, 20262,516
Oct 30, 20262,362
Oct 29, 20262,022
Oct 28, 20261,598
Oct 27, 20261,611
Oct 26, 20261,621
Oct 25, 20261,707
Oct 24, 20261,855
Oct 23, 20261,527
Oct 22, 20261,921
Oct 21, 20262,589
Oct 20, 20262,591
Oct 19, 20262,552
Oct 18, 20261,987
Oct 17, 20261,375
Oct 16, 20261,456
Oct 15, 20261,490
Oct 14, 20261,239
Oct 13, 20261,221
Oct 12, 20261,193
Oct 11, 20261,207
Oct 10, 20261,378
Oct 9, 20261,501
Oct 8, 20261,228
Oct 7, 20261,187
Oct 6, 20261,219
Oct 5, 20261,215
Oct 4, 20261,409
Oct 3, 20261,781
Oct 2, 20262,001
Oct 1, 20262,179
Sep 30, 20262,152
Sep 29, 20262,164
Sep 28, 20262,163
Sep 27, 20262,085
Sep 26, 20261,744
Sep 25, 20261,508
Sep 24, 20261,792
Sep 23, 20261,884
Sep 22, 20261,891
Sep 21, 20261,920
Sep 20, 20262,163
Sep 19, 20262,283
Sep 18, 20262,760
Sep 17, 20262,559
Sep 16, 20262,213
Sep 15, 20262,203
Sep 14, 20262,197
Sep 13, 20262,036
Sep 12, 20261,917
Sep 11, 20261,464
Sep 10, 20261,356
Sep 9, 20261,441
Sep 8, 20261,420
Sep 7, 20261,410
Sep 6, 20261,312

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

Health Score

47/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/907855621-root.svg)](https://payloaddirectory.dev/plugins/907855621-root)
HTML
<a href="https://payloaddirectory.dev/plugins/907855621-root"><img src="https://payloaddirectory.dev/badge/907855621-root.svg" alt="Payload Directory"></a>
Updated Jan 27, 2025Created Dec 24, 2024Published Jan 27, 2025

README

Payload CMS lexical editor extend

🚀 Overview

Ideal for content creators and developers who want to enrich their text content with more visual appeal.

This plugin adds new features to the Payload CMS lexical editor. You can use any of the features on its own or all of them togehter:

  • Text Color – Customize the color of selected text.
  • Text Highlight – Highlight text with a background color.
  • Block Background Color – Apply background colors to entire blocks of content.
  • Embed videos - Add embedded youtube or vimeo videos to the content of the editor

New features will be added - Create issues for new features or create them yourself and create a PR to share it with the community

📸 Screenshots

Text Color Feature

Text Color Example

Text Highlight Feature

Text Highlight Example

Block Background Feature

Block Background Example

Embed Video Feature

Embed Video Example

📦 Installation

npm install payloadcms-lexical-ext

or

yarn add payloadcms-lexical-ext

🛠️ Usage

  1. Import the features you want to use:
import { BgColorFeature, HighlightColorFeature, TextColorFeature, YoutubeFeature, VimeoFeature } from 'payloadcms-lexical-ext';
  1. If you're using any of the color features, import required css
import 'payloadcms-lexical-ext/client/client.css'
  1. Add features to your lexical editor configuration:
lexicalEditor({
	features: [
		...defaultEditorFeatures,
		...YourFeatures...
		TextColorFeature(),
		HighlightColorFeature(),
		BgColorFeature(),
		YoutubeFeature(),
		VimeoFeature()
	]
});
  1. Add JSX or HTML converters

    4.1 JSX Converters

    components/RichText/index.tsx

    import { JSXConverters } from 'payloadcms-lexical-ext'
    
    const jsxConverters: JSXConvertersFunction<NodeTypes> = ({ defaultConverters }) => ({
    	...defaultConverters,
    	...JSXConverters
    })
    

    4.2 HTML Converters

    import { consolidateHTMLConverters, convertLexicalToHTML, sanitizeServerEditorConfig } from '@payloadcms/richtext-lexical'
    import { HTMLConverters } from 'payloadcms-lexical-ext'
    
    ...
    
    const sanitizedEditorConfig = await sanitizeServerEditorConfig(editorConfig, req.payload.config)
    
    await convertLexicalToHTML({
    	converters: [
    		...HTMLConverters,
    		...consolidateHTMLConverters({ editorConfig: sanitizedEditorConfig })
    	],
    	data: jsonEditorContent,
    	req,
    })
    

⚙️ Configuration Options

The plugin comes with several customizable options:

TextColorFeature({
	colors: [{
		type: 'button',
		label: 'Custom color',
		color: '#1155aa'
	}]
});

🧑‍💻 Contributing

Contributions are welcome! To get started:

  1. Fork the repository.
  2. Create a new branch for your feature.
  3. Submit a pull request.

📝 License

This project is licensed under the MIT License.

📬 Contact

For questions or suggestions, feel free to open an issue or reach out to the Payload CMS community.

Similar plugins