Skip to content

Commit 1a4ce44

Browse files
authored
refactor(richtext-slate): deprecate slate editor (#14536)
The old Slate-based rich text editor is no longer receiving updates and will be fully removed in Payload 4.0. To give developers an early heads-up and encourage migration, this PR marks richtext-slate as deprecated in preparation for its removal. We recommend switching to Lexical as the supported rich text editor moving forward.
1 parent 072cb97 commit 1a4ce44

File tree

6 files changed

+50
-7
lines changed

6 files changed

+50
-7
lines changed

docs/rich-text/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ title: Rich Text Editor
99
<Banner type="success">
1010

1111
This documentation is about our new editor, based on Lexical (Meta's rich text editor). The previous default
12-
editor was based on Slate and is still supported. You can read [its documentation](/docs/rich-text/slate),
13-
or the optional [migration guide](/docs/rich-text/migration) to migrate from Slate to Lexical (recommended).
12+
editor, based on Slate, has been deprecated and will be removed in 4.0. You can read [its documentation](/docs/rich-text/slate),
13+
or the [migration guide](/docs/rich-text/migration) to migrate from Slate to Lexical (recommended).
1414

1515
</Banner>
1616

docs/rich-text/slate.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
title: Slate Editor
33
label: Slate (legacy)
44
order: 100
5-
desc: The Slate editor has been supported by Payload since beta. It's very powerful and stores content as JSON, which unlocks a ton of power.
6-
keywords: slatejs, slate, rich text, editor, headless cms
5+
desc: The Slate editor is our old rich text editor and will be removed in 4.0.
6+
keywords: slatejs, slate
77
---
88

99
<Banner type="warning">
1010

11-
The [default Payload editor](/docs/rich-text/overview) is currently based on Lexical. This documentation
12-
is about our old Slate-based editor. You can continue using it because it is still supported, or you can
13-
see the optional [migration guide](/docs/rich-text/migration) to migrate from Slate to Lexical (recommended).
11+
The [default Payload editor](/docs/rich-text/overview) is currently based on Lexical. This documentation is about our old Slate-based editor which has been deprecated and will be removed in 4.0. We recommend [migrating to Lexical](/docs/rich-text/migration) instead.
1412

1513
</Banner>
1614

packages/richtext-slate/src/cell/rscEntry.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { Link } from '@payloadcms/ui'
55
import { formatAdminURL } from 'payload/shared'
66
import React from 'react'
77

8+
/**
9+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
10+
*/
811
export const RscEntrySlateCell: React.FC<
912
{
1013
i18n: I18nClient

packages/richtext-slate/src/field/rscEntry.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import { elements as elementTypes } from '../field/elements/index.js'
1919
import { defaultLeaves as leafTypes } from '../field/leaves/index.js'
2020
import { linkFieldsSchemaPath } from './elements/link/shared.js'
2121
import { uploadFieldsSchemaPath } from './elements/upload/shared.js'
22+
23+
/**
24+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
25+
*/
2226
export const RscEntrySlateField: React.FC<
2327
{
2428
args: AdapterArguments

packages/richtext-slate/src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { transformExtraFields } from './field/elements/link/utilities.js'
1111
import { defaultLeaves as leafTypes } from './field/leaves/index.js'
1212
import { getGenerateSchemaMap } from './generateSchemaMap.js'
1313

14+
/**
15+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
16+
*/
1417
export function slateEditor(
1518
args: AdapterArguments,
1619
): RichTextAdapterProvider<any[], AdapterArguments, any> {

packages/richtext-slate/src/types.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,56 @@ import type {
77
} from 'payload'
88
import type { Editor } from 'slate'
99

10+
/**
11+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
12+
*/
1013
export type TextNode = { [x: string]: unknown; text: string }
1114

15+
/**
16+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
17+
*/
1218
export type ElementNode = { children: (ElementNode | TextNode)[]; type?: string }
1319

20+
/**
21+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
22+
*/
1423
export function nodeIsTextNode(node: ElementNode | TextNode): node is TextNode {
1524
return 'text' in node
1625
}
1726

27+
/**
28+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
29+
*/
1830
export type RichTextPluginComponent = PayloadComponent
31+
32+
/**
33+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
34+
*/
1935
export type RichTextPlugin = (editor: Editor) => Editor
2036

37+
/**
38+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
39+
*/
2140
export type RichTextCustomElement = {
2241
Button?: PayloadComponent
2342
Element: PayloadComponent
2443
name: string
2544
plugins?: RichTextPluginComponent[]
2645
}
2746

47+
/**
48+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
49+
*/
2850
export type RichTextCustomLeaf = {
2951
Button: PayloadComponent
3052
Leaf: PayloadComponent
3153
name: string
3254
plugins?: RichTextPluginComponent[]
3355
}
3456

57+
/**
58+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
59+
*/
3560
export type RichTextElement =
3661
| 'blockquote'
3762
| 'h1'
@@ -49,6 +74,10 @@ export type RichTextElement =
4974
| 'ul'
5075
| 'upload'
5176
| RichTextCustomElement
77+
78+
/**
79+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
80+
*/
5281
export type RichTextLeaf =
5382
| 'bold'
5483
| 'code'
@@ -57,6 +86,9 @@ export type RichTextLeaf =
5786
| 'underline'
5887
| RichTextCustomLeaf
5988

89+
/**
90+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
91+
*/
6092
export type AdapterArguments = {
6193
admin?: {
6294
elements?: RichTextElement[]
@@ -77,6 +109,9 @@ export type AdapterArguments = {
77109
}
78110
}
79111

112+
/**
113+
* @deprecated - slate will be removed in 4.0. Please [migrate our new, lexical-based rich text editor](https://payloadcms.com/docs/rich-text/migration#migrating-from-slate).
114+
*/
80115
export type SlateFieldProps = {
81116
componentMap: {
82117
[x: string]: ClientField[] | React.ReactNode

0 commit comments

Comments
 (0)