Skip to content

cdk proposal: framework for rich text editors ("draftjs" for angular) #4444

Open

Description

@fxck

tl;dr https://draftjs.org/ for angular

I've been searching the internets and there is nothing that comes even close to draftjs, which is built on top and requires react. What does it do? It solves most of the contenteditable issues and provides api for people to build their own rich text editors on top of it.

Rich text editor doesn't necessarily mean WYSIWYG textarea, it can help with anything from mentions, hashtags to replacing text emoticons with images etc.

image

Some of the most popular draftjs plugins can be found here and here, it should give you an idea what can be done with it.

worth reading:

I think this could be a great fit for CDK, given that you are eventually planning on creating WYSIWYG anyway.. what do you think?

@jelbourn @mmalerba @kara @andrewseguin @devversion @crisbeto

Activity

  1. devversion commented on May 9, 2017

    @devversion
    Member

    Thanks for the links. Why aren't we moving that conversation to the issue #2949?

  2. fxck commented on May 9, 2017

    @fxck
    ContributorAuthor

    Because that guy's looking for WYSIWYG, this is something you'd build WYSIWYG on top of, two very different things I think.

    It's basically the difference between Overlay and dialog.

  3. devversion commented on May 9, 2017

    @devversion
    Member

    Yeah but I think this both relates together and it would be helpful to have a general discussion about it first.

  4. fxck commented on May 9, 2017

    @fxck
    ContributorAuthor

    Nope, it's like a separate issue for Overlay and dialog/menu/select.

  5. devversion commented on May 9, 2017

    @devversion
    Member

    In the past my opinion was that this should be rather part of another repository or just a 3rd party library. Now though, I can see how the components monorepo could benefit from providing such a framework. Fair enough that these are separate issues. I didn't realize before.

  6. fxck commented on May 9, 2017

    @fxck
    ContributorAuthor

    I understand why you'd think so, but look into what draftjs actually does (or watch this video https://www.youtube.com/watch?v=feUYwoLhE_4), it basically doesn't care about visual representation at all, which is what that guy in #2949 is ultimately looking for - a component with buttons that do stuff..

    The reason I'm really asking here is because google/angular team has enough brain power and experience to actually do something like this (it's in a way similar to angular compiler). If you search the internet you won't find anything remotely close to draftjs, everyone's creating mentions inputs, emoticon replacers, WYSIWYG textareas, only facebook took a step back and asked what's in the core of such features. I really find it similar to what other CDK services do. It could greatly empower other component creators, it's a really powerful high level service.

  7. mlc-mlapis commented on May 10, 2017

    @mlc-mlapis

    I did not go to the details but it looks that https://quilljs.com (used in PrimeNG UI components for Angular https://www.primefaces.org/primeng/#/editor) is very similar from the concept point of view?

  8. fxck commented on May 10, 2017

    @fxck
    ContributorAuthor

    Quill looks like WYSIWYG to me. If there's anything similar, it's slate, again, just for react. Read the comparisons.

    Also https://youtu.be/gxNuHZXZMgs?t=1791 this guy saying that he talked to angular people who decided to add react/draft as a dependency simply because they couldn't find anything similar in angular world.

  9. mlc-mlapis commented on May 10, 2017

    @mlc-mlapis

    From the first point of view sure but I meant mainly the background of it. Its internal structure, API, ...

  10. fxck commented on May 10, 2017

    @fxck
    ContributorAuthor

    I don't know, I think their own comparison to draft speaks for itself https://quilljs.com/guides/comparison-with-other-rich-text-editors/#draft they are out of the box usable wysiwyg, draft is just a high level service that allows you to build rich text editors (not necessarily wysiwyg editors).

    Simple test is to see if quill, or any other lib, can also be used to smaller, "simple" things like facebook-like mentions. You won't really find a quill plugin for that (it was never made with that in mind, to quote their own site "Quill’s only use case is rich text content"), and if you do, you'll find that it relies on DOM data-* attributes to carry data, unlike draft which stores them in a JSON structure, which I think is a better approach in angular world.

    Also worth watching to understand how draftjs works internally https://www.youtube.com/watch?v=vOZAO3jFSHI

  11. mlc-mlapis commented on May 10, 2017

    @mlc-mlapis

    Yeah, it is certainly true. I did not go so deep, I just looked at some basic operations as

    quill.setContents([
      { insert: 'Hello ' },
      { insert: 'World!', attributes: { bold: true } },
      { insert: '\n' }
    ]);
    

    and corresponding Deltas representing the changes which use JSON format.

  12. jelbourn commented on May 10, 2017

    @jelbourn
    Contributor

    We have chatted about this in the past (and one Angular team member actually has a decent amount of experience with this kind of thing). It's something we'd like to do, but is pretty far down on the priority list.

  13. added
    feature
    P5
    on May 10, 2017
  14. mlc-mlapis commented on May 10, 2017

    @mlc-mlapis

    Oh, really? Sounds positive. 👍 Is it possible to share some more details?

  15. 8 remaining items

  16. changed the title [-]cdk proposal: framework for rich text editors (draftjs for angular)[/-] [+]cdk proposal: framework for rich text editors ("draftjs" for angular)[/+] on Dec 23, 2017
  17. fxck commented on Mar 29, 2018

    @fxck
    ContributorAuthor

    @jelbourn Q2 still a go for the exploration? Will Ivy help this? Or angular/elements?

  18. jelbourn commented on Mar 29, 2018

    @jelbourn
    Contributor

    Probably not at this point; it's looking now that Q2 is mostly going to be finishing up drag/drop and virtual, addressing some tech debt and productivity issues (mainly trying to speed up the rate at which we can sync stuff into Google), and support/validation for Ivy work.

  19. wynfred commented on Oct 4, 2018

    @wynfred

    I wrote a directive. It implements MatFormFieldControl to make contenteditable compatible with MatFormField.
    I'm pretty new to web development, so I basically just copy/paste stuff from matInput. The errorstate and some other stuff are a little confusing for me and I'm not sure I implemented them correctly. I hope I can get some help from material team to test/improve/fix my implementation.

  20. naveedahmed1 commented on Oct 8, 2018

    @naveedahmed1

    @jelbourn are there any guidelines for third-party WYSIWYG editor developers who want to add support for Angular Material 2?

    For example CKEditor 5 which has been completely rewritten in ES6 and provides all the necessary tools to easily integrate it with modern applications and technologies such as Angular. And they officially support Angular https://github.com/ckeditor/ckeditor5-angular. They seems to be interested in officially supporting Angular Material as well but clarity on best approach is needed.

    Please take a look at:
    ckeditor/ckeditor5-angular#21
    and
    ckeditor/ckeditor5-angular#21 (comment)

  21. jelbourn commented on Oct 8, 2018

    @jelbourn
    Contributor

    It's not clear to me what "adding support for Angular Material" would mean. Could you clarify?

  22. naveedahmed1 commented on Oct 8, 2018

    @naveedahmed1

    @jelbourn To be more specific I am referring to the support of WYSIWYG editor inside MatFormFieldControl. In case of ckeditor they have a separate plugin ckeditor/ckeditor5-angular for Angular.

    Now, to support ckeditor inside MatFormFieldControl, should they have a separate plugin e.g ckeditor5-angular-material? since in order to support MatFormFieldControl they have will to add @angular/material a peer or explicit dependency in package.json file. And since its not necessary that everyone using ckeditor/ckeditor5-angular would also be using Angular Material, so it would be an additional dependency for them. Or is there any other solution that can allow this without importing it to satisfy the angular DI.

  23. jelbourn commented on Oct 8, 2018

    @jelbourn
    Contributor

    All you would really need is a directive that implements MatFormFieldControl in order to work with mat-form-field (similar to MatInput). That's something that would best fit in its own package so any existing packages don't have to pull in dependencies.

  24. fxck commented on Sep 5, 2019

    @fxck
    ContributorAuthor

    Any updates?

  25. wynfred commented on Sep 5, 2019

    @wynfred

    Not sure if the material team is interested in taking something like this into the official lib.

  26. jelbourn commented on Sep 5, 2019

    @jelbourn
    Contributor

    No plans to work on this at least through 2020.

  27. added
    area: new
    on Jun 11, 2020
  28. fxck commented on Apr 14, 2022

    @fxck
    ContributorAuthor

    https://github.com/facebook/lexical Facebook now created a better and improved draft.js that is dependency free, so there's higher possibility of making an angular wrapper without having to bring over the whole of react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5area: newfeature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions