Add Prism.js.

This commit is contained in:
Florian THIERRY
2024-09-04 09:29:10 +02:00
parent ca6b207816
commit db669114b2
7 changed files with 125 additions and 2 deletions

View File

@@ -16,22 +16,70 @@ export const PROGRAMMING_LANGUAGES: ProgramingLanguage[] = [
code: 'bash',
label: 'Bash'
},
{
code: 'c',
label: 'C'
},
{
code: 'cpp',
label: 'C++'
},
{
code: 'cs',
label: 'C#'
},
{
code: 'lua',
label: 'Lua'
},
{
code: 'java',
label: 'Java'
},
{
code: 'json5',
label: 'JSON'
},
{
code: 'kt',
label: 'Kotlin'
},
{
code: 'markup',
label: 'html/xml'
},
{
code: 'php',
label: 'PHP'
},
{
code: 'plsql',
label: 'PL/SQL'
},
{
code: 'python',
label: 'Python'
},
{
code: 'powershell',
label: 'PowerShell'
},
{
code: 'rust',
label: 'Rust'
},
{
code: 'sql',
label: 'SQL'
}
},
{
code: 'ts',
label: 'Typescript'
},
{
code: 'yml',
label: 'YAML'
},
];
@Component({

View File

@@ -10,6 +10,8 @@ import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
import { MatIcon } from '@angular/material/icon';
import { AuthenticationService } from '../../core/service/authentication.service';
declare let Prism: any;
@Component({
selector: 'app-publication',
standalone: true,
@@ -40,6 +42,7 @@ export class PublicationComponent implements OnInit, OnDestroy {
.then(publication => {
this.publication = publication;
this.isAuthorAndUserEquals = this.authenticationService.getAuthenticatedUser()?.id === this.publication.author.id;
setTimeout(() => Prism.highlightAll(), 100);
})
.catch(error => {
this.snackBar.open('An error occurred while loading publication...', 'Close', { duration: 5000 });