Adding SlateJS plugins #7769
Replies: 3 comments 8 replies
-
Not an answer to your question but Slate is deprecated. Is there a reason you can't switch to Lexical? |
Beta Was this translation helpful? Give feedback.
-
How is something so fundamentally basic not covered or this hard to answer? Boggles the mind honestly. |
Beta Was this translation helpful? Give feedback.
-
We have a project which is already in production for more then a year so i can't switch the rich text editor to Lexical so i dived a bit into the documentation of the SlateJS editor. Something like this should work (haven't tested is as i am building a translation button for the editor): import {withTable} from "slate-table";
const richTextElements: RichTextElement[] = [
"h2",
"h3",
"h4",
"h5",
"h6",
"link",
"ol",
"ul",
"indent",
"blockquote",
{
name: "instagramPost",
Button: InstagramPostButton,
Element: InstagramPostElement,
},
{
name: "table",
Button: // this is mandatory, so maybe just a dummy component....,
Element: // this is mandatory, so maybe just a dummy component....,
plugins: [(editor) => withTable(editor)],
},
]; I did not find a global plugin option in the slateJS config. |
Beta Was this translation helpful? Give feedback.
-
How would someone go about adding a plugin (https://github.com/nlulic/slate-table) to the slateJS implementation in Payload (v2)? This does not appear to work the normal way.
Beta Was this translation helpful? Give feedback.
All reactions