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.

CommentFileSizeAuthor
#7 2977454_7.patch684 bytesmtodor
#2 2977454_2.patch546 bytesmtodor

Comments

mtodor created an issue. See original summary.

mtodor’s picture

Status: Active » Needs review
StatusFileSize
new546 bytes

I 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.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

And I suppose we can't have a failing test because with our markup, there are no non-paragraph table rows?

mtodor’s picture

@Berdir good point. What do you think if we would add tests in paragraphs_features?

dinesh18’s picture

#2 patch looks good to me. +1 to RTBC

miro_dietiker’s picture

Status: Reviewed & tested by the community » Needs work

As 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.

mtodor’s picture

Status: Needs work » Needs review
StatusFileSize
new684 bytes

@miro_dietiker Nice catch!

Here is a new patch, in this case, the index is calculated only in scope of all draggable rows for that table.

chr.fritsch’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me

miro_dietiker’s picture

Status: Reviewed & tested by the community » Fixed

Yeah now this seems fine. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.