diff --git a/bower.json b/bower.json index ce817895c..d8e4dbf4d 100644 --- a/bower.json +++ b/bower.json @@ -24,7 +24,8 @@ "jquery-oembed-all": "nfl/jquery-oembed-all", "flag-icon-css": "0.8.5", "moment": "2.12.0", - "clipboard": "1.5.10" + "clipboard": "1.5.10", + "MathJax": "2.6.1" }, "devDependencies": {}, "resolutions": { diff --git a/src/main/webapp/WEB-INF/views/protect/knowledge/edit_comment.jsp b/src/main/webapp/WEB-INF/views/protect/knowledge/edit_comment.jsp index 8fb91c0c0..a74fd12ae 100644 --- a/src/main/webapp/WEB-INF/views/protect/knowledge/edit_comment.jsp +++ b/src/main/webapp/WEB-INF/views/protect/knowledge/edit_comment.jsp @@ -17,25 +17,27 @@ " /> " /> + - - - - - - + + + + + + + @@ -45,76 +47,76 @@
-
- - " id="commentNo"/> - - people - nature - objects - places - symbols -
- - -
-
-
- -  <%= jspUtil.label("knowledge.add.label.select.file") %> - - -
-
-
- <%= jspUtil.label("knowledge.add.label.area.upload") %> -
- -
- -
"> -
" />
- -
- " /> -     - - -
-
-
- - - - - - - - - - " class="btn btn-warning"> -   - <%= jspUtil.label("label.cancel") %> - - +
+ + " id="commentNo"/> + + people + nature + objects + places + symbols +
+ + +
+
+
+ +  <%= jspUtil.label("knowledge.add.label.select.file") %> + + +
+
+
+ <%= jspUtil.label("knowledge.add.label.area.upload") %> +
+ +
+ +
"> +
" />
+ +
+ " /> +     + + +
+
+
+ + + + + + + + + + " class="btn btn-warning"> +   + <%= jspUtil.label("label.cancel") %> + +

diff --git a/src/main/webapp/WEB-INF/views/protect/knowledge/partials/partials-edit-scripts.jsp b/src/main/webapp/WEB-INF/views/protect/knowledge/partials/partials-edit-scripts.jsp index 9cdb4bf07..c5426421c 100644 --- a/src/main/webapp/WEB-INF/views/protect/knowledge/partials/partials-edit-scripts.jsp +++ b/src/main/webapp/WEB-INF/views/protect/knowledge/partials/partials-edit-scripts.jsp @@ -8,6 +8,14 @@ <% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + diff --git a/src/main/webapp/css/knowledge-view.css b/src/main/webapp/css/knowledge-view.css index 42964cf54..fcc8bf602 100644 --- a/src/main/webapp/css/knowledge-view.css +++ b/src/main/webapp/css/knowledge-view.css @@ -1,49 +1,49 @@ .bootstrap-tagsinput { - border: 0px solid #ccc; - box-shadow: none; - display: inline-block; - padding: 4px 6px; - margin-bottom: 0px; - color: #555; - vertical-align: middle; - border-radius: 0px; - max-width: 100%; - line-height: 22px; - cursor: text; + border: 0px solid #ccc; + box-shadow: none; + display: inline-block; + padding: 4px 6px; + margin-bottom: 0px; + color: #555; + vertical-align: middle; + border-radius: 0px; + max-width: 100%; + line-height: 22px; + cursor: text; } #content { - margin-top: 16px; + margin-top: 16px; } #content_head {} #content_main {} #template_items_area { - line-height: 30px; + line-height: 30px; } #template h5 { - margin-left: 5px; + margin-left: 5px; } .tag_list { - margin: 8px 0 8px 5px; + margin: 8px 0 8px 5px; } .insert_info {} .article_buttons {} .article_buttons div { - margin-bottom: 6px; + margin-bottom: 6px; } .article_info { } .article_info > a { - padding: 0px 15px; + padding: 0px 15px; } .btn_edit { - width: 97%; + width: 97%; } .btn_stock,.btn_like,.btn_agenda,.btn_copy_url { - width: 48%; + width: 48%; } .downloadfile { - margin-top: 2px; + margin-top: 2px; } /*============================================================ @@ -65,22 +65,22 @@ Comments margin-right: 20px; } @media screen and (max-width: 340px) { - .arrow_answer, - .arrow_question { - width: 50%; - } + .arrow_answer, + .arrow_question { + width: 50%; + } } @media screen and (min-width: 341px) and (max-width: 580px) { - .arrow_answer, - .arrow_question { - width: 60%; - } + .arrow_answer, + .arrow_question { + width: 60%; + } } @media screen and (min-width: 1228px) { - .arrow_answer, - .arrow_question { - width: 90%; - } + .arrow_answer, + .arrow_question { + width: 90%; + } } .arrow_answer:after, @@ -128,10 +128,10 @@ Comments } .arrow_question img { - max-width: 100%; + max-width: 100%; } .arrow_answer img { - max-width: 100%; + max-width: 100%; } .collapse_comment { diff --git a/src/main/webapp/css/markdown.css b/src/main/webapp/css/markdown.css index 5bf5db3ae..da8e9ce77 100644 --- a/src/main/webapp/css/markdown.css +++ b/src/main/webapp/css/markdown.css @@ -1,21 +1,21 @@ .markdown a { - /* color: #4183C4; */ - /* color: #18bc9c; */ + /* color: #4183C4; */ + /* color: #18bc9c; */ } .markdown a.absent { - /* color: #cc0000; */ + /* color: #cc0000; */ } .markdown a.anchor { - display: block; - padding-left: 30px; - margin-left: -30px; - cursor: pointer; - position: absolute; - top: 0; - left: 0; - bottom: 0; + display: block; + padding-left: 30px; + margin-left: -30px; + cursor: pointer; + position: absolute; + top: 0; + left: 0; + bottom: 0; } .markdown h1, @@ -24,13 +24,13 @@ .markdown h4, .markdown h5, .markdown h6 { - margin: 20px 0 10px; - padding: 0; - padding-bottom: 8px; - font-weight: bold; - -webkit-font-smoothing: antialiased; - cursor: text; - position: relative; + margin: 20px 0 10px; + padding: 0; + padding-bottom: 8px; + font-weight: bold; + -webkit-font-smoothing: antialiased; + cursor: text; + position: relative; } .markdown h1:hover a.anchor, @@ -39,75 +39,75 @@ .markdown h4:hover a.anchor, .markdown h5:hover a.anchor, .markdown h6:hover a.anchor { - background: url("../images/para.png") no-repeat - 10px center; - text-decoration: none; + background: url("../images/para.png") no-repeat + 10px center; + text-decoration: none; } .markdown h1 tt, .markdown h1 code { - font-size: inherit; + font-size: inherit; } .markdown h2 tt, .markdown h2 code { - font-size: inherit; + font-size: inherit; } .markdown h3 tt, .markdown h3 code { - font-size: inherit; + font-size: inherit; } .markdown h4 tt, .markdown h4 code { - font-size: inherit; + font-size: inherit; } .markdown h5 tt, .markdown h5 code { - font-size: inherit; + font-size: inherit; } .markdown h6 tt, .markdown h6 code { - font-size: inherit; + font-size: inherit; } .markdown h1 { - font-size: 28px; - color: black; + font-size: 28px; + color: black; } .markdown h2 { - font-size: 24px; - margin-top: 40px; - border-bottom: 1px solid #dddddd; - color: black; + font-size: 24px; + margin-top: 40px; + border-bottom: 1px solid #dddddd; + color: black; } .markdown h3 { - font-size: 18px; + font-size: 18px; } .markdown h4 { - font-size: 16px; + font-size: 16px; } .markdown h5 { - font-size: 14px; + font-size: 14px; } .markdown h6 { - color: #777777; - font-size: 14px; + color: #777777; + font-size: 14px; } .markdown p, .markdown blockquote, .markdown dl, .markdown table{ - margin: 15px 0; + margin: 15px 0; } .markdown ul, @@ -119,40 +119,40 @@ .markdown li, .markdown dt, .markdown table{ - line-height: 2.0em; + line-height: 2.0em; } .markdown hr { - background: transparent - url("../images/dirty-shade.png") repeat-x 0 0; - border: 0 none; - color: #cccccc; - height: 4px; - padding: 0; + background: transparent + url("../images/dirty-shade.png") repeat-x 0 0; + border: 0 none; + color: #cccccc; + height: 4px; + padding: 0; } .markdown >h2:first-child { - margin-top: 0; - padding-top: 0; + margin-top: 0; + padding-top: 0; } .markdown >h1:first-child { - margin-top: 0; - padding-top: 0; + margin-top: 0; + padding-top: 0; } .markdown >h1:first-child+h2 { - margin-top: 0; - padding-top: 0; + margin-top: 0; + padding-top: 0; } .markdown >h3:first-child, .markdown >h4:first-child, .markdown >h5:first-child, .markdown >h6:first-child - { - margin-top: 0; - padding-top: 0; + { + margin-top: 0; + padding-top: 0; } .markdown a:first-child h1, @@ -161,8 +161,8 @@ .markdown a:first-child h4, .markdown a:first-child h5, .markdown a:first-child h6 { - margin-top: 0; - padding-top: 0; + margin-top: 0; + padding-top: 0; } .markdown h1 p, @@ -171,253 +171,258 @@ .markdown h4 p, .markdown h5 p, .markdown h6 p { - margin-top: 0; + margin-top: 0; } .markdown li p.first { - display: inline-block; + display: inline-block; } .markdown ul, .markdown ol { - padding-left: 30px; + padding-left: 30px; } .markdown ul :first-child, .markdown ol :first-child { - margin-top: 0; + margin-top: 0; } .markdown ul :last-child, .markdown ol :last-child { - margin-bottom: 0; + margin-bottom: 0; } .markdown dl { - padding: 0; + padding: 0; } .markdown dl dt { - font-size: 14px; - font-weight: bold; - font-style: italic; - padding: 0; - margin: 15px 0 5px; + font-size: 14px; + font-weight: bold; + font-style: italic; + padding: 0; + margin: 15px 0 5px; } .markdown dl dt:first-child { - padding: 0; + padding: 0; } .markdown dl dt>:first-child { - margin-top: 0; + margin-top: 0; } .markdown dl dt>:last-child { - margin-bottom: 0; + margin-bottom: 0; } .markdown dl dd { - margin: 0 0 15px; - padding: 0 15px; + margin: 0 0 15px; + padding: 0 15px; } .markdown dl dd>:first-child { - margin-top: 0; + margin-top: 0; } .markdown dl dd>:last-child { - margin-bottom: 0; + margin-bottom: 0; } .markdown blockquote { - border-left: 4px solid #dddddd; - padding: 0 15px; - color: #777777; - font-size: 15px; + border-left: 4px solid #dddddd; + padding: 0 15px; + color: #777777; + font-size: 15px; } .markdown blockquote>:first-child { - margin-top: 0; + margin-top: 0; } .markdown blockquote>:last-child { - margin-bottom: 0; + margin-bottom: 0; } .markdown table { - padding: 0; + padding: 0; } .markdown table tr { - border-top: 1px solid #cccccc; - background-color: white; - margin: 0; - padding: 0; + border-top: 1px solid #cccccc; + background-color: white; + margin: 0; + padding: 0; } .markdown table tr:nth-child(2n) { - background-color: #f8f8f8; + background-color: #f8f8f8; } .markdown table tr th { - font-weight: bold; - border: 1px solid #cccccc; - text-align: left; - margin: 0; - padding: 6px 13px; + font-weight: bold; + border: 1px solid #cccccc; + text-align: left; + margin: 0; + padding: 6px 13px; } .markdown table tr td { - border: 1px solid #cccccc; - text-align: left; - margin: 0; - padding: 6px 13px; + border: 1px solid #cccccc; + text-align: left; + margin: 0; + padding: 6px 13px; } .markdown table tr th :first-child, .markdown table tr td :first-child { - margin-top: 0; + margin-top: 0; } .markdown table tr th :last-child, .markdown table tr td :last-child { - margin-bottom: 0; + margin-bottom: 0; } .markdown img { - max-width: 100%; + max-width: 100%; } .markdown span.frame { - display: block; - overflow: hidden; + display: block; + overflow: hidden; } .markdown span.frame>span { - border: 1px solid #dddddd; - display: block; - float: left; - overflow: hidden; - margin: 13px 0 0; - padding: 7px; - width: auto; + border: 1px solid #dddddd; + display: block; + float: left; + overflow: hidden; + margin: 13px 0 0; + padding: 7px; + width: auto; } .markdown span.frame span img { - display: block; - float: left; + display: block; + float: left; } .markdown span.frame span span { - clear: both; - color: #333333; - display: block; - padding: 5px 0 0; + clear: both; + color: #333333; + display: block; + padding: 5px 0 0; } .markdown span.align-center { - display: block; - overflow: hidden; - clear: both; + display: block; + overflow: hidden; + clear: both; } .markdown span.align-center>span { - display: block; - overflow: hidden; - margin: 13px auto 0; - text-align: center; + display: block; + overflow: hidden; + margin: 13px auto 0; + text-align: center; } .markdown span.align-center span img { - margin: 0 auto; - text-align: center; + margin: 0 auto; + text-align: center; } .markdown span.align-right { - display: block; - overflow: hidden; - clear: both; + display: block; + overflow: hidden; + clear: both; } .markdown span.align-right>span { - display: block; - overflow: hidden; - margin: 13px 0 0; - text-align: right; + display: block; + overflow: hidden; + margin: 13px 0 0; + text-align: right; } .markdown span.align-right span img { - margin: 0; - text-align: right; + margin: 0; + text-align: right; } .markdown span.float-left { - display: block; - margin-right: 13px; - overflow: hidden; - float: left; + display: block; + margin-right: 13px; + overflow: hidden; + float: left; } .markdown span.float-left span { - margin: 13px 0 0; + margin: 13px 0 0; } .markdown span.float-right { - display: block; - margin-left: 13px; - overflow: hidden; - float: right; + display: block; + margin-left: 13px; + overflow: hidden; + float: right; } .markdown span.float-right>span { - display: block; - overflow: hidden; - margin: 13px auto 0; - text-align: right; + display: block; + overflow: hidden; + margin: 13px auto 0; + text-align: right; } .markdown code, .markdown tt { - margin: 0 2px; - padding: 0 5px; - border-radius: 3px; - word-wrap: break-word; + margin: 0 2px; + padding: 0 5px; + border-radius: 3px; + word-wrap: break-word; } .markdown pre code { - margin: 0; - padding: 10px; - white-space: pre; - border: none; + margin: 0; + padding: 10px; + white-space: pre; + border: none; } .markdown .highlight pre { - font-size: 13px; - line-height: 19px; - overflow: auto; - padding: 6px 10px; - border-radius: 3px; + font-size: 13px; + line-height: 19px; + overflow: auto; + padding: 6px 10px; + border-radius: 3px; } .markdown pre { - background-color: transparent; - border: none; - font-size: 13px; - line-height: 19px; - overflow: auto; - padding: 6px 10px; - border-radius: 3px; + background-color: transparent; + border: none; + font-size: 13px; + line-height: 19px; + overflow: auto; + padding: 6px 10px; + border-radius: 3px; } .markdown pre code, .markdown pre tt { - border: none; + border: none; } .markdown p > code.hljs { display: inline; } .emoji-img { - height: 20px; + height: 20px; +} + +.lang-math { + margin: 10px 10px 10px 10px; + border-radius: 5px; } diff --git a/src/main/webapp/js/knowledge-common.js b/src/main/webapp/js/knowledge-common.js index 867defd7c..3a23ece43 100644 --- a/src/main/webapp/js/knowledge-common.js +++ b/src/main/webapp/js/knowledge-common.js @@ -4,7 +4,7 @@ var emoji = window.emojiParser; var codeHighlight = function(block) { var highlightPromises = []; - block.find('pre code').each(function(i, block) { + block.find('pre code').not('.lang-math').each(function(i, block) { var jqobj = $(this); highlightPromises.push(new Promise(function(resolve, reject) { try { @@ -23,7 +23,7 @@ var codeHighlight = function(block) { } })); }); - block.find('p code').each(function(i, block) { + block.find('p code').not('.lang-math').each(function(i, block) { var jqobj = $(this); highlightPromises.push(new Promise(function(resolve, reject) { try { diff --git a/src/main/webapp/js/knowledge-preview.js b/src/main/webapp/js/knowledge-preview.js index c935e778f..a65c9205a 100644 --- a/src/main/webapp/js/knowledge-preview.js +++ b/src/main/webapp/js/knowledge-preview.js @@ -24,6 +24,14 @@ var preview = function() { jqObj.find('a.oembed').oembed(); // call slide.js showSlide('#preview'); + // call MathJax + MathJax.Hub.Queue(function() { + $('#preview').find('.lang-math').each(function(i, block) { + var jqobj = $(this); + jqobj.addClass('hljs'); + MathJax.Hub.Typeset(jqobj[0]); + }); + }); }); }); }; diff --git a/src/main/webapp/js/knowledge-view-markdown.js b/src/main/webapp/js/knowledge-view-markdown.js index 49af5b543..82e2fceb5 100644 --- a/src/main/webapp/js/knowledge-view-markdown.js +++ b/src/main/webapp/js/knowledge-view-markdown.js @@ -11,6 +11,14 @@ $(document).ready(function() { jqObj.find('a.oembed').oembed(); // call slide.js showSlide('#content'); + // call MathJax + MathJax.Hub.Queue(function() { + $('#content').find('.lang-math').each(function(i, block) { + var jqobj = $(this); + jqobj.addClass('hljs'); + MathJax.Hub.Typeset(jqobj[0]); + }); + }); }); $('.arrow_question').each(function(i, block) { @@ -25,6 +33,14 @@ $(document).ready(function() { jqObj.find('a.oembed').oembed(); // call slide.js showSlide('.arrow_question'); + // call MathJax + MathJax.Hub.Queue(function() { + $('.arrow_question').find('.lang-math').each(function(i, block) { + var jqobj = $(this); + jqobj.addClass('hljs'); + MathJax.Hub.Typeset(jqobj[0]); + }); + }); }); }); $('.arrow_answer').each(function(i, block) { @@ -40,6 +56,14 @@ $(document).ready(function() { jqObj.find('a.oembed').oembed(); // call slide.js showSlide('.arrow_answer'); + // call MathJax + MathJax.Hub.Queue(function() { + $('.arrow_answer').find('.lang-math').each(function(i, block) { + var jqobj = $(this); + jqobj.addClass('hljs'); + MathJax.Hub.Typeset(jqobj[0]); + }); + }); }); }); }); diff --git a/src/main/webapp/js/knowledge-view-preview.js b/src/main/webapp/js/knowledge-view-preview.js index 918fe11e8..4513f3c91 100644 --- a/src/main/webapp/js/knowledge-view-preview.js +++ b/src/main/webapp/js/knowledge-view-preview.js @@ -37,6 +37,14 @@ var preview = function() { jqObj.find('a.oembed').oembed(); // call slide.js showSlide('#preview'); + // call MathJax + MathJax.Hub.Queue(function() { + $('#preview').find('.lang-math').each(function(i, block) { + var jqobj = $(this); + jqobj.addClass('hljs'); + MathJax.Hub.Typeset(jqobj[0]); + }); + }); }); }); }; @@ -72,6 +80,14 @@ var previewans = function() { jqObj.find('a.oembed').oembed(); // call slide.js showSlide('#preview'); + // call MathJax + MathJax.Hub.Queue(function() { + $('#preview').find('.lang-math').each(function(i, block) { + var jqobj = $(this); + jqobj.addClass('hljs'); + MathJax.Hub.Typeset(jqobj[0]); + }); + }); }); }); };