diff --git a/package-lock.json b/package-lock.json index 53e4efb1..2358f288 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4191,6 +4191,11 @@ "heimdalljs": "0.2.5" } }, + "highlight.js": { + "version": "9.12.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.12.0.tgz", + "integrity": "sha1-5tnb5Xy+/mB1HwKvM2GVhwyQwB4=" + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", diff --git a/package.json b/package.json index 2b1ca5cb..765ba6c4 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "core-js": "^2.4.1", "firebase": "^4.2.0", "hammerjs": "^2.0.8", + "highlight.js": "^9.12.0", "moment": "^2.18.1", "ngx-color-picker": "^4.2.0", "ngx-perfect-scrollbar": "^4.5.2", diff --git a/src/app/core/components/hljs/hljs.component.scss b/src/app/core/components/hljs/hljs.component.scss new file mode 100644 index 00000000..8fdbe2d4 --- /dev/null +++ b/src/app/core/components/hljs/hljs.component.scss @@ -0,0 +1,3 @@ +:host { + +} \ No newline at end of file diff --git a/src/app/core/components/hljs/hljs.component.ts b/src/app/core/components/hljs/hljs.component.ts new file mode 100644 index 00000000..fa49254c --- /dev/null +++ b/src/app/core/components/hljs/hljs.component.ts @@ -0,0 +1,33 @@ +import { Component, ElementRef, Input, OnInit } from '@angular/core'; +import * as hljs from 'highlight.js'; + +@Component({ + selector : 'fuse-hljs', + template : ' ', + styleUrls: ['./hljs.component.scss'] +}) +export class FuseHljsComponent implements OnInit +{ + hljs: any; + + @Input('source') source: any; + @Input('lang') lang: string; + + constructor( + private elementRef: ElementRef + ) + { + this.hljs = hljs; + } + + ngOnInit() + { + if ( !this.source && this.lang ) + { + return; + } + + this.elementRef.nativeElement.innerHTML = + `
` + this.hljs.highlight(this.lang, this.source).value + `
`;
+ }
+}
diff --git a/src/app/core/modules/shared.module.ts b/src/app/core/modules/shared.module.ts
index a16e4cb5..3d12e15f 100644
--- a/src/app/core/modules/shared.module.ts
+++ b/src/app/core/modules/shared.module.ts
@@ -18,13 +18,15 @@ import { FuseLayoutService } from '../services/layout.service';
import { FuseMatchMedia } from '../services/match-media.service';
import { FuseNavbarService } from '../../main/navbar/navbar.service';
import { FuseMdSidenavHelperService } from '../directives/md-sidenav-helper/md-sidenav-helper.service';
+import { FuseHljsComponent } from '../components/hljs/hljs.component';
@NgModule({
declarations : [
FuseMdSidenavHelperDirective,
FuseMdSidenavTogglerDirective,
FuseConfirmDialogComponent,
- FuseCountdownComponent
+ FuseCountdownComponent,
+ FuseHljsComponent
],
imports : [
FlexLayoutModule,
@@ -51,6 +53,7 @@ import { FuseMdSidenavHelperService } from '../directives/md-sidenav-helper/md-s
ColorPickerModule,
NgxDnDModule,
FuseCountdownComponent,
+ FuseHljsComponent,
NgxDatatableModule
],
entryComponents: [
diff --git a/src/app/core/scss/partials/_page-layouts.scss b/src/app/core/scss/partials/_page-layouts.scss
index a7be38a2..ebabfadf 100644
--- a/src/app/core/scss/partials/_page-layouts.scss
+++ b/src/app/core/scss/partials/_page-layouts.scss
@@ -311,10 +311,6 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too
.sidenav {
- &.md-is-locked-open {
- height: auto;
- }
-
.sidenav-content {
height: 100%;
}
@@ -366,6 +362,10 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too
transition: none;
}
}
+
+ .sidenav-content {
+ height: 100%;
+ }
}
.mat-sidenav-content {
diff --git a/src/app/core/scss/partials/plugins/_highlight.scss b/src/app/core/scss/partials/plugins/_highlight.scss
new file mode 100644
index 00000000..a721a67c
--- /dev/null
+++ b/src/app/core/scss/partials/plugins/_highlight.scss
@@ -0,0 +1,124 @@
+/*
+
+github.com style (c) Vasily Polovnyov