From 6b1378b4df61e7aa92b0903873bc947d5aa3e56c Mon Sep 17 00:00:00 2001 From: Wilson Fernando Pena Date: Tue, 6 Feb 2024 06:56:31 -0300 Subject: [PATCH] feat: drag and drop files handling --- .../src/lib/angular-editor.component.html | 2 + .../src/lib/angular-editor.component.scss | 17 ++++++ .../src/lib/angular-editor.component.ts | 57 +++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/projects/angular-editor/src/lib/angular-editor.component.html b/projects/angular-editor/src/lib/angular-editor.component.html index 321bed9..84ad89e 100644 --- a/projects/angular-editor/src/lib/angular-editor.component.html +++ b/projects/angular-editor/src/lib/angular-editor.component.html @@ -27,6 +27,8 @@
1) { + this.error = 'Only one file at time allow'; + return; + } + + const file = files[0]; + if (!this.isValidFile(file)) { + this.error = `Invalid file type`; + return; + } + + this.error = ''; + this.editorService.uploadImage(file); + } }