mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-09 15:15:01 +00:00
Enables uploading of XML files with different (or no) file type
This commit is contained in:
parent
60841c85b6
commit
91f5a3782a
@ -62,7 +62,7 @@
|
|||||||
<input matInput disabled [value]="getFileName()" type="text">
|
<input matInput disabled [value]="getFileName()" type="text">
|
||||||
<mat-icon matSuffix>folder_open</mat-icon>
|
<mat-icon matSuffix>folder_open</mat-icon>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<input hidden (change)="onFileSelected($event)" #fileInput type="file" id="file" accept="text/xml">
|
<input hidden (change)="onFileSelected($event)" #fileInput type="file" id="file" accept=".bpmn,.xml,application/xml,text/xml">
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="openMethod === 'url'">
|
<ng-container *ngIf="openMethod === 'url'">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
@ -76,7 +76,7 @@ export class AppComponent implements AfterViewInit {
|
|||||||
if (this.openMethod === 'url') {
|
if (this.openMethod === 'url') {
|
||||||
this.diagramComponent.loadUrl(this.diagramUrl);
|
this.diagramComponent.loadUrl(this.diagramUrl);
|
||||||
} else {
|
} else {
|
||||||
if (this.diagramFile && this.diagramFile.type === 'text/xml') {
|
if (this.diagramFile && this.isXmlFile(this.diagramFile)) {
|
||||||
this.readFile(this.diagramFile);
|
this.readFile(this.diagramFile);
|
||||||
} else {
|
} else {
|
||||||
this.handleImported({
|
this.handleImported({
|
||||||
@ -254,4 +254,11 @@ export class AppComponent implements AfterViewInit {
|
|||||||
Version: ${fileMeta.version}
|
Version: ${fileMeta.version}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isXmlFile(file: File) {
|
||||||
|
return file.type === 'text/xml' ||
|
||||||
|
file.type === 'application/xml' ||
|
||||||
|
file.name.slice(-5) === '.bpmn' ||
|
||||||
|
file.name.slice(-4) === '.xml';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user