Provides drag-and-drop features for an element such as a div
.
<div [adf-file-draggable]="true" id="DragAndDropBorder" class="drag-and-drop-border"
(filesDropped)="onFilesDropped($event)"
(folderEntityDropped)="onFolderEntityDropped($event)"
dropzone="" webkitdropzone="*" #dragAndDropArea>
<ng-content></ng-content>
Drag and Drop files here!
</div>
Some sample CSS to show the drag and drop area:
.drag-and-drop-border {
vertical-align: middle;
text-align: center;
border: double;
background-color: lightblue;
width: 400px;
height: 100px;
}
Name | Type | Default value | Description |
---|---|---|---|
enabled | boolean | true | Enables/disables drag-and-drop functionality. |
Name | Type | Description |
---|---|---|
filesDropped | EventEmitter <File[]> | Emitted when one or more files are dragged and dropped onto the draggable element. |
folderEntityDropped | EventEmitter <any> | Emitted when a directory is dragged and dropped onto the draggable element. |
Typically you would use the Upload Drag Area component instead of this directive.
export class SomeComponent implements OnInit { onFilesDropped(files: File[]): void { if (files.length) { // Use for example the uploadService to upload files to ACS console.log('# of files dropped: ', files.length); } } onFolderEntityDropped(folder: any): void { if (folder.isDirectory) { // Use for example the uploadService to upload folder content to ACS console.log('Folder dropped: ', folder); } }
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.