[MGNLUI-3835] Provide a way to disable drag and drop Created: 31/Mar/16  Updated: 21/Sep/17  Resolved: 30/Aug/16

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.16, 5.4.9, 5.5

Type: Improvement Priority: Major
Reporter: Thim Anneessens Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 0
Labels: devwl, support
Remaining Estimate: 0d
Time Spent: 1.75d
Original Estimate: 4d

Issue Links:
Relates
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Sprint: Saigon 59
Story Points: 5

 Description   

It often happen that the drag and drop is accidentally triggered where it is not meant to be there.
2 things could be done

  • Disable drag and drop on certain app via a configuration flag
  • Show a confirmation popup when dropping. This also could be enabled based on a configuration flag.

An example where we don't want drag and drop is the configuration.



 Comments   
Comment by Zdenek Skodik [ 27/May/16 ]

dropConstraintClass property of workbench definition is supposed to be optional, but removing the property results in NPE while using the move action and there is nothing like an inverted AlwaysTrueDropConstraint one could configure to disable D&D.

Comment by Thim Anneessens [ 27/May/16 ]

As I understand the dropConstraintClass is there to apply constraints when moving. So it is normal that it applies to both Move and D&D. To disable D&D we need another property (like dragAndDropEnabled).
I used breakpoints to check, and the dropConstraintClass is used to check if one node can go under another. We cannot remove dropConstraintClass without impacting the move. If we change this behaviour, there will be allot of impact for people with custom drop constraint (this includes us).

We need an extra dragAndDropEnabled property to only disable drag and drop.

Comment by Thim Anneessens [ 27/May/16 ]

Ok I found a workarround, This is a hack, it works because it does and because it should not. For some reason only the Drag and Drop calls allowedToMove and the Move does not. So by always returning false there (and not elsewhere) it works.

But this is really a stop gap until there is a proper way to do this using magnolia, so the issue is not closed

Here is the code

public class NoDragAndDropDopConstraint extends NodesAndPropsDropConstraint {

@Override
public boolean allowedToMove(Item sourceItem)

{ return false; }

}

Comment by Mikaël Geljić [ 22/Aug/16 ]

Two things to do here:

  1. we add the independent property dragAndDrop to WorkbenchDefinition (defaults to true)
  2. we make sure one can open the move dialog even when no dropConstraint is configured
    1. we evaluate whether or not we can to set the AlwaysTrueDropConstraint by default for JCR apps (w/ JCR-specific TreeViewDropHandler).
Comment by Oanh Thai Hoang [ 26/Aug/16 ]

documentation update,

  • Provide the way to disable drag and drop, see info.magnolia.ui.workbench.definition.ConfiguredWorkbenchDefinition#setDragAndDrop, default is true
  • AlwaysTrueDropConstraint is set as default when no dropConstraintClass is configured
Generated at Mon Feb 12 09:10:33 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.