From 3e132e42058e9e9f0a055612bc5c13399da1d45c Mon Sep 17 00:00:00 2001 From: Klaus Quibeldey-Cirkel <klaus-dieter.quibeldey-cirkel@mni.thm.de> Date: Mon, 24 May 2021 06:49:01 +0200 Subject: [PATCH] extend Markdown plugins to all editable dialogs | remove undefined room.closed variable --- angular.json | 8 ++++++- src/app/app.module.ts | 8 ++++++- .../room-edit/room-edit.component.html | 3 ++- .../room-creator-page.component.html | 3 ++- .../room-moderator-page.component.html | 3 ++- .../room-participant-page.component.html | 3 ++- .../motd-temp-dialog.component.html | 3 ++- .../comment-answer.component.html | 6 +++-- .../shared/header/header.component.html | 24 +++---------------- .../question-wall.component.html | 6 +++-- .../question-wall.component.scss | 1 + .../question-wall/question-wall.component.ts | 2 +- 12 files changed, 37 insertions(+), 33 deletions(-) diff --git a/angular.json b/angular.json index b86db1fe7..d109071a5 100644 --- a/angular.json +++ b/angular.json @@ -23,11 +23,17 @@ ], "styles": [ "src/styles.scss", - "./node_modules/material-design-icons/iconfont/material-icons.css" + "./node_modules/material-design-icons/iconfont/material-icons.css", + "node_modules/prismjs/themes/prism-okaidia.css", + "node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css", + "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css" ], "scripts": [ "node_modules/marked/lib/marked.js", "node_modules/emoji-toolkit/lib/js/joypixels.min.js", + "node_modules/prismjs/prism.js", + "node_modules/prismjs/components/prism-csharp.min.js", + "node_modules/prismjs/components/prism-css.min.js", "node_modules/prismjs/plugins/line-highlight/prism-line-highlight.js", "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js", "node_modules/katex/dist/katex.min.js" diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9aaf493fd..67cd297df 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -125,7 +125,13 @@ export function initializeApp(appConfig: AppConfig) { markedOptions: { provide: MarkedOptions, useValue: { - sanitize: true + pedantic: false, + gfm: true, + breaks: true, + sanitize: false, + smartLists: true, + smartypants: true, + xhtml: false } } }), diff --git a/src/app/components/creator/_dialogs/room-edit/room-edit.component.html b/src/app/components/creator/_dialogs/room-edit/room-edit.component.html index cbcd9da2b..734041e4e 100644 --- a/src/app/components/creator/_dialogs/room-edit/room-edit.component.html +++ b/src/app/components/creator/_dialogs/room-edit/room-edit.component.html @@ -51,7 +51,8 @@ </mat-tab> <mat-tab label="{{'session.preview' | translate}}" [disabled]="!editRoom.description"> - <markdown [data]="editRoom.description"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="editRoom.description"></markdown> </mat-tab> </mat-tab-group> <div fxLayoutAlign="center center"> diff --git a/src/app/components/creator/room-creator-page/room-creator-page.component.html b/src/app/components/creator/room-creator-page/room-creator-page.component.html index eaf734408..951a099f1 100644 --- a/src/app/components/creator/room-creator-page/room-creator-page.component.html +++ b/src/app/components/creator/room-creator-page/room-creator-page.component.html @@ -77,7 +77,8 @@ </div> <mat-card-content *ngIf="room.description" fxLayoutAlign="center"> - <markdown [data]="room.description.trim()"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="room.description.trim()"></markdown> </mat-card-content> <div fxLayout="column" fxLayoutAlign="center" diff --git a/src/app/components/moderator/room-moderator-page/room-moderator-page.component.html b/src/app/components/moderator/room-moderator-page/room-moderator-page.component.html index d03cf13b0..77eaf139a 100644 --- a/src/app/components/moderator/room-moderator-page/room-moderator-page.component.html +++ b/src/app/components/moderator/room-moderator-page/room-moderator-page.component.html @@ -35,7 +35,8 @@ <mat-divider></mat-divider> <mat-card-content *ngIf="room.description" fxLayoutAlign="center"> - <markdown [data]="room.description.trim()"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="room.description.trim()"></markdown> </mat-card-content> <div fxLayout="column" fxLayoutAlign="center" diff --git a/src/app/components/participant/room-participant-page/room-participant-page.component.html b/src/app/components/participant/room-participant-page/room-participant-page.component.html index ee603de0b..b7d127ee8 100644 --- a/src/app/components/participant/room-participant-page/room-participant-page.component.html +++ b/src/app/components/participant/room-participant-page/room-participant-page.component.html @@ -21,7 +21,8 @@ </div> <mat-divider></mat-divider> <mat-card-content *ngIf="room.description" fxLayoutAlign="center"> - <markdown [data]="room.description.trim()"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="room.description.trim()"></markdown> </mat-card-content> <mat-grid-list cols="1" rowHeight="2:1"> <mat-grid-tile> diff --git a/src/app/components/shared/_dialogs/motd-temp-dialog/motd-temp-dialog.component.html b/src/app/components/shared/_dialogs/motd-temp-dialog/motd-temp-dialog.component.html index d8186fd89..fa5fdaa23 100644 --- a/src/app/components/shared/_dialogs/motd-temp-dialog/motd-temp-dialog.component.html +++ b/src/app/components/shared/_dialogs/motd-temp-dialog/motd-temp-dialog.component.html @@ -7,7 +7,8 @@ </ars-row> <mat-dialog-content class="container" ars-flex-box> <ars-row ars-flex-box> - <markdown class="images" [data]="content"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="content"></markdown> </ars-row> <ars-row [height]="32"></ars-row> <ars-fill></ars-fill> diff --git a/src/app/components/shared/comment-answer/comment-answer.component.html b/src/app/components/shared/comment-answer/comment-answer.component.html index fdd4f031a..e96bc84b6 100644 --- a/src/app/components/shared/comment-answer/comment-answer.component.html +++ b/src/app/components/shared/comment-answer/comment-answer.component.html @@ -11,7 +11,8 @@ <mat-card class="answer border-answer" *ngIf="!isStudent || answer"> <div *ngIf="(isStudent || !edit) && answer"> - <markdown [data]="answer"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="answer"></markdown> <div fxLayout="row" fxLayoutAlign="end"> <button mat-raised-button @@ -52,7 +53,8 @@ </mat-tab> <mat-tab label="{{'session.preview' | translate}}" [disabled]="!answer"> - <markdown [data]="answer"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="answer"></markdown> </mat-tab> </mat-tab-group> <div fxLayout="row" diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index 6184ca014..cefb9bee8 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -17,9 +17,7 @@ </h2> - <ng-container *ngIf="room && room.closed"> - <h1>{{'header.questions-blocked'|translate}}</h1> - </ng-container> + <ars-style-btn-material [ngClass]="{'noOfQuestions': deviceType === 'desktop'}" @@ -122,15 +120,7 @@ <!-- Question board --> <ng-container *ngIf="router.url.endsWith('/comments')"> - <button mat-menu-item - *ngIf="user && !router.url.endsWith('moderator/comments') && ((user.role > 0) || ((user.role == 0) && room && !room.closed))" - tabindex="0" - (click)="navigateCreateQuestion();"> - <mat-icon> - add - </mat-icon> - <span>{{'header.create-question' | translate}}</span> - </button> + <ng-container> @@ -348,15 +338,7 @@ <span>{{'header.delete-account' | translate}}</span> </button> - <ng-container *ngIf="shortId && user && user.role > 0"> - <button mat-menu-item - (click)="blockQuestions()" - [ngClass]="{'color-warn': room.closed}" - tabindex="0"> - <mat-icon class="color-warn">block</mat-icon> - <span>{{'header.block' | translate}}</span> - </button> - </ng-container> + <button mat-menu-item (click)="logout()" diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.html b/src/app/components/shared/questionwall/question-wall/question-wall.component.html index e4bfc4f2e..cae420d79 100644 --- a/src/app/components/shared/questionwall/question-wall/question-wall.component.html +++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.html @@ -115,7 +115,8 @@ </ars-row> <ars-row> <ars-row class="bound" style="padding:16px 32px 16px 32px;box-sizing:border-box;max-width:100%;"> - <markdown [ngStyle]="{'font-size':fontSize+'%'}" class="questionwall-present-markdown" [data]="commentFocus.comment.body"></markdown> + <markdown [ngStyle]="{'font-size':fontSize+'%'}" class="questionwall-present-markdown" class="images" katex emoji lineNumbers lineHighlight + [data]="commentFocus.comment.body"></markdown> </ars-row> </ars-row> <ars-row [height]="50"> @@ -220,7 +221,8 @@ (click)="focusComment(comment)" style="box-sizing:border-box;padding:0 16px;cursor:pointer"> <p class="questionwall-comment-body"> - <markdown [data]="comment.comment.body"></markdown> + <markdown class="images" katex emoji lineNumbers lineHighlight + [data]="comment.comment.body"></markdown> </p> </ars-row> <ars-row [height]="50"> diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.scss b/src/app/components/shared/questionwall/question-wall/question-wall.component.scss index df024156e..61c7abdad 100644 --- a/src/app/components/shared/questionwall/question-wall/question-wall.component.scss +++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.scss @@ -181,6 +181,7 @@ justify-content: center; hyphens: auto; word-break: break-word; + color: yellow; } &-inner { diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.ts b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts index 8148af8a7..a7f95f09f 100644 --- a/src/app/components/shared/questionwall/question-wall/question-wall.component.ts +++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts @@ -47,7 +47,7 @@ export class QuestionWallComponent implements OnInit, AfterViewInit, OnDestroy { userList = []; userSelection = false; tags; - fontSize = 250; + fontSize = 180; periodsList = Object.values(Period); period: Period = Period.ALL; -- GitLab