volto icon indicating copy to clipboard operation
volto copied to clipboard

[CMSUI] - Investigate Plate.js as a drop-in replacement for Slate block

Open sneridagh opened this issue 10 months ago • 5 comments

PLIP (Plone Improvement Proposal)

Responsible Persons

Proposer: Víctor Fernández de Alba (@sneridagh)

Seconder:

Abstract

Use Plate.js as the rich text block in Seven. Plate.js is an editor based on Slate.

Motivation

Plate.js has a lot of traction, specially from the Next.js community. The community and contributors have grown the last months, and the documentation and the huge amount of plugins look quite convincing. The point that it's Slate what's on the underlying technology is very appealing, since an eventual site migration would be transparent.

Nowadays, we are using Slate barebones, developing by hand in volto-slate all the features we use. Developing a full-fledged and feature complete rich text editor is not an easy task, and the current status quo of volto-slate is concerning.

These are some of the unsolved bugs that still are lying around:

  • https://github.com/plone/volto/issues/3862
  • https://github.com/plone/volto/issues/3863
  • https://github.com/plone/volto/issues/3888
  • https://github.com/plone/volto/issues/3889
  • https://github.com/plone/volto/issues/3890
  • https://github.com/plone/volto/issues/3851
  • https://github.com/plone/volto/issues/3595

The editor has been always a pain point and an ever-present point of improvement. The community cannot afford the maintenance of such key feature. The number of the use cases, customized behaviors and potential bugs are simply too big.

For more info, check their documentation, the homepage has a demo.

Proposal & Implementation

Investigate if it's feasible, in a transparent fashion, and with minimum (or none) migration steps.

volto-slate would continue working for Volto. Seven will have the integration with Plate in a sustainable way, less code possible and all in @plone/blocks. Eventually, there should be nothing that prevents you from use it in Volto, if you want too.

Plate has documented the steps for migrating from a standard bare Slate integration:

https://platejs.org/docs/migration/slate-to-plate

At the end, we will not be changing the way the content is saved. Only changing the "jacket" of the slate block, by using the Plate components and plugins instead of the volto-slate ones.

Deliverables

The slate block will be powered by the Plate.js editor in @plone/blocks.

Risks

The change should be transparent, keeping any existing slate content untouched.

Participants

sneridagh avatar Feb 04 '25 22:02 sneridagh

@sneridagh To be honest, I'm not convinced. Can't we find some part of Volto that can stay the same instead of being rewritten?! I don't want to learn a gazillion new things; I want to keep a stable site running.

Nowadays, we are using Slate barebones, developing by hand all their features. Developing a full-fledged and feature complete rich text editor is not an easy task, and the current status quo of volto-slate is concerning. The editor has been always a pain point and an ever-present point of improvement. The community cannot afford the maintenance of such key feature.

On the contrary, we can't afford to leave control over such a key feature to an external project. We tried this in the past with tinymce in the days before volto, and it was impossible to achieve the UX we wanted and keep in sync with an external release cycle. It's a strength that we can make the editor work like we want without needing to convince another party to support it.

The change should be transparent, keeping any existing slate content.

I'm skeptical. All customizations built on top of volto-slate would need to be rewritten.

(Edited to add: I don't mean any of this as stop energy for investigating it. I'm just giving my initial gut reaction.)

davisagli avatar Feb 04 '25 22:02 davisagli

I appreciate the shininess of Plate, but I don't understand why it's necessary from reading this PLIP.

the current status quo of volto-slate is concerning

Can you elaborate? What makes the status quo concerning? Is Plate.js a replacement for volto-slate, effectively doing everything that volto-slate does but much more, supported by a larger and broader community, and better structured and designed?

from their website:

Include a link to the project when citing a source and to save a trip to the search engine farm.

from their [documentation](https://platejs.org/docs).

Its license must be mentioned.

We don't want another TinyMCE fiasco. I see they have a Plate Plus for a price. What assurance do we have that they just won't shove a component under the paid plan, like TinyMCE did with the accordion?

stevepiercy avatar Feb 04 '25 22:02 stevepiercy

I don't have a dog in this fight but I'm all for @davisagli point about not changing everything for the sake of changing everything.

I will point out that payload CMS switched from Slate to Lexical. I don't know their reasons but I suspect their needs are different. I suspect some of what they expect out of a rich text editor Volto does with blocks instead which I think is better. but if there is a need to change then Lexical should probably also be evaluated.

djay avatar Feb 05 '25 07:02 djay

@stevepiercy I removed the copy/pasta, added a link instead.

@davisagli @djay

I just wanted to leave this proposal in here. This community cannot maintain an in-house, full-fledged, pluggable, bugs free rich text editor. That's the summary. From here, let's discuss about it and the feasibility of this option, including what would be the migration (if any) and the side-effects that Steve pointed out. If during a sprint we can come up with a PoC to have a real grasp of what entails, it would be great.

sneridagh avatar Feb 05 '25 07:02 sneridagh

I have restarted studying and working on Volto Slate. I will try to maintain it. There are lots of bugs, it is true, but maybe Plate.js is too different as a foundation than Slate.js. If anyone works on this, please contact me on Discord. I am working here: https://github.com/plone/volto/tree/volto-slate-merge-with-previous-block-bug. Currently I study the code and how lists work when merging blocks with Delete or Backspace at the end or beginning of a block and I think the next commits will be big.

silviubogan avatar Jun 11 '25 12:06 silviubogan

When I consider both the feedback from our editors and my own experience as an editor with Volto, the WYSIWYG editor is the aspect I would like to improve the most. Except for the medium editor, who blew my mind, I have never encountered any editor in a web system that had an excellent UX and that worked flawlessly.

My personal gut feeling is that moving to a JSON-based editor might have been a mistake. Nothing trumps HTML in terms of interoperability and resilience. Slate often behaves strangely, and it is hard to reproduce the exact markup that led to this situation. I am no longer convinced that we can "fix" Slate to an extent that we can compete with other editors on the market.

Another recently discovered drawback is that copying and pasting content from an AI agent (ChatGPT, Claude) does not work very well. Not even when I convert to Markdown. I know that people put an incredible amount of work into this already, and I don't want to move to the next editor without careful consideration. However, trying out things might help us to make a more educated decision.

Anyway, I do not have to offer any intelligent recommendations or ways out. Just wanted to share my 2c.

tisto avatar Nov 03 '25 06:11 tisto