Problem/Motivation

Have the ability to delete multiple paragraphs at once.
This functionality can be very useful for contents containing a lot of paragraphs.
Before undertaking developments, I post this issue in case one of you already has a solution.

Proposed resolution

  • Keep the delete button if there is only one element
  • If there are at least 2 elements :
    • Remove delete button on each paragraph
    • Add a checkbox near paragraphs action buttons (outside dropdown)
    • Add a new buttons "Delete selection" near buttons "Edit all" and "Collapse all"
    • On click, displays a confirmation message concerning all deletion
    • After confirmation, all selected paragraphs are deleted
CommentFileSizeAuthor
#11 Paragraph_test.png49.3 KBtushar1
#8 delete-selection.mov499.52 KBcmarrufo

Issue fork paragraphs-3107684

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anonymous’s picture

Johnatas created an issue. See original summary.

guypaddock’s picture

On a related note, we've gotten user feedback that the current behavior of "Remove" being under a drop-down/pop-out menu is awkward and they really wish there was a delete button or similar on the paragraph item. What's described here in this ticket goes even further toward more efficient bulk operations.

berdir’s picture

From our perspective, a client-side delete implementation would address the multiple part, if the delete action is immediate, without ajax delay, then I think that would be sufficient. See #2833934: Introduce client side remove, with confirmation? and undo

Making the delete button always visible could be a widget setting, but could be tricky with the available space, maybe as an icon like in those old mockups.

jannakha’s picture

if anyone needs a patch to "Remove all" - https://www.drupal.org/project/paragraphs/issues/3337935

anybody’s picture

Version: 8.x-1.10 » 8.x-1.x-dev

Bulk selection of paragraphs for deletion would still be useful :) Bringing this back to life.

cmarrufo made their first commit to this issue’s fork.

cmarrufo’s picture

StatusFileSize
new499.52 KB

Hi everyone!

I opened a MR for this feature. I had something similar in a project and have tried to adapt it as best as possible for the widget. Here is a short demo video showing how it works.

Note: I'm aware that the description for this issue mentions displaying a confirmation message before deletion (perhaps a confirmation dialog box or something similar), but I haven't implemented that yet; right now, the deletion happens immediately.

cmarrufo’s picture

Status: Active » Needs review

jannakha changed the visibility of the branch 3107684-multiple-deletion-of to hidden.

tushar1’s picture

StatusFileSize
new49.3 KB

Tested on:

Drupal 11.4.0
Paragraphs module

Steps performed:

Installed and enabled the Paragraphs module.
Created a Paragraph type with a text field.
Added a Paragraph reference field to the Article content type.
Created an Article with a single paragraph.
Verified that no checkbox is displayed and the existing delete button is available (as per the proposed behavior).
Added multiple paragraphs to the Article.
Verified that checkboxes are displayed for each paragraph when there are two or more paragraphs.
Verified that the Delete selection button is displayed.
Selected multiple paragraphs and clicked Delete selection.
Confirmed that only the selected paragraphs were removed while the remaining paragraphs retained their order.

tushar1’s picture

Status: Needs review » Reviewed & tested by the community