WIP: show PDF, PNG and JPEG files in projector

This commit is contained in:
André Böhlke 2019-02-23 16:59:01 +01:00 committed by Emanuel Schütze
parent 7e2045aa76
commit b3ff250d38
4 changed files with 28 additions and 7 deletions

View File

@ -51,6 +51,7 @@
"ng-pick-datetime": "^7.0.0", "ng-pick-datetime": "^7.0.0",
"ngx-file-drop": "^6.0.0", "ngx-file-drop": "^6.0.0",
"ngx-mat-select-search": "^1.7.2", "ngx-mat-select-search": "^1.7.2",
"ng2-pdf-viewer": "^5.2.3",
"ngx-papaparse": "^3.0.2", "ngx-papaparse": "^3.0.2",
"pdfmake": "^0.1.53", "pdfmake": "^0.1.53",
"po2json": "^1.0.0-alpha", "po2json": "^1.0.0-alpha",

View File

@ -1,5 +1,13 @@
<div *ngIf="data"> <div *ngIf="data">
<p>{{ data.data.path }}</p> <div *ngIf="data.data.type == 'image/png'">
<p>{{ data.data.type }}</p> <img [src]="url" alt=""/>
<p>{{ data.data.media_url_prefix }}</p> </div>
<div *ngIf="data.data.type == 'application/pdf'">
<pdf-viewer [src]="url"
[render-text]="true"
style="display: block;"></pdf-viewer>
</div>
<div *ngIf="data.data.type == 'image/jpeg'">
<img [src]="url" alt=""/>
</div>
</div> </div>

View File

@ -1,4 +1,6 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {computed} from 'mobx-angular';
import {BaseSlideComponent} from 'app/slides/base-slide-component'; import {BaseSlideComponent} from 'app/slides/base-slide-component';
import {MediafileSlideData} from './mediafile-slide-data'; import {MediafileSlideData} from './mediafile-slide-data';
@ -12,4 +14,8 @@ export class MediafileSlideComponent extends BaseSlideComponent<MediafileSlideDa
public constructor() { public constructor() {
super(); super();
} }
@computed get url() {
return `${this.data.data.media_url_prefix}/${this.data.data.path}`;
}
} }

View File

@ -2,6 +2,12 @@ import { NgModule } from '@angular/core';
import { makeSlideModule } from 'app/slides/base-slide-module'; import { makeSlideModule } from 'app/slides/base-slide-module';
import { MediafileSlideComponent } from './mediafile-slide.component'; import { MediafileSlideComponent } from './mediafile-slide.component';
import { PdfViewerModule } from 'ng2-pdf-viewer';
@NgModule(makeSlideModule(MediafileSlideComponent))
let moduleConfiguration = makeSlideModule(MediafileSlideComponent);
moduleConfiguration.imports.push(PdfViewerModule)
@NgModule(moduleConfiguration)
export class MediafileSlideModule {} export class MediafileSlideModule {}