Namespace: dropController

Granite.author.ui. dropController

The dropController is the central point where the different drag and drop interactions are managed.

It contains the different "sub controllers"; and each of them is basically managing a different kind of drag and drop interaction. The main one is the "general" one which handles d&d over Granite.author.ui.Overlays

Source:
ui/ui.dropController.js

Members


<static> ns.ui.dropController.dropareawidget

Manages d&d of an Asset over the DropArea widget

Source:
ui/ui.dropController.dropareawidget.js

<static> ns.ui.dropController.file

Manages d&d of an external file over an Granite.author.ui.Overlay in the Editor

Source:
ui/ui.dropController.file.js

<static> ns.ui.dropController.general

Manages d&d of different origins (referred by the data-type attribute of the target entity; e.g., "Component", "Asset", "Editable") over an Granite.author.ui.Overlay in the Editor

Source:
ui/ui.dropController.general.js

<static> ns.ui.dropController.inputwidget

Manages d&d of an Asset over a FileUpload widget

Source:
ui/ui.dropController.inputwidget.js

<static> ns.ui.dropController.rteinline

Manages d&d of an object over the RTE inline editor.

Source:
ui/ui.dropController.rteinline.js

<static> ns.ui.dropController.rtewidget

Manages d&d of an Asset over the RTE widget

Source:
ui/ui.dropController.rtewidget.js

<static> registry

Registry storage for the Drop Controllers (for d&d interactions on Overlays)

Source:
ui/ui.dropController.js

Methods


<static> deregister(name)

Unregister a Drop Controller by the given name

Parameters:
Name Type Description
name String

The name of the Drop Controller to unregister

Source:
ui/ui.dropController.js
See:

<static> disable( [config])

Disable different d&d capabilities (by default, the dropController should be enabled for all Layers)

Parameters:
Name Type Argument Description
config object <optional>

The optional config object to specify which parts to enable; if omitted, all parts are disabled

Properties
Name Type Argument Description
general boolean <optional>

Disable general d&d capabilities on Overlays

filewidget boolean <optional>

Disable d&d on FileUpload widget

dropareawidget boolean <optional>

Disable d&d on DropArea widget

file boolean <optional>

Disable d&d from file system

Source:
ui/ui.dropController.js

<static> disableDropzone(type)

Removes the highlighting style from all the DOM Elements associated as a drop zone for the given type of asset/component

Parameters:
Name Type Description
type string

Type such as asset or component

Source:
ui/ui.dropController.js

<static> enable( [config])

Enables all d&d capabilities (by default, the dropController should be enabled for all Layers)

Parameters:
Name Type Argument Description
config object <optional>

The optional config object to specify which parts to enable; if omitted, all parts are enabled

Properties
Name Type Argument Description
general boolean <optional>

Enable general d&d capabilities on Overlays

filewidget boolean <optional>

Enable d&d on FileUpload widget

dropareawidget boolean <optional>

Enable d&d on DropArea widget

file boolean <optional>

Enable d&d from file system

Source:
ui/ui.dropController.js

<static> enableDropzone(type)

Highlights all the DOM Elements associated as a drop zone for the given type of asset/component as enabling the drop action

Parameters:
Name Type Description
type string

Type such as asset or component

Source:
ui/ui.dropController.js

<static> get(name)

Returns the Drop Controller by the given name

Parameters:
Name Type Description
name String

The name of the Drop Controller to return

Source:
ui/ui.dropController.js
Returns:
Type
Object

<static> getEventTargetEditable(event)

Returns the Editable associated with the given event target DOM element

Parameters:
Name Type Description
event
Source:
ui/ui.dropController.js
Returns:
Type
Granite.author.Editable

<static> getInsertBehavior(element, clientY)

Returns the insert behaviour for the given HTML Element at the given y-axis of the mouse

Parameters:
Name Type Description
element HTMLElement

Target html element

clientY number

Coordinate on the y-axis of the mouse

Source:
ui/ui.dropController.js
Returns:

"before" or "after"

Type
string

<static> register(name, controller)

Registers a Drop Controller
The registered drop controller handlers will be called by the general dropController depending on the data-type attribute of the dragged entity.

This could be used to allow d&d on new asset types for instance.

Parameters:
Name Type Description
name String

The name of the Drop Controller

controller Granite.author.ui.dropController~DropController

The Drop Controller object

Source:
ui/ui.dropController.js
See:
  • Granite.author.ui.dropController.general

Type Definitions


DropController

Represents a drag and drop operation where the drag origin entity type is determined by the getTypeName method, and the drop target is an Overlay in the Editor

Type:
  • Object
Properties:
Name Type Description
getTypeName function

Returns the type name of the entity that will be dragged (the drag origin)

handleDragStart function

Handles the drag start operation

handleDragEnd function

Handles the drag end operation

handleDragEnter function

Handles the drag enter operation

handleDragLeave function

Handles the drag leave operation

handleDrag function

Handles the drag operation

handleDragOver function

Handles the drag over operation

handleDrop function

Handles the drop operation

isInsertAllowed function

Indicates if the drop is allowed on the current hovered Editable

Source:
ui/ui.dropController.js