Skip to content

Commit d0af1a9

Browse files
committed
feat(note) - add toggle fullscreen on notes
1 parent 84398a7 commit d0af1a9

9 files changed

+64
-24
lines changed

apps/codever-ui/src/app/shared/bookmark-list-element/bookmark-list-element.component.scss

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.title-content-separator {
2-
margin: 0 0 0.5rem 0;
3-
}
4-
51
.header-wrapper {
62
display: flex;
73
justify-content: space-between;

apps/codever-ui/src/app/shared/note-details/note-card-body/note-content.component.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
2+
13
<div #noteContentDiv appMarkedImageWidth>
2-
<div *ngIf="partOfList && viewHeight > maxNoteHeightInList; else wholeText">
4+
<div *ngIf="partOfList && viewHeight > maxNoteHeightInList && !isFullScreen; else wholeText">
35
<div [ngClass]="{ more_text: showMoreText, less_text_note: !showMoreText }">
46
<p [innerHtml]="note.content | md2html"></p>
57
</div>

apps/codever-ui/src/app/shared/note-details/note-card-body/note-content.component.scss

Whitespace-only changes.

apps/codever-ui/src/app/shared/note-details/note-card-body/note-content.component.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export class NoteContentComponent implements AfterViewInit, AfterViewChecked {
2424
@Input()
2525
partOfList = false;
2626

27+
@Input()
28+
isFullScreen = false;
29+
2730
show = false; // add one more property
2831
public showMoreText = false;
2932

@@ -47,10 +50,4 @@ export class NoteContentComponent implements AfterViewInit, AfterViewChecked {
4750
this.changeDetectorRef.detectChanges();
4851
}
4952
}
50-
51-
toggleFullScreen(codePart: HTMLElement) {
52-
if (screenfull.isEnabled) {
53-
screenfull.toggle(codePart);
54-
}
55-
}
5653
}

apps/codever-ui/src/app/shared/note-details/note-details.component.html

+24-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
<div *ngIf="note$ | async as note" class="card">
2-
<div class="card-body show-hide note-bg">
3-
<h5 class="card-title">
4-
<i class="fa fa-sticky-note fa-xs mr-2 anthracite-gray"></i>
5-
{{ note.title }}
6-
</h5>
7-
<h6 class="card-subtitle mb-2 text-muted url-under-title">
1+
<div *ngIf="note$ | async as note" class="card" #noteEntry >
2+
<div class="card-body show-hide note-bg note-container">
3+
<div class="note-header">
4+
<div class="title-and-subtitle">
5+
<h5 class="card-title">
6+
<i class="fa fa-sticky-note fa-xs mr-2 anthracite-gray"></i>
7+
{{ note.title }}
8+
</h5>
9+
<h6 class="card-subtitle mb-2 text-muted url-under-title">
810
<span title="last updated">
911
<i class="far fa-calendar-alt"></i> {{ note.updatedAt | date : 'yyyy-MM-dd' }}
1012
</span>
11-
<span *ngIf="note.reference"
12-
><strong> - ref</strong>:
13+
<span *ngIf="note.reference"
14+
><strong> - ref</strong>:
1315
<span
1416
*ngIf="
1517
note.reference.startsWith('http:') ||
@@ -30,9 +32,20 @@ <h6 class="card-subtitle mb-2 text-muted url-under-title">
3032
<span>{{ note.reference }}</span>
3133
</ng-template>
3234
</span>
33-
</h6>
35+
</h6>
36+
</div>
37+
<div>
38+
<span title="Toggle Fullscreen" (click)="toggleFullScreen(noteEntry)">
39+
<i *ngIf="!isFullScreen" class="fas fa-expand fa-lg"></i>
40+
<i *ngIf="isFullScreen" class="fas fa-compress fa-lg"></i>
41+
</span>
42+
</div>
43+
</div>
3444

35-
<app-note-content [note]="note" [queryText]="queryText" [partOfList]="partOfList"></app-note-content>
45+
<hr class="title-content-separator"/>
46+
<div [ngClass]="{'scrollable-div-fullscreen': isFullScreen}">
47+
<app-note-content [note]="note" [queryText]="queryText" [partOfList]="partOfList" [isFullScreen]="isFullScreen"></app-note-content>
48+
</div>
3649
</div>
3750

3851
<div class="card-footer" style="padding-right: 0.3rem">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.note-header {
2+
display: flex;
3+
justify-content: space-between;
4+
}
5+
6+
7+

apps/codever-ui/src/app/shared/note-details/note-details.component.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { Component, Input, OnInit } from '@angular/core';
1+
import { Component, HostListener, Input, OnInit } from '@angular/core';
22
import { Note } from '../../core/model/note';
33
import { Observable, of } from 'rxjs';
44
import { UserInfoStore } from '../../core/user/user-info.store';
55
import { ActivatedRoute, Router } from '@angular/router';
66
import { switchMap } from 'rxjs/operators';
77
import { PersonalNotesService } from '../../core/personal-notes.service';
8+
import * as screenfull from 'screenfull';
89

910
@Component({
1011
selector: 'app-note-details',
1112
templateUrl: './note-details.component.html',
13+
styleUrls: ['./note-details.component.scss'],
1214
})
1315
export class NoteDetailsComponent implements OnInit {
1416
@Input()
@@ -26,6 +28,8 @@ export class NoteDetailsComponent implements OnInit {
2628
userId$: Observable<string>;
2729
noteId: string;
2830

31+
isFullScreen = false;
32+
2933
constructor(
3034
private personalNotesService: PersonalNotesService,
3135
private userInfoStore: UserInfoStore,
@@ -61,4 +65,16 @@ export class NoteDetailsComponent implements OnInit {
6165
const link = [`/my-notes/${note._id}/clone`];
6266
this.router.navigate(link, { state: { note: note } });
6367
}
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+
}
6480
}

apps/codever-ui/src/styles.scss

+9
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,12 @@ label {
282282
#sidebar-wrapper .list-group {
283283
width: 18rem;
284284
}
285+
286+
.title-content-separator {
287+
margin: 0 0 0.5rem 0;
288+
}
289+
290+
.scrollable-div-fullscreen {
291+
overflow-y: auto;
292+
max-height: calc(100vh - 150px);
293+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Codever",
3-
"version": "8.10.2",
3+
"version": "8.11.0",
44
"description": "Codever - bookmarks, snippets and notes manager for developers & co",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",

0 commit comments

Comments
 (0)