1
- import { Component , Input , OnInit } from '@angular/core' ;
1
+ import { Component , HostListener , Input , OnInit } from '@angular/core' ;
2
2
import { Note } from '../../core/model/note' ;
3
3
import { Observable , of } from 'rxjs' ;
4
4
import { UserInfoStore } from '../../core/user/user-info.store' ;
5
5
import { ActivatedRoute , Router } from '@angular/router' ;
6
6
import { switchMap } from 'rxjs/operators' ;
7
7
import { PersonalNotesService } from '../../core/personal-notes.service' ;
8
+ import * as screenfull from 'screenfull' ;
8
9
9
10
@Component ( {
10
11
selector : 'app-note-details' ,
11
12
templateUrl : './note-details.component.html' ,
13
+ styleUrls : [ './note-details.component.scss' ] ,
12
14
} )
13
15
export class NoteDetailsComponent implements OnInit {
14
16
@Input ( )
@@ -26,6 +28,8 @@ export class NoteDetailsComponent implements OnInit {
26
28
userId$ : Observable < string > ;
27
29
noteId : string ;
28
30
31
+ isFullScreen = false ;
32
+
29
33
constructor (
30
34
private personalNotesService : PersonalNotesService ,
31
35
private userInfoStore : UserInfoStore ,
@@ -61,4 +65,16 @@ export class NoteDetailsComponent implements OnInit {
61
65
const link = [ `/my-notes/${ note . _id } /clone` ] ;
62
66
this . router . navigate ( link , { state : { note : note } } ) ;
63
67
}
68
+
69
+ toggleFullScreen ( part : HTMLElement ) {
70
+ if ( screenfull . isEnabled ) {
71
+ this . isFullScreen = ! this . isFullScreen ;
72
+ screenfull . toggle ( part ) ;
73
+ }
74
+ }
75
+
76
+ @HostListener ( 'document:fullscreenchange' , [ '$event' ] )
77
+ fullscreenChangeHandler ( event : Event ) {
78
+ this . isFullScreen = ! ! document . fullscreenElement ;
79
+ }
64
80
}
0 commit comments