From b582fa29fc4916fb8a6e5973e408a4d5ec4318cc Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 27 Mar 2017 08:59:32 +0200 Subject: [PATCH] add prefix to prism --- app/modules/components/tags/tag/tag.scss | 2 +- .../wysiwyg/wysiwyg-code-hightlighter.service.coffee | 4 ++++ app/modules/components/wysiwyg/wysiwyg.scss | 1 + app/styles/shame/shame.scss | 8 -------- gulpfile.js | 9 +++++++-- package.json | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/modules/components/tags/tag/tag.scss b/app/modules/components/tags/tag/tag.scss index abdb8c98..77fd5f75 100644 --- a/app/modules/components/tags/tag/tag.scss +++ b/app/modules/components/tags/tag/tag.scss @@ -1,5 +1,5 @@ // this :not(code) prevent to override prismjs (wysiwyg) styles -:not(code) > .tag { +.tag { @include font-type(light); @include font-size(small); background: $mass-white; diff --git a/app/modules/components/wysiwyg/wysiwyg-code-hightlighter.service.coffee b/app/modules/components/wysiwyg/wysiwyg-code-hightlighter.service.coffee index 7a07e17f..6eecfe4e 100644 --- a/app/modules/components/wysiwyg/wysiwyg-code-hightlighter.service.coffee +++ b/app/modules/components/wysiwyg/wysiwyg-code-hightlighter.service.coffee @@ -23,6 +23,10 @@ ### class WysiwygCodeHightlighterService + constructor: () -> + Prism.plugins.customClass.prefix('prism-') + Prism.plugins.customClass.map({}) + getLanguages: () -> return new Promise (resolve, reject) => if @.languages diff --git a/app/modules/components/wysiwyg/wysiwyg.scss b/app/modules/components/wysiwyg/wysiwyg.scss index 3e538f16..3ddf3e7f 100644 --- a/app/modules/components/wysiwyg/wysiwyg.scss +++ b/app/modules/components/wysiwyg/wysiwyg.scss @@ -284,3 +284,4 @@ tg-wysiwyg { fill: $primary-light; } } + diff --git a/app/styles/shame/shame.scss b/app/styles/shame/shame.scss index 5a238d13..18122cdd 100644 --- a/app/styles/shame/shame.scss +++ b/app/styles/shame/shame.scss @@ -7,14 +7,6 @@ _:-ms-fullscreen, } } - -// External lybrary makes weird things. Please destroy -.markItUpEditor { - @include font-size(small); - line-height: 1.5; - font-family: monospace; -} - // Prevent IE Bug when the user clicks in the svg path the js event click doesn't work svg { diff --git a/gulpfile.js b/gulpfile.js index 244f01c5..2bf9d1c9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -32,6 +32,7 @@ var gulp = require("gulp"), path = require('path'), addsrc = require('gulp-add-src'), jsonminify = require('gulp-jsonminify'), + classPrefix = require('gulp-class-prefix'), coffeelint = require('gulp-coffeelint'); var argv = require('minimist')(process.argv.slice(2)); @@ -74,7 +75,6 @@ paths.css_vendor = [ paths.app + "styles/vendor/*.css", paths.modules + "medium-editor/dist/css/medium-editor.css", paths.modules + "medium-editor/dist/css/themes/default.css", - paths.modules + "highlight.js/styles/default.css", paths.modules + "prismjs/themes/prism-okaidia.css" ]; paths.locales = paths.app + "locales/**/*.json"; @@ -184,8 +184,8 @@ paths.libs = [ paths.modules + "medium-editor/dist/js/medium-editor.js", paths.modules + "to-markdown/dist/to-markdown.js", paths.modules + "markdown-it/dist/markdown-it.js", - paths.modules + "highlight.js/lib/highlight.js", paths.modules + "prismjs/prism.js", + paths.modules + "prismjs/plugins/custom-class/prism-custom-class.js", paths.modules + "medium-editor-autolist/dist/autolist.js", paths.modules + "autolinker/dist/Autolinker.js", paths.app + "js/dom-autoscroller.js", @@ -336,7 +336,12 @@ gulp.task("app-css", function() { }); gulp.task("vendor-css", function() { + var isPrism = function(file) { + return file.path.indexOf('prism-okaidia') !== -1; + }; + return gulp.src(paths.css_vendor) + .pipe(gulpif(isPrism, classPrefix('prism-'))) .pipe(concat("vendor.css")) .pipe(gulp.dest(paths.tmp)); }); diff --git a/package.json b/package.json index 736491b1..03f9f9dd 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "dom-autoscroller": "^1.3.1", "dragula": "^3.7.2", "flot-axislabels": "git+https://git@github.com/juanfran/flot-axislabels.git", - "highlight.js": "^9.7.0", + "gulp-class-prefix": "^1.0.1", "immutable": "^3.8.1", "intro.js": "^2.3.0", "jquery": "^2.2.3",