Discussion: Making list-items draggable instead of list-nodes
At present, we treat each list node as an entire block, similar to this.
However, a more refined approach would be to consider each indented list node as an individual block, akin to how it is done in Notion.
If my suggestion is accepted, I would be more than happy to contribute to the code.
If my suggestion is accepted, I would be more than happy to contribute to the code.
Awesome, thank you!
I think one thing we'd need to think about here is what exactly makes this more "refined"? I know that block-based editors are trendy right now, and I do see some benefits, but I'd like to understand what specific advantages adding the concept of more granular block to Lexical might confer?
If we can get past that to a place where we can see clear advantages that are worth the implementation trade-offs, I'm not opposed to this.
The only advantage I can think of is that such a function is essential for a Notion-like editor. If Lexical aims to create a general editing framework, then this kind of modification will only enhance Lexical's versatility and applicability.
I think the concept of "block" may evoke in many a rigid architecture with little flexibility, which is used by other editors like https://editorjs.io/
It is difficult in these editors to achieve an arbitrary HTML structure. Also, I think many make the mistake of reinventing arbitrary selection with CSS.
I think this is not what @aquarius-wing is proposing or what @acywatson is concerned about.
I suggest changing the title of this discussion to something like: "Making list-items draggable instead of list-nodes".
That's plausible without sacrificing anything in Lexical, just modify "DraggableBlockPlugin".
In fact, I've almost done it by using a function to split lists. The problem is that after dragging and dropping several list-items they start to fragment into contiguous lists. The only thing I would be missing is a way to combine lists. I'm experimenting with different strategies, meanwhile I've opened a thread here: https://github.com/facebook/lexical/issues/4618
I think the concept of "block" may evoke in many a rigid architecture with little flexibility, which is used by other editors like https://editorjs.io/
It is difficult in these editors to achieve an arbitrary HTML structure. Also, I think many make the mistake of reinventing arbitrary selection with CSS.
I think this is not what @aquarius-wing is proposing or what @acywatson is concerned about.
I suggest changing the title of this discussion to something like: "Making list-items draggable instead of list-nodes".
That's plausible without sacrificing anything in Lexical, just modify "DraggableBlockPlugin".
In fact, I've almost done it by using a function to split lists. The problem is that after dragging and dropping several list-items they start to fragment into contiguous lists. The only thing I would be missing is a way to combine lists. I'm experimenting with different strategies, meanwhile I've opened a thread here: #4618
I cann't agree with you any more. May be we don't need to take such big steps, just modify the list-node is fine.
Hi @GermanJablo Have you solved this problem yet? I want to drag and drop list-item instead of a list but I don't know how to handle it
What I did was not use @lexical/list and use my own list nodes which follows a flat model using indentation
Can you share in more detail how you handled it? It would be great if you could show me your code
Did somebody figure it out and can share pseudo code or code? Or even just details on how to implement this.
Frankly, I need this feature. It would also be great to establish a child-parent relationship by moving the list elements left-right