Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider replacing Draft.js #10684

Closed
swissspidy opened this issue Feb 23, 2022 · 4 comments
Closed

Consider replacing Draft.js #10684

swissspidy opened this issue Feb 23, 2022 · 4 comments
Labels
Elements: Text P3 Nice to have Package: Rich Text /packages/rich-text Type: Task Tasks which do not involve engineering

Comments

@swissspidy
Copy link
Collaborator

Task Description

When we originally built the first version of text editing in the story editor, Draft.js was chosen for the job. At the time it was a proven and compelling rich text editor that fit our needs well.

For some extra functionality we also use the draft-js-import-html, draft-js-export-html and draftjs-filters packages.

For draft-js-import-html (which uses another package draft-js-import-element) we needed some extra functionality, so we patched the package ourselves using patch-package. See https://github.com/GoogleForCreators/web-stories-wp/blob/5e01de8e6ad44c633b24dcfbbb0867ff4960f212/patches/draft-js-import-element%2B1.4.0.patch.

This patch has not been merged to this day. See sstur/draft-js-utils#155.

As made evident by #10597, our editor does not work without this patch. Patching does not work for packages that we want to publish to npm, so if we want to make it work there we need to fork the package. That works fine for the short term, but is not something we'd like to maintain permanently.

Unfortunately things don't look too bright:

  • draft-js-import-element/draft-js-import-html is not really maintained anymore. The last update was 3 years ago
  • draft-js itself is not really maintained anymore either. The last update was 2 years ago
  • On top of that, Facebook is even working on a new rich text editor instead (see twitter.com/trueadm/status/1472377356044099587)

Long term we need to look for a replacement. I know that Slate is a strong contender, but there are others as well.

@swissspidy swissspidy added Type: Task Tasks which do not involve engineering Elements: Text Package: Rich Text /packages/rich-text labels Feb 23, 2022
@swissspidy
Copy link
Collaborator Author

cc @barklund as you originally implemented the rich text functionality. Curious to hear your preliminary thoughts.

@miina
Copy link
Contributor

miina commented Mar 10, 2022

From @barklund:

I don't think I found any reasonable libraries at the time. But I was already concerned about the abandonment then, so I did look around.

That was quite a long time ago so perhaps there are better options around now.

@c0b41
Copy link

c0b41 commented Apr 13, 2022

btw lexical released today, but looks like unstable right now https://github.com/facebook/lexical

@timarney
Copy link
Contributor

timarney commented Apr 14, 2022

Here's a thread worth looking at

https://twitter.com/buildsghost/status/1514294769198923778

Slate offers the best primitives for building RTEs but you might end up building your own plugins to fit all your requirements.

@swissspidy swissspidy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Elements: Text P3 Nice to have Package: Rich Text /packages/rich-text Type: Task Tasks which do not involve engineering
Projects
None yet
Development

No branches or pull requests

4 participants