69 lines
1.4 KiB
TypeScript
69 lines
1.4 KiB
TypeScript
import {
|
|
Component,
|
|
OnInit,
|
|
Inject,
|
|
AfterViewInit,
|
|
ViewChild
|
|
} from '@angular/core';
|
|
import { MatDialogRef, MAT_DIALOG_DATA, MatCheckbox } from '@angular/material';
|
|
|
|
export interface ClipboardDialogData {
|
|
content: {
|
|
text?: string;
|
|
rtf?: string;
|
|
html?: string;
|
|
image?: Buffer;
|
|
imageDataUrl?: string;
|
|
};
|
|
}
|
|
|
|
export interface ClipboardDialogResult {
|
|
selected?: {
|
|
text?: boolean;
|
|
rtf?: boolean;
|
|
html?: boolean;
|
|
image?: boolean;
|
|
};
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-layout-messenger-clipboard',
|
|
templateUrl: './clipboard.dialog.component.html',
|
|
styleUrls: ['./clipboard.dialog.component.scss']
|
|
})
|
|
export class ClipboardDialogComponent implements OnInit, AfterViewInit {
|
|
@ViewChild('chkText', { static: false })
|
|
chkText: MatCheckbox;
|
|
|
|
@ViewChild('chkImage', { static: false })
|
|
chkImage: MatCheckbox;
|
|
|
|
constructor(
|
|
public dialogRef: MatDialogRef<ClipboardDialogData, ClipboardDialogResult>,
|
|
@Inject(MAT_DIALOG_DATA) public data: ClipboardDialogData
|
|
) {}
|
|
|
|
ngOnInit() {}
|
|
|
|
ngAfterViewInit(): void {}
|
|
|
|
onClickChoice(choice: boolean): void {
|
|
let selected: {
|
|
text?: boolean;
|
|
rtf?: boolean;
|
|
html?: boolean;
|
|
image?: boolean;
|
|
};
|
|
|
|
if (choice) {
|
|
selected = {
|
|
text: !!this.chkText && this.chkText.checked,
|
|
image: !!this.chkImage && this.chkImage.checked
|
|
};
|
|
} else {
|
|
}
|
|
|
|
this.dialogRef.close({ selected });
|
|
}
|
|
}
|