Commit b7876d2d authored by Vanesssa's avatar Vanesssa

#12146

parent 52d94a8f
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<!-- <!--
Description: Static resources definition. Description: Static resources definition.
Version: 2.6.5.6, Jan 8, 2016 Version: 2.7.5.6, Aug 26, 2016
Author: Liang Ding Author: Liang Ding
--> -->
<static-files> <static-files>
...@@ -65,6 +65,10 @@ ...@@ -65,6 +65,10 @@
<include path="/css/**.css" /> <include path="/css/**.css" />
<include path="/css/**/*.css" /> <include path="/css/**/*.css" />
<include path="/css/fonts/*.eot" />
<include path="/css/fonts/*.svg" />
<include path="/css/fonts/*.ttf" />
<include path="/css/fonts/*.woff" />
<include path="/images/**.png" /> <include path="/images/**.png" />
<include path="/images/**/*.png" /> <include path="/images/**/*.png" />
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<title>${blogTitle} - ${adminConsoleLabel}</title> <title>${blogTitle} - ${adminConsoleLabel}</title>
<link type="text/css" rel="stylesheet" href="${staticServePath}/css/default-base${miniPostfix}.css?${staticResourceVersion}" /> <link type="text/css" rel="stylesheet" href="${staticServePath}/css/default-base${miniPostfix}.css?${staticResourceVersion}" />
<link type="text/css" rel="stylesheet" href="${staticServePath}/css/default-admin${miniPostfix}.css?${staticResourceVersion}" /> <link type="text/css" rel="stylesheet" href="${staticServePath}/css/default-admin${miniPostfix}.css?${staticResourceVersion}" />
<link type="text/css" rel="stylesheet" href="${staticServePath}/js/lib/CodeMirror/codemirror.css?${staticResourceVersion}" /> <link type="text/css" rel="stylesheet" href="${staticServePath}/js/lib/CodeMirrorEditor/codemirror.min.css?${staticResourceVersion}" />
<link rel="icon" type="image/png" href="${staticServePath}/favicon.png" /> <link rel="icon" type="image/png" href="${staticServePath}/favicon.png" />
</head> </head>
<body onhashchange="admin.setCurByHash();"> <body onhashchange="admin.setCurByHash();">
...@@ -134,9 +134,9 @@ ...@@ -134,9 +134,9 @@
<script src="${staticServePath}/js/lib/jquery/file-upload-9.10.1/jquery.iframe-transport.js"></script> <script src="${staticServePath}/js/lib/jquery/file-upload-9.10.1/jquery.iframe-transport.js"></script>
<script src="${staticServePath}/js/lib/jquery/file-upload-9.10.1/jquery.fileupload.js"></script> <script src="${staticServePath}/js/lib/jquery/file-upload-9.10.1/jquery.fileupload.js"></script>
<script src="${staticServePath}/js/lib/jquery/jquery.bowknot.min.js?${staticResourceVersion}"></script> <script src="${staticServePath}/js/lib/jquery/jquery.bowknot.min.js?${staticResourceVersion}"></script>
<script src="${servePath}/js/lib/tiny_mce/tiny_mce.js"></script> <script src="${staticServePath}/js/lib/tiny_mce/tiny_mce.js"></script>
<script src="${staticServePath}/js/lib/KindEditor/kindeditor-min.js"></script> <script src="${staticServePath}/js/lib/KindEditor/kindeditor-min.js"></script>
<script src="${staticServePath}/js/lib/CodeMirror/codemirror.js"></script> <script src="${staticServePath}/js/lib/CodeMirrorEditor/codemirror.min.js"></script>
<script src="${staticServePath}/js/common${miniPostfix}.js"></script> <script src="${staticServePath}/js/common${miniPostfix}.js"></script>
<#if "" == miniPostfix> <#if "" == miniPostfix>
<script src="${staticServePath}/js/admin/admin.js"></script> <script src="${staticServePath}/js/admin/admin.js"></script>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* admin style * admin style
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 2.0.5.1, Aug 23, 2016 * @version 2.0.5.2, Aug 26, 2016
*/ */
/* start resset */ /* start resset */
...@@ -50,9 +50,227 @@ button.selected { ...@@ -50,9 +50,227 @@ button.selected {
color: #D54121 !important; color: #D54121 !important;
border-color: #b0b5b9 !important; border-color: #b0b5b9 !important;
} }
@font-face {
font-family: 'icomoon';
src:url('fonts/icomoon.eot?1450');
src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?1450') format('truetype'),
url('fonts/icomoon.woff?1450') format('woff'),
url('fonts/icomoon.svg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
/* end reset */ /* end reset */
/* start ico */ /* start ico */
[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a[class^="icon-"],
a[class*=" icon-"] {
color: #333;
}
a[class^="icon-"]:hover,
a[class*=" icon-"]:hover {
text-decoration: none;
color: #4183c4;
}
.icon-upload:before {
content: "\f0ee";
}
.icon-copy:before {
content: "\e908";
}
.icon-time:before {
content: "\e906";
}
.icon-sortasc:before {
content: "\e905";
}
.icon-locked:before {
content: "\e61e";
}
.icon-close:before {
content: "\e909";
}
.icon-points:before {
content: "\e900";
}
.icon-goods:before {
content: "\e904";
}
.icon-bold:before {
content: "\e000";
}
.icon-italic:before {
content: "\e001";
}
.icon-quote:before {
content: "\e003";
}
.icon-unordered-list:before {
content: "\e004";
}
.icon-ordered-list:before {
content: "\e005";
}
.icon-link:before {
content: "\e006";
}
.icon-image:before {
content: "\e007";
}
.icon-play:before {
content: "\e008";
}
.icon-music:before {
content: "\e009";
}
.icon-contract:before {
content: "\e00a";
}
.icon-fullscreen:before {
content: "\e00b";
}
.icon-question:before {
content: "\e00c";
}
.icon-info:before {
content: "\e00d";
}
.icon-undo:before {
content: "\e00e";
}
.icon-redo:before {
content: "\e00f";
}
.icon-code:before {
content: "\e011";
}
.icon-preview:before {
content: "\e002";
}
.icon-navigation:before {
content: "\e903";
}
.icon-thumbs-down:before {
content: "\e901";
}
.icon-thumbs-up:before {
content: "\e902";
}
.icon-video:before {
content: "\f057";
}
.icon-feed:before {
content: "\e61f";
}
.icon-article:before {
content: "\e61d";
}
.icon-star:before {
content: "\e600";
}
.icon-register:before {
content: "\e602";
}
.icon-logout:before {
content: "\e603";
}
.icon-setting:before {
content: "\e604";
}
.icon-google:before {
content: "\e605";
}
.icon-search:before {
content: "\e606";
}
.icon-weibo:before {
content: "\e607";
}
.icon-date:before {
content: "\e608";
}
.icon-view:before {
content: "\e609";
}
.icon-cmts:before {
content: "\e60a";
}
.icon-refresh:before {
content: "\e60b";
}
.icon-up:before {
content: "\e60c";
}
.icon-twitter:before {
content: "\e60d";
}
.icon-edit:before {
content: "\e60e";
}
.icon-tencent:before {
content: "\e60f";
}
.icon-tag:before {
content: "\e610";
}
.icon-tags:before {
content: "\e611";
}
.icon-addfile:before {
content: "\e612";
}
.icon-login:before {
content: "\e613";
}
.icon-articles:before {
content: "\e614";
}
.icon-userrole:before {
content: "\e615";
}
.icon-email:before {
content: "\e616";
}
.icon-flag:before {
content: "\e617";
}
.icon-chevron-down:before {
content: "\e618";
}
.icon-chevron-up:before {
content: "\e619";
}
.icon-reply:before {
content: "\e61a";
}
.icon-clock:before {
content: "\e61b";
}
.icon-compass:before {
content: "\e61c";
}
.icon-heart:before {
content: "\e9da";
}
.icon-wechat:before {
content: "\e907";
}
.ico-arrow-down, .ico-arrow-up { .ico-arrow-down, .ico-arrow-up {
background: url("../images/arrows.png") repeat scroll 0 4px transparent; background: url("../images/arrows.png") repeat scroll 0 4px transparent;
float: right; float: right;
...@@ -388,53 +606,6 @@ button.selected { ...@@ -388,53 +606,6 @@ button.selected {
/* end comments */ /* end comments */
/* start article */ /* start article */
.markdown-preivew {
background-color: #fff;
background-image: linear-gradient(#FFFFFF,#F3F3F3);
background-image: -ms-linear-gradient(#FFFFFF,#F3F3F3);
background-image: -o-linear-gradient(#FFFFFF,#F3F3F3);
background-image: -webkit-linear-gradient(#FFFFFF,#F3F3F3);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#FFFFFF', endColorstr='#F3F3F3');
border-color: #C0C0C0 #D9D9D9 #D9D9D9;
border-style: solid;
border-width: 1px;
float: left;
height: 500px;
margin-left: 20px;
overflow: auto;
width: 47%;
word-wrap: break-word;
}
.markdown-help.ico-help, .markdown-help.ico-close {
background-image: url("../images/icon.png");
background-position: -16px -47px;
cursor: pointer;
float: right;
height: 17px;
width: 17px;
}
.markdown-help.ico-close {
height: 16px;
background-position: -48px -16px;
}
.markdown-help-main, .markdown-preview-main {
color: #21759B;
padding: 0 12px
}
.markdown-help-main dt {
font-size: 14px;
font-weight: bold;
margin: 12px 0 6px 0;
}
.markdown-help-main dd {
margin-left: 12px;
}
button#submitArticle, button#submitArticle,
#unSubmitArticle { #unSubmitArticle {
background-color: #fa8564; background-color: #fa8564;
......
This diff is collapsed.
This diff is collapsed.
...@@ -32,124 +32,40 @@ admin.editors.CodeMirror = { ...@@ -32,124 +32,40 @@ admin.editors.CodeMirror = {
* @returns {obj} editor * @returns {obj} editor
*/ */
init: function (conf) { init: function (conf) {
var it = this;
// load preview and clear
var previewHTML = "<div class='clear'></div>";
if (conf.kind !== "simple") {
previewHTML = "<div class='markdown-preivew'>" +
"<div class='markdown-help ico-close'></div>" +
"<div class='clear'></div>" +
"<div class='markdown-preview-main none'></div>" +
"<div class='markdown-help-main'>" + Label.markdownHelpLabel + "</div>"
+ "</div><div class='clear'></div>";
}
$("#" + conf.id).after(previewHTML);
// init codemirror // init codemirror
if (conf.kind === "simple") { var commentEditor = new CodeMirrorEditor({
this[conf.id] = CodeMirror.fromTextArea(document.getElementById(conf.id), { element: document.getElementById(conf.id),
mode: 'markdown', dragDrop: false,
lineWrapping: true, lineWrapping: true,
lineNumbers: true, toolbar: [
matchBrackets: true, {name: 'bold'},
theme: "default", {name: 'italic'},
height: conf.height '|',
}); {name: 'quote'},
} else { {name: 'unordered-list'},
// preview 执行队列 {name: 'ordered-list'},
it[conf.id + "Timers"] = []; '|',
{name: 'link'},
// 该编辑器是否第一次触发 preivew 事件 {name: 'image', html: '<form id="fileUpload" method="POST" enctype="multipart/form-data"><label class="icon-upload"><input type="file"/></label></form>'},
it[conf.id + "IsFirst"] = true; '|',
{name: 'redo'},
var $preview = $("#" + conf.id).parent().find(".markdown-preivew"), {name: 'undo'},
$help = $("#" + conf.id).parent().find(".markdown-preivew").find(".markdown-help"); '|',
this[conf.id] = CodeMirror.fromTextArea(document.getElementById(conf.id), { {name: 'preview'}
mode: 'markdown', ],
lineWrapping: true, extraKeys: {
lineNumbers: true, "Ctrl-/": "autocompleteEmoji"
matchBrackets: true, },
theme: "default", status: false
height: conf.height, });
onUpdate: function () { commentEditor.render();
var update = function () { this[conf.id] = commentEditor.codemirror;
if (it[conf.id].getValue() === "") {
return;
}
$.ajax({
url: latkeConfig.servePath + "/console/markdown/2html",
type: "POST",
cache: false,
data: JSON.stringify({markdownText: it[conf.id].getValue()}),
success: function (data, textStatus) {
if (data.sc) {
if (it[conf.id + "IsFirst"] && $help.hasClass("ico-close")) {
$help.click();
}
it[conf.id + "IsFirst"] = false;
$preview.find(".markdown-preview-main").html(data.html);
} else {
$preview.find(".markdown-preview-main").html(data.msg);
}
}
});
}
it[conf.id + "Timers"].push(update);
}
});
this._callPreview(conf.id, it[conf.id + "Timers"]);
}
if (conf.kind === "simple") {
// 摘要不需要 preview,设置其宽度
$("#" + conf.id).next().width("99%");
} else {
// 有 preview 时,绑定 preview 事件
this._bindEvent(conf.id);
}
// after render, call back function // after render, call back function
if (typeof (conf.fun) === "function") { if (typeof (conf.fun) === "function") {
conf.fun(); conf.fun();
} }
}, },
/*
* @description 当有更新时每隔3秒 preview
* @param {string} id 编辑器 id
*/
_callPreview: function (id) {
setInterval(function () {
var timers = admin.editors.CodeMirror[id + "Timers"];
$(document).queue("myAnimation", [timers[timers.length - 1]]);
$(document).dequeue("myAnimation");
admin.editors.CodeMirror[id + "Timers"] = [];
}, 2000);
},
/*
* @description 绑定编辑器 preview 事件
* @param {string} id 编辑器id
*/
_bindEvent: function (id) {
var $preview = $("#" + id).parent().find(".markdown-preivew");
$preview.find(".markdown-help").click(function () {
var $it = $(this);
if ($it.hasClass("ico-help")) {
$it.removeClass("ico-help").addClass("ico-close");
$preview.find(".markdown-preview-main").hide();
$preview.find(".markdown-help-main").show();
} else {
$it.addClass("ico-help").removeClass("ico-close");
$preview.find(".markdown-preview-main").show();
$preview.find(".markdown-help-main").hide();
}
});
},
/* /*
* @description 获取编辑器值 * @description 获取编辑器值
* @param {string} id 编辑器id * @param {string} id 编辑器id
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
if (old == CodeMirror.Init) old = false;
if (!old == !val) return;
if (val) setFullscreen(cm);
else setNormal(cm);
});
function setFullscreen(cm) {
var wrap = cm.getWrapperElement();
cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
width: wrap.style.width, height: wrap.style.height};
wrap.style.width = "";
wrap.style.height = "auto";
wrap.className += " CodeMirror-fullscreen";
document.documentElement.style.overflow = "hidden";
cm.refresh();
}
function setNormal(cm) {
var wrap = cm.getWrapperElement();
wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
document.documentElement.style.overflow = "";
var info = cm.state.fullScreenRestore;
wrap.style.width = info.width; wrap.style.height = info.height;
window.scrollTo(info.scrollLeft, info.scrollTop);
cm.refresh();
}
});
This diff is collapsed.
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
var prev = old && old != CodeMirror.Init;
if (val && !prev) {
cm.on("blur", onBlur);
cm.on("change", onChange);
onChange(cm);
} else if (!val && prev) {
cm.off("blur", onBlur);
cm.off("change", onChange);
clearPlaceholder(cm);
var wrapper = cm.getWrapperElement();
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
}
if (val && !cm.hasFocus()) onBlur(cm);
});
function clearPlaceholder(cm) {
if (cm.state.placeholder) {
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
cm.state.placeholder = null;
}
}
function setPlaceholder(cm) {
clearPlaceholder(cm);
var elt = cm.state.placeholder = document.createElement("pre");
elt.style.cssText = "height: 0; overflow: visible";
elt.className = "CodeMirror-placeholder";
var placeHolder = cm.getOption("placeholder")
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
elt.appendChild(placeHolder)
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
}
function onBlur(cm) {
if (isEmpty(cm)) setPlaceholder(cm);
}
function onChange(cm) {
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
if (empty) setPlaceholder(cm);
else clearPlaceholder(cm);
}
function isEmpty(cm) {
return (cm.lineCount() === 1) && (cm.getLine(0) === "");
}
});
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
&nbsp; | &nbsp;${viewsLabel} ${article.articleViewCount}°C &nbsp; | &nbsp;${viewsLabel} ${article.articleViewCount}°C
</div> </div>
</header> </header>
${article.articleAbstract} <div class="article-body">
${article.articleAbstract}
</div>
<div class="post-more-link"> <div class="post-more-link">
<a href="${servePath}${article.articlePermalink}#more" rel="contents"> <a href="${servePath}${article.articlePermalink}#more" rel="contents">
${readLabel} &raquo; ${readLabel} &raquo;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* skin next style * skin next style
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.1.1.1, Aug 23, 2016 * @version 0.1.2.1, Aug 26, 2016
*/ */
/* start reset */ /* start reset */
html { html {
...@@ -711,6 +711,10 @@ img { ...@@ -711,6 +711,10 @@ img {
#externalRelevantArticles ul { #externalRelevantArticles ul {
margin-top: 5px; margin-top: 5px;
} }
.article-body {
overflow: auto;
}
/* end article */ /* end article */
/* start comments */ /* start comments */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment