/**
* This file is part of Threema Web.
*
* Threema Web is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Threema Web. If not, see .
*/
/**
* Allow to drag and drop elements, set class to parent object
*/
export default [
'$log',
function($log: ng.ILogService) {
return {
restrict: 'EA',
scope: {
submit: '=',
onUploading: '=',
},
link(scope: any, element) {
// Logging
const logTag = '[Directives.DragFile]';
// Constants
const DRAGOVER_CSS_CLASS = 'is-dragover';
// Elements
const overlay: any = angular.element(element[0]);
const dragElement: any = angular.element(element[0]).parent('.drag-container');
// Function to fetch file contents
// Resolve to ArrayBuffer or reject to ErrorEvent.
function fetchFileListContents(fileList: FileList): Promise