Opened 5 years ago

Closed 3 years ago

#17743 closed enhancement (patchwelcome)

DND: Internal Source copy happens even when copyOnly=false

Reported by: inanutshellus Owned by:
Priority: undecided Milestone: 1.13
Component: DnD Version: 1.9.2
Keywords: Cc: ben hockey
Blocked By: Blocking:

Description

I have a single dnd list, used for reordering items. I don't want the items copied in the list, but setting copyOnly to false doesn't seem to work, as I can always reproduce copying the list items by holding the control/command button after starting the drag.

See: http://jsfiddle.net/inanutshellus/3ybA9/

Change History (4)

comment:1 Changed 5 years ago by ben hockey

Cc: ben hockey added

comment:2 Changed 5 years ago by inanutshellus

I misread the intent of the "copyOnly" parameter and now realize this should be changed to a feature request.

The feature request would be for a new parameter "allowCopy" that enforces the following rule: "False disallows copying a dragged item, even when the user is holding the control/command key."

I implemented this by subclassing Source.js:

var DndSource = declare(
    [Source], {

        allowCopy: true,
        copyState: function(keyPressed, self){

            // if allowCopy is false, only moves will happen, even if the user
            // holds the control (or command) key.
            if  (this.allowCopy) {
                return DndSource.superclass.copyState.call(this, keyPressed, self);
            }
            return false;
        }
    }
);

comment:3 Changed 3 years ago by dylan

Type: defectenhancement

comment:4 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in more than a year, I'm closing this as patchwelcome. Please let us know if you would like to get involved in helping make this change to Dojo!

Note: See TracTickets for help on using tickets.