Support for png files

This commit is contained in:
Piotr Pekala
2019-11-15 03:45:30 -08:00
parent ed9ca9ed03
commit 6986dccf6e
7 changed files with 1454 additions and 537 deletions

View File

@ -11,6 +11,7 @@ import downloadSvg from 'svg-crowbar';
import { ElectronService } from 'ngx-electron';
import { MatDialog } from '@angular/material';
import { ScreenshotDialogComponent, Screenshot } from '../screenshot-dialog/screenshot-dialog.component';
import { saveAsPng, saveAsJpeg } from 'save-html-as-image';
@Component({

View File

@ -1,9 +1,9 @@
<h1 mat-dialog-title>Take a screenshot</h1>
<!-- <mat-radio-group class="radio-group" aria-label="Sorting">
<mat-radio-group class="radio-group" aria-label="Sorting">
<mat-radio-button value="1" (click)="setFiletype('svg')" checked>SVG</mat-radio-button>
<mat-radio-button [disabled]="!isPngAvailable" value="2" (click)="setFiletype('png')">PNG</mat-radio-button>
</mat-radio-group> -->
</mat-radio-group>
<form [formGroup]="nameForm" class="name-form">
<mat-form-field class="name-form">

View File

@ -3,6 +3,7 @@ import { MatDialogRef } from '@angular/material';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { ToasterService } from '../../../services/toaster.service';
import { ElectronService } from 'ngx-electron';
import { DeviceDetectorService } from 'ngx-device-detector';
@Component({
@ -19,13 +20,13 @@ export class ScreenshotDialogComponent implements OnInit {
public dialogRef: MatDialogRef<ScreenshotDialogComponent>,
private toasterService: ToasterService,
private formBuilder: FormBuilder,
private electronService: ElectronService
private electronService: ElectronService,
private deviceService: DeviceDetectorService
) {
this.nameForm = this.formBuilder.group({
screenshotName: new FormControl(null, [Validators.required])
});
this.isPngAvailable = this.electronService.isWindows;
this.isPngAvailable = this.electronService.isWindows || (this.deviceService.getDeviceInfo().os==='Windows');
}
ngOnInit() {}