-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
I'm seeing potential implementations: 1) Block can have children using
|
Hi @SamyPesse checking out your branch now. Are you on the slack draft-js channel may be easier to communicate through there? |
@mitermayer Yes, I'm on the slack channel, but I'm going to stop for today (it's 2am in France). I'd love to get your input on the branch and the beginning of the implementation, you can test using the tree example. Basically, the first rendering and basic edition are working, but blocks are not correctly refresh (for example when pressing Enter and splitting a block) since the parent block prevents rendering in the shouldComponentUpdate |
|
||
var { | ||
List, | ||
OrderedSet, | ||
OrderedMap, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we using this anywhere in here ?
I really liked the idea of keep the data model the same, but creating the sense of nesting via the block key! |
adfe43a
to
3cd2638
Compare
@mitermayer I'm happy to work on another implementation if the nesting via block key doesn't sound great. Thanks for the changes and comments. I've added a section in the PR introduction about the Rich text editing with nested blocks. |
Should we also consider a default set of rules ? Or leave that for the application layer ? Example: Should we support nesting like this ? H1 > H2 Or should we have a list of blockTypes that can support nesting ? or someway to define that they can be containers ? |
We could add an optinal property on the bockRenderMap, that could define if a block is a valid container |
Was wondering were would be the best way to added known issues/tasks to this issue so that we can keep track of them ? known issues / remaining task
|
I was thinking handling all of this into a
I agree, I'm thinking about
I'm not sure I understand, what do you mean by
Maybe we can use issues on the fork repository. |
@mitermayer I don't understand what do you mean by "valid container"
|
@SamyPesse Sorry for taking long to answer, my son has been on the hospital, i mean by valid container a container that could have nested blocks. Example:
This could be a user defined boolean on the blockRenderMap, we could chose some sensible defaults our selves. |
Will today add a list of issues to keep track on the reamaining tasks for this issue, and will pick one of them to work on it. Will then create a new branch from your branch and start contributing via PR to your branch. this way we should be able to progress without conflicts. |
@mitermayer No worries, I hope your son is okay. Got it for "valid container", but if we add it to |
@SamyPesse we could make modifiers accept a blockRenderMap as optional param. This is kinda how we are doing internally to figure out the containers to wrap content. We already do such thing for the convertFromHTMLToContentBlocks |
3b8411f
to
cbe4975
Compare
7da6cd4
to
971c8a7
Compare
@guangmiw8 the answer is in this very thread:
Thats two weeks away from today. |
@rafalp thank you, I was expecting a response after Samy's comment, but apparently @mitermayer has already given answer beforehand :) |
@mitermayer I can't transfer you the repository because you already have a fork:
|
@SamyPesse could you try renaming your fork to, say, |
@SamyPesse Hi sammy i just renamed my fork could you please try it again? thanks a lot |
@mitermayer it looks like you have to delete your fork :/ |
@SamyPesse done, just deleted it |
Done 🍻 Good luck with this PR ! |
Hi guys, I am back working on this PR and should have an update about it pretty soon. Thank you for your time and support |
Will start rebasing to fix conflicts with master and move this PR towards the direction of (#388 (comment)) |
Thanks @SamyPesse and @mitermayer and other contributors for the discussion and work on this PR! To update the status on this: We are not going to merge this PR in the near future but we are still experimenting with it internally. A new PR will be opened in the future if we are able to make it work internally; please direct discussion to issue #143. |
it really is frustrating to see so much work poor into a pull request without any results. Discouraging really :/ |
This is a valid feeling - I apologize that we weren't able to find an owner for continuing this work. I realize I should have been more encouraging when closing this PR. It was closed because it's not actively being worked on, and still we would be happy to work with anyone who wishes to pick up work on this PR. Feel free to take this branch and rebase it onto master and open a new PR that continues investigating this approach. |
@flarnie @mitermayer I'd like to contribute to moving this along, any chance I could get someone to help me walk through this implementation so I can get a headstart? |
This PR implements support for a tree structure that can be used to render tables, blockquote, list, etc. For context on this topic, see discussion in #143.
The main goal is also to not break compatibility with people already using Draft, and keep “flatness” as the basic use case.
Implementation
To represent a tree and keep compatibility with the flat model, we decide to not change the data structure, but instead to leverage keys in the
ContentState.blockMap
.Basically, children of the block
a
will be blocks in theblockMap
with keysa/b
,a/c
; anda/b/d
is a child ofa/b
.Demo
A demo is available at samypesse.github.io/test-draft-js/ (similar to the tree example).
Compatibility
Nesting is disabled by default to keep “flatness” as the basic use case. It should be enabled for the right block types in the
blockRenderMap
, and Draft will provides aNestedUtils
module to help use nested blocks and provide the right editing UX.