Problem/Motivation
In Thunder, we are using two functionalities that modify table rows for the paragraphs widget.
Additional rows are added to the table by checkbox sorting and also by paragraphs features "add in between" functionality. That makes the wrong calculation for a position where to add a new paragraph.
We are not enabling "add above" functionality by default, because "add in between" is used, but we would like to have it supported if someone wants to enable it.
Proposed resolution
Problem with the "add above" is that it calculates position with taking in account all tables rows and a possible solution would be to take in account only paragraph rows.
Comments
Comment #2
mtodor commentedI have mentioned that problem in #2946514: Add paragraph before button.
Here is a solution for resolving delta, where only paragraph rows will be taken in account.
Comment #3
berdirAnd I suppose we can't have a failing test because with our markup, there are no non-paragraph table rows?
Comment #4
mtodor commented@Berdir good point. What do you think if we would add tests in paragraphs_features?
Comment #5
dinesh18 commented#2 patch looks good to me. +1 to RTBC
Comment #6
miro_dietikerAs far as i know the selector '.draggable' is interpreted as a global selector.
So this likely goes wrong if you have multiple Paragraph fields on the same page.
Comment #7
mtodor commented@miro_dietiker Nice catch!
Here is a new patch, in this case, the index is calculated only in scope of all
draggablerows for that table.Comment #8
chr.fritschLooks good to me
Comment #9
miro_dietikerYeah now this seems fine. Thank you.