diff --git a/package-lock.json b/package-lock.json
index de35b092..485922f4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -358,6 +358,11 @@
"integrity": "sha512-d1Twx1NM49dQ7jbNZfaHTQWuYL9cFVrGxYpbc3BvMf4626lOJOZnp2aJQNB9vP/WX3UOe1TrTUMABrGRu6FZhg==",
"dev": true
},
+ "@types/prismjs": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.9.0.tgz",
+ "integrity": "sha512-zeh+xd2pcCvWm1XtWLR4v5pzZMybKeq6X8Q4cIZMMx8GmyKDUfJaOtw+JaONHUQt5ncKFXezl8QGIDQsSF5YfA=="
+ },
"@types/q": {
"version": "0.0.32",
"resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz",
diff --git a/package.json b/package.json
index 926f200c..a747c17f 100644
--- a/package.json
+++ b/package.json
@@ -40,6 +40,7 @@
"@swimlane/ngx-charts": "7.0.1",
"@swimlane/ngx-datatable": "11.1.7",
"@swimlane/ngx-dnd": "3.1.0",
+ "@types/prismjs": "1.9.0",
"angular-calendar": "0.23.0",
"angular-in-memory-web-api": "0.5.2",
"angular2-markdown": "1.6.0",
@@ -54,6 +55,7 @@
"ngx-color-picker": "5.3.0",
"ngx-cookie-service": "1.0.9",
"perfect-scrollbar": "1.3.0",
+ "prismjs": "1.9.0",
"rxjs": "5.5.6",
"web-animations-js": "2.3.1",
"zone.js": "0.8.18"
diff --git a/src/app/core/components/highlight/highlight.component.scss b/src/app/core/components/highlight/highlight.component.scss
index 8fdbe2d4..1844f192 100644
--- a/src/app/core/components/highlight/highlight.component.scss
+++ b/src/app/core/components/highlight/highlight.component.scss
@@ -1,3 +1,6 @@
:host {
-
+ display: block;
+ padding: 8px;
+ background: #263238;
+ cursor: text;
}
\ No newline at end of file
diff --git a/src/app/core/components/highlight/highlight.component.ts b/src/app/core/components/highlight/highlight.component.ts
index 3bf9c1fc..1066b449 100644
--- a/src/app/core/components/highlight/highlight.component.ts
+++ b/src/app/core/components/highlight/highlight.component.ts
@@ -1,15 +1,14 @@
import { Component, ContentChild, ElementRef, Input, OnInit } from '@angular/core';
-import * as hljs from 'highlight.js';
+import * as Prism from 'prismjs/prism';
+import './prism-languages';
@Component({
- selector : 'fuse-hljs',
+ selector : 'fuse-highlight',
template : ' ',
- styleUrls: ['./hljs.component.scss']
+ styleUrls: ['./highlight.component.scss']
})
-export class FuseHljsComponent implements OnInit
+export class FuseHighlightComponent implements OnInit
{
- hljs: any;
-
@ContentChild('source') source: ElementRef;
@Input('lang') lang: string;
@@ -17,7 +16,7 @@ export class FuseHljsComponent implements OnInit
private elementRef: ElementRef
)
{
- this.hljs = hljs;
+
}
ngOnInit()
@@ -32,6 +31,20 @@ export class FuseHljsComponent implements OnInit
// Split the source into lines
const sourceLines = originalSource.split('\n');
+ // Remove the first and the last line of the source
+ // code if they are blank lines. This way, the html
+ // can be formatted properly while using fuse-highlight
+ // component
+ if ( !sourceLines[0].trim() )
+ {
+ sourceLines.shift();
+ }
+
+ if ( !sourceLines[sourceLines.length - 1].trim() )
+ {
+ sourceLines.pop();
+ }
+
// Find the first non-whitespace char index in
// the first line of the source code
const indexOfFirstChar = sourceLines[0].search(/\S|$/);
@@ -39,20 +52,27 @@ export class FuseHljsComponent implements OnInit
// Generate the trimmed source
let source = '';
- // Iterate through all the lines and trim the
- // beginning white space depending on the index
+ // Iterate through all the lines
sourceLines.forEach((line, index) => {
+ // Trim the beginning white space depending on the index
+ // and concat the source code
source = source + line.substr(indexOfFirstChar, line.length);
+ // If it's not the last line...
if ( index !== sourceLines.length - 1 )
{
+ // Add a line break at the end
source = source + '\n';
}
});
+ // Generate the highlighted code
+ const highlightedCode = Prism.highlight(source, Prism.languages[this.lang]);
+
+ // Replace the innerHTML of the component with the highlighted code
this.elementRef.nativeElement.innerHTML =
- `
` + this.hljs.highlight(this.lang, source).value + `
`;
+ '' + highlightedCode + '
';
}
}
diff --git a/src/app/core/components/highlight/prism-languages.ts b/src/app/core/components/highlight/prism-languages.ts
index e69de29b..14842a35 100644
--- a/src/app/core/components/highlight/prism-languages.ts
+++ b/src/app/core/components/highlight/prism-languages.ts
@@ -0,0 +1,16 @@
+import 'prismjs/prism';
+import 'prismjs/components/prism-c';
+import 'prismjs/components/prism-cpp';
+import 'prismjs/components/prism-csharp';
+import 'prismjs/components/prism-css';
+import 'prismjs/components/prism-diff';
+import 'prismjs/components/prism-markup';
+import 'prismjs/components/prism-java';
+import 'prismjs/components/prism-javascript';
+import 'prismjs/components/prism-json';
+import 'prismjs/components/prism-perl';
+import 'prismjs/components/prism-php';
+import 'prismjs/components/prism-python';
+import 'prismjs/components/prism-sass';
+import 'prismjs/components/prism-scss';
+import 'prismjs/components/prism-typescript';
diff --git a/src/app/core/modules/shared.module.ts b/src/app/core/modules/shared.module.ts
index 9cd8dc98..168a0c4b 100644
--- a/src/app/core/modules/shared.module.ts
+++ b/src/app/core/modules/shared.module.ts
@@ -15,7 +15,7 @@ import { FuseConfirmDialogComponent } from '../components/confirm-dialog/confirm
import { FuseCountdownComponent } from '../components/countdown/countdown.component';
import { FuseMatchMedia } from '../services/match-media.service';
import { FuseNavbarVerticalService } from '../../main/navbar/vertical/navbar-vertical.service';
-import { FuseHljsComponent } from '../components/hljs/hljs.component';
+import { FuseHighlightComponent } from '../components/highlight/highlight.component';
import { FusePerfectScrollbarDirective } from '../directives/fuse-perfect-scrollbar/fuse-perfect-scrollbar.directive';
import { FuseIfOnDomDirective } from '../directives/fuse-if-on-dom/fuse-if-on-dom.directive';
import { FuseMaterialColorPickerComponent } from '../components/material-color-picker/material-color-picker.component';
@@ -30,7 +30,7 @@ import { TranslateModule } from '@ngx-translate/core';
FuseMatSidenavTogglerDirective,
FuseConfirmDialogComponent,
FuseCountdownComponent,
- FuseHljsComponent,
+ FuseHighlightComponent,
FuseIfOnDomDirective,
FusePerfectScrollbarDirective,
FuseMaterialColorPickerComponent
@@ -56,7 +56,7 @@ import { TranslateModule } from '@ngx-translate/core';
FuseMatSidenavTogglerDirective,
FusePipesModule,
FuseCountdownComponent,
- FuseHljsComponent,
+ FuseHighlightComponent,
FusePerfectScrollbarDirective,
ReactiveFormsModule,
ColorPickerModule,
diff --git a/src/app/core/scss/partials/plugins/_plugins.scss b/src/app/core/scss/partials/plugins/_plugins.scss
index f9d4c979..3ca67732 100644
--- a/src/app/core/scss/partials/plugins/_plugins.scss
+++ b/src/app/core/scss/partials/plugins/_plugins.scss
@@ -1,4 +1,3 @@
-@import "highlight";
@import "prism";
@import "perfect-scrollbar";
@import "ngx-datatable";
diff --git a/src/app/core/scss/partials/plugins/_prism.scss b/src/app/core/scss/partials/plugins/_prism.scss
index 40eb6fec..276ee250 100644
--- a/src/app/core/scss/partials/plugins/_prism.scss
+++ b/src/app/core/scss/partials/plugins/_prism.scss
@@ -2,7 +2,7 @@
$base00: #263238;
$base01: #2C393F;
-$base02: #37474F;
+$base02: #4A5A62;
$base03: #707880;
$base04: #C9CCD3;
$base05: #CDD3DE;
diff --git a/src/app/main/content/components-third-party/google-maps/google-maps.component.html b/src/app/main/content/components-third-party/google-maps/google-maps.component.html
index 04f955ed..a85e5cc0 100644
--- a/src/app/main/content/components-third-party/google-maps/google-maps.component.html
+++ b/src/app/main/content/components-third-party/google-maps/google-maps.component.html
@@ -38,13 +38,13 @@
diff --git a/src/app/main/content/components/cards/cards.component.html b/src/app/main/content/components/cards/cards.component.html
index 0d62a6e0..8b50a74e 100644
--- a/src/app/main/content/components/cards/cards.component.html
+++ b/src/app/main/content/components/cards/cards.component.html
@@ -52,9 +52,11 @@
-
-
-
-
100px height
-
+
@@ -111,12 +111,12 @@
h-25-p
-
25% height
-
+
@@ -127,12 +127,12 @@
h-100-p
-
100% height
-
+
diff --git a/src/app/main/content/ui/helper-classes/tabs/width-height/width-height.component.scss b/src/app/main/content/ui/helper-classes/tabs/width-height/width-height.component.scss
index d1ed4228..073878fb 100644
--- a/src/app/main/content/ui/helper-classes/tabs/width-height/width-height.component.scss
+++ b/src/app/main/content/ui/helper-classes/tabs/width-height/width-height.component.scss
@@ -4,7 +4,6 @@
.source-code {
position: relative;
- background: #F3F4F6;
margin-bottom: 24px;
min-height: 180px;
diff --git a/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.html b/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.html
index fc28433b..97e71b48 100644
--- a/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.html
+++ b/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.html
@@ -14,7 +14,7 @@
-
@@ -23,7 +23,7 @@
-
+
@@ -40,7 +40,7 @@
-
@@ -52,7 +52,7 @@
-
+
@@ -69,7 +69,7 @@
-
@@ -81,7 +81,7 @@
-
+
@@ -108,7 +108,7 @@
-
@@ -124,7 +124,7 @@
- Ordered list item
-
+
@@ -145,7 +145,7 @@
-
@@ -161,7 +161,7 @@
- Unordered list item
-
+
@@ -183,7 +183,7 @@
-
@@ -194,7 +194,7 @@
- This is also another definition description
-
+
diff --git a/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.scss b/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.scss
index a4340ab6..91755f27 100644
--- a/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.scss
+++ b/src/app/main/content/ui/typography/tabs/blockquotes-lists/blockquotes-lists.component.scss
@@ -4,7 +4,6 @@
.source-code {
position: relative;
- background: #F3F4F6;
margin-bottom: 24px;
min-height: 180px;
diff --git a/src/app/main/content/ui/typography/tabs/headings/headings.component.html b/src/app/main/content/ui/typography/tabs/headings/headings.component.html
index 1d320c6c..389e725e 100644
--- a/src/app/main/content/ui/typography/tabs/headings/headings.component.html
+++ b/src/app/main/content/ui/typography/tabs/headings/headings.component.html
@@ -11,12 +11,12 @@
Display 4
-
Display 4
-
+
@@ -27,12 +27,12 @@
Display 3
-
Display 3
-
+
@@ -43,12 +43,12 @@
Display 2
-
Display 2
-
+
@@ -58,12 +58,12 @@
Display 1
-
Display 1
-
+
@@ -74,12 +74,12 @@
Headline
-
Headline
-
+
@@ -90,12 +90,12 @@
Title
-
Title
-
+
@@ -106,12 +106,12 @@
Subheading 2
-
Subheading 2
-
+
@@ -122,12 +122,12 @@
Subheading 1
-
Subheading 1
-
+
@@ -138,12 +138,12 @@
Body 1
-
Body 1
-
+
@@ -154,12 +154,12 @@
Body 2
-
Body 2
-
+
@@ -170,12 +170,12 @@
Caption
-
Caption
-
+
@@ -192,13 +192,13 @@
Heading 1
-
Heading 1
Heading 1
-
+
@@ -209,13 +209,13 @@
Heading 2
-
Heading 2
Heading 2
-
+
@@ -226,13 +226,13 @@
Heading 3
-
Heading 3
Heading 3
-
+
@@ -243,13 +243,13 @@
Heading 4
-
Heading 4
Heading 4
-
+
@@ -260,13 +260,13 @@
Heading 5
-
Heading 5
Heading 5
-
+
@@ -277,13 +277,13 @@
Heading 6
-
Heading 6
Heading 6
-
+
diff --git a/src/app/main/content/ui/typography/tabs/headings/headings.component.scss b/src/app/main/content/ui/typography/tabs/headings/headings.component.scss
index 94d9b834..66ca047d 100644
--- a/src/app/main/content/ui/typography/tabs/headings/headings.component.scss
+++ b/src/app/main/content/ui/typography/tabs/headings/headings.component.scss
@@ -4,7 +4,6 @@
.source-code {
position: relative;
- background: #F3F4F6;
margin-bottom: 24px;
min-height: 180px;
diff --git a/src/app/main/content/ui/typography/tabs/helpers/helpers.component.html b/src/app/main/content/ui/typography/tabs/helpers/helpers.component.html
index 56cf09ac..9f7f7252 100644
--- a/src/app/main/content/ui/typography/tabs/helpers/helpers.component.html
+++ b/src/app/main/content/ui/typography/tabs/helpers/helpers.component.html
@@ -13,14 +13,14 @@
font-weight: 900
-
100 font weight
...
900 font weight
-
+
@@ -37,12 +37,12 @@
font-size: 20
-
font-size: 20
-
+
@@ -61,14 +61,14 @@
line-height: 120
-
2px line height
...
120px line height
-
+
@@ -84,12 +84,12 @@
Left aligned text
-
Left aligned text
-
+
@@ -99,12 +99,12 @@
Center aligned text
-
Center aligned text
-
+
@@ -114,12 +114,12 @@
Right aligned text
-
Right aligned text
-
+
@@ -131,14 +131,14 @@
-
Boxed text
-
+
@@ -150,14 +150,14 @@
-
Boxed text light
-
+
@@ -169,14 +169,14 @@
-
Strike-through text
-
+
@@ -186,12 +186,12 @@
Italic text
-
Italic text
-
+
@@ -201,12 +201,12 @@
Semi-bold text
-
Semi-bold text
-
+
@@ -216,12 +216,12 @@
Bold text
-
Bold text
-
+
@@ -233,14 +233,14 @@
-
This is a truncated text. It will be truncated if it's too long. Vivamus convallis dui porta massa.
-
+
diff --git a/src/app/main/content/ui/typography/tabs/helpers/helpers.component.scss b/src/app/main/content/ui/typography/tabs/helpers/helpers.component.scss
index 48dd1da4..faa39dc7 100644
--- a/src/app/main/content/ui/typography/tabs/helpers/helpers.component.scss
+++ b/src/app/main/content/ui/typography/tabs/helpers/helpers.component.scss
@@ -4,7 +4,6 @@
.source-code {
position: relative;
- background: #F3F4F6;
margin-bottom: 24px;
min-height: 180px;
diff --git a/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.html b/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.html
index 454d9343..067d9f0f 100644
--- a/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.html
+++ b/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.html
@@ -8,12 +8,12 @@
CSS
-
CSS
-
+
@@ -23,12 +23,12 @@
This is a marked text.
-
This is a marked text.
-
+
@@ -40,12 +40,12 @@
-
This is a deleted text.
-
+
@@ -55,12 +55,12 @@
This is a strike-through text.
-
This is a strike-through text.
-
+
@@ -70,12 +70,12 @@
This is an underlined text.
-
This is an underlined text.
-
+
@@ -87,12 +87,12 @@
-
This is a small text.
-
+
@@ -102,12 +102,12 @@
This is a strong text.
-
This is a strong text.
-
+
@@ -117,12 +117,12 @@
This is an italic text.
-
This is an italic text.
-
+
@@ -135,14 +135,14 @@
-
This is a
super
text.
-
+
@@ -156,14 +156,14 @@
-
This is a
sub
text.
-
+
@@ -176,14 +176,14 @@
-
This is a
capitalized
text.
-
+
@@ -196,14 +196,14 @@
-
This is an
uppercase
text.
-
+
@@ -216,14 +216,14 @@
-
This is a
LOWERCASE
text.
-
+
diff --git a/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.scss b/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.scss
index 0445f273..81248227 100644
--- a/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.scss
+++ b/src/app/main/content/ui/typography/tabs/inline-text-elements/inline-text-elements.component.scss
@@ -4,7 +4,6 @@
.source-code {
position: relative;
- background: #F3F4F6;
margin-bottom: 24px;
min-height: 180px;
diff --git a/src/app/navigation/navigation.model.ts b/src/app/navigation/navigation.model.ts
index a0029669..da8e126d 100644
--- a/src/app/navigation/navigation.model.ts
+++ b/src/app/navigation/navigation.model.ts
@@ -823,11 +823,11 @@ export class FuseNavigationModel implements FuseNavigationModelInterface
'url' : '/components/countdown'
},
{
- 'id' : 'highlightjs',
- 'title': 'Highlight.js',
+ 'id' : 'highlight',
+ 'title': 'Highlight',
'type' : 'item',
'icon' : 'settings_input_component',
- 'url' : '/components/highlightjs'
+ 'url' : '/components/highlight'
},
{
'id' : 'material-color-picker',