[ACA-1542] Print file (#518)

* Add Services and Behaviors to support print file dialog, which opens a browser renderable version of the file with the print dialog; after which, closes the window when the print dialog is closed.
This commit is contained in:
alex
2018-07-20 15:21:37 -04:00
committed by Denys Vuika
parent d9e59cfd73
commit 5596738703
6 changed files with 199 additions and 3 deletions

View File

@@ -4,9 +4,11 @@
[fileNodeId]="nodeId"
[allowNavigate]="navigateMultiple"
[allowSidebar]="true"
[allowPrint] ="true"
[canNavigateBefore]="previousNodeId"
[canNavigateNext]="nextNodeId"
[overlayMode]="true"
(print) = "printFile($event)"
(showViewerChange)="onVisibilityChanged($event)"
(navigateBefore)="onNavigateBefore()"
(navigateNext)="onNavigateNext()">

View File

@@ -33,6 +33,7 @@ import { PageComponent } from '../page.component';
import { ContentApiService } from '../../services/content-api.service';
import { ExtensionService } from '../../extensions/extension.service';
import { ContentManagementService } from '../../services/content-management.service';
import { ViewUtilService } from '../../services/view-util.service';
import { ContentActionRef } from '../../extensions/action.extensions';
@Component({
selector: 'app-preview',
@@ -59,6 +60,7 @@ export class PreviewComponent extends PageComponent implements OnInit {
private preferences: UserPreferencesService,
private route: ActivatedRoute,
private router: Router,
private viewUtils: ViewUtilService,
store: Store<AppStore>,
extensions: ExtensionService,
content: ContentManagementService) {
@@ -341,6 +343,10 @@ export class PreviewComponent extends PageComponent implements OnInit {
this.onVisibilityChanged(false);
}
printFile(event: any) {
this.viewUtils.printFileGeneric(this.nodeId, this.node.content.mimeType);
}
private getNavigationCommands(url: string): any[] {
const urlTree: UrlTree = this.router.parseUrl(url);
const urlSegmentGroup: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];