This commit is contained in:
crusader 2018-10-11 17:32:00 +09:00
parent d47a5e636c
commit 3a0a72aca4
10 changed files with 22 additions and 20 deletions

View File

@ -79,6 +79,7 @@
"devtron": "^1.4.0",
"dexie": "^2.0.4",
"electron": "^2.0.9",
"electron-i18n": "^1.606.0",
"electron-builder": "^20.28.4",
"electron-connect": "^0.6.3",
"electron-connect-webpack-plugin": "^0.1.1",

View File

@ -33,12 +33,12 @@
</p-footer>
</p-dialog>
<p-dialog header="Export as JPG" [(visible)]="displayExportJPG" [modal]="true" [responsive]="true" [width]="350"
<p-dialog header="Export as JPEG" [(visible)]="displayExportJPEG" [modal]="true" [responsive]="true" [width]="350"
[minWidth]="200" [minY]="70" [closable]="false">
<app-menu-export-jpg #exportJPG></app-menu-export-jpg>
<app-menu-export-jpeg #exportJPEG></app-menu-export-jpeg>
<p-footer>
<button type="button" pButton icon="pi pi-check" (click)="exportJPG.export();" label="Yes"></button>
<button type="button" pButton icon="pi pi-close" (click)="displayExportJPG=false" label="No" class="ui-button-secondary"></button>
<button type="button" pButton icon="pi pi-check" (click)="exportJPEG.export();" label="Yes"></button>
<button type="button" pButton icon="pi pi-close" (click)="displayExportJPEG=false" label="No" class="ui-button-secondary"></button>
</p-footer>
</p-dialog>

View File

@ -22,7 +22,7 @@ export class AppComponent implements OnInit, AfterContentInit, AfterViewInit, On
menuSubscription: Subscription;
displayAbout: boolean;
displayExportJPG: boolean;
displayExportJPEG: boolean;
displayExportPNG: boolean;
displayExportSVG: boolean;
displayPreferences: boolean;
@ -50,8 +50,8 @@ export class AppComponent implements OnInit, AfterContentInit, AfterViewInit, On
case 'show-about':
this.displayAbout = true;
break;
case 'show-export-jpg':
this.displayExportJPG = true;
case 'show-export-jpeg':
this.displayExportJPEG = true;
break;
case 'show-export-png':
this.displayExportPNG = true;

View File

@ -1,4 +1,4 @@
<div>
<p-messages [(value)]="msgs"></p-messages>
Export JPG
Export JPEG
</div>

View File

@ -9,11 +9,11 @@ import { Message } from 'primeng/primeng';
const { saveSvgAsPng, svgAsDataUri } = require('save-svg-as-png');
@Component({
selector: 'app-menu-export-jpg',
templateUrl: './export-jpg.component.html',
styleUrls: ['./export-jpg.component.scss'],
selector: 'app-menu-export-jpeg',
templateUrl: './export-jpeg.component.html',
styleUrls: ['./export-jpeg.component.scss'],
})
export class ExportJPGComponent implements OnInit, AfterContentInit, OnDestroy {
export class ExportJPEGComponent implements OnInit, AfterContentInit, OnDestroy {
msgs: Message[] = [];
constructor(
@ -53,7 +53,7 @@ export class ExportJPGComponent implements OnInit, AfterContentInit, OnDestroy {
// svgAsDataUri(targetDisplayElementRef.nativeElement, {}, function (uri) {
// console.log(`uri: ${uri}`);
// });
saveSvgAsPng(targetDisplayElementRef.nativeElement, 'diagram.jpg', { backgroundColor: '#ffffff', encoderType: 'image/jpeg' });
saveSvgAsPng(targetDisplayElementRef.nativeElement, 'diagram.jpeg', { backgroundColor: '#ffffff', encoderType: 'image/jpeg' });
}),
).subscribe();
}

View File

@ -1,5 +1,5 @@
import { AboutComponent } from './about.component';
import { ExportJPGComponent } from './export-jpg.component';
import { ExportJPEGComponent } from './export-jpeg.component';
import { ExportPNGComponent } from './export-png.component';
import { ExportSVGComponent } from './export-svg.component';
import { PreferencesComponent } from './preferences.component';
@ -7,7 +7,7 @@ import { PrintComponent } from './print.component';
export const COMPONENTS = [
AboutComponent,
ExportJPGComponent,
ExportJPEGComponent,
ExportPNGComponent,
ExportSVGComponent,
PreferencesComponent,

View File

@ -3,7 +3,7 @@ export type MenuEvent =
| 'show-preferences'
| 'show-about'
| 'show-export-png'
| 'show-export-jpg'
| 'show-export-jpeg'
| 'show-export-svg'
| 'show-export-csv'
| 'show-print'

View File

@ -3,7 +3,7 @@ export type MenuIDs =
| 'preferences'
| 'about'
| 'export-png'
| 'export-jpg'
| 'export-jpeg'
| 'export-svg'
| 'export-csv'
| 'print'

View File

@ -62,15 +62,16 @@ export function buildDefaultMenu(
click: emit('show-export-png'),
},
{
label: __DARWIN__ ? 'JPG…' : 'JPG…',
id: 'export-jpg',
click: emit('show-export-jpg'),
label: __DARWIN__ ? 'JPEG…' : 'JPEG…',
id: 'export-jpeg',
click: emit('show-export-jpeg'),
},
{
label: __DARWIN__ ? 'SVG…' : 'SVG…',
id: 'export-svg',
click: emit('show-export-svg'),
},
separator,
{
label: __DARWIN__ ? 'CSV…' : 'CSV…',
id: 'export-csv',