From 0d38fa53a20fc030adbb66026e69184a49720f70 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 2 Jun 2016 13:55:40 +0800 Subject: [PATCH] =?UTF-8?q?1.issue=E7=BC=96=E8=BE=91=E5=99=A8=E5=AE=9A?= =?UTF-8?q?=E4=B8=8B=E6=9C=80=E9=AB=98=E9=AB=98=E5=BA=A6=E5=88=B0=E4=BA=86?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=BB=9A=E5=8A=A8=E6=9D=A1=202.=E6=8F=90?= =?UTF-8?q?=E9=97=AE=E5=92=8C=E5=BB=BA=E8=AE=AE=E4=BF=AE=E6=94=B9=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=AD=203.KE=E6=8F=92=E5=85=A5=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A1=86=E5=8E=BB=E6=8E=89=E6=88=91=E8=A6=81=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=AD=97=E6=A0=B7=204.=E8=87=AA=E5=8A=A8=E8=AF=86=E5=88=ABURL?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=AF=E8=AF=86=E5=88=AB=EF=BC=9F=20?= =?UTF-8?q?=E5=92=8Ccn=E7=AD=89=205.KE=E7=BC=A9=E8=BF=9B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/commons/zh.yml | 2 +- public/assets/kindeditor/kindeditor.js | 63 ++++++++++++++++--- .../plugins/autoheight/autoheight.js | 12 +++- public/assets/kindeditor/plugins/code/code.js | 3 + .../kindeditor/plugins/code/previewcode.css | 2 +- public/javascripts/application.js | 4 +- public/stylesheets/courses.css | 4 ++ public/stylesheets/new_user.css | 3 + public/stylesheets/project.css | 3 + public/stylesheets/public.css | 2 + 10 files changed, 83 insertions(+), 15 deletions(-) diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index d65606678..70236d9ba 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -358,7 +358,7 @@ zh: # 意见反馈 # label_feedback: 意见反馈 - label_feedback_tips: "请在此提问平台问题,或直接加入师姐答疑群,谢谢!" + label_feedback_tips: "请在此发布平台问题和建议,或直接加入答疑群,谢谢!" label_technical_support: "QQ 在线支持:" label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!" label_feedback_value: "该帖来自用户反馈:)" diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 6b0f1621b..5503af1fe 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -83,7 +83,8 @@ function _inString(val, str, delimiter) { } function _addUnit(val, unit) { unit = unit || 'px'; - return val && /^\d+$/.test(val) ? val + unit : val; + //return val && /^\d+$/.test(val) ? val + unit : val; + return val && /^-?\d+(?:\.\d+)?$/.test(val) ? val + unit : val; } function _removeUnit(val) { var match; @@ -304,7 +305,7 @@ K.options = { img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'], 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [ 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background', - '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left' + '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left', '.margin', '.border', '.padding' ], pre : ['id', 'class'], hr : ['id', 'class', '.page-break-after'], @@ -597,7 +598,7 @@ function _ready(fn) { } _bind(window, 'load', readyFunc); } -if (_IE) { +if (window.attachEvent) { window.attachEvent('onunload', function() { _each(_eventData, function(key, events) { if (events.el) { @@ -2531,6 +2532,7 @@ K.START_TO_START = _START_TO_START; K.START_TO_END = _START_TO_END; K.END_TO_END = _END_TO_END; K.END_TO_START = _END_TO_START; + function _nativeCommand(doc, key, val) { try { doc.execCommand(key, false, val); @@ -3361,6 +3363,10 @@ function _drag(options) { }); } clickEl.mousedown(function(e) { + //新加的 + if(e.button !== 0 && e.button !== 1) { + return; + } e.stopPropagation(); var self = clickEl.get(), x = _removeUnit(moveEl.css('left')), @@ -3681,13 +3687,20 @@ _extend(KEdit, KWidget, { if (isDocumentDomain) { doc.domain = document.domain; } + doc.write(_getInitHtml(themesPath, bodyClass, cssPath, cssData)); doc.close(); self.win = self.iframe[0].contentWindow; self.doc = doc; var cmd = _cmd(doc); self.afterChange(function(e) { - cmd.selection(); +// if (e.which == 8) { +// var range = cmd.range +// var bookmark = range.createBookmark(); +// cmd.doc.body.innerHTML = cmd.doc.body.innerHTML.replace(/

\s*<\/p>/g,""); +// range.moveToBookmark(bookmark); +// } + cmd.selection(); }); if (_WEBKIT) { K(doc).click(function(e) { @@ -3824,9 +3837,20 @@ _extend(KEdit, KWidget, { if (!self.designMode) { val = self.html(); self.designMode = true; - self.html(val); + + //self.html(val); + //self.textarea.hide(); + //self.iframe.show(); + //新加 self.textarea.hide(); - self.iframe.show(); + self.html(val); + var iframe = self.iframe; + var height = _removeUnit(self.height); + iframe.height(height - 2); + iframe.show(); + setTimeout(function() { + iframe.height(height); + }, 0); } } else { if (self.designMode) { @@ -3958,7 +3982,7 @@ _extend(KToolbar, KWidget, { }else if(!$("#full",container).is(':hidden')){ pdiv = $("#full",container); } - return (this._itemMap[name] = K('span.ke-icon-' + name, pdiv).parent()); + return (this._itemMap[name] = K('span.ke-icon-' + name, this.div).parent()); }, select : function(name) { _selectToolbar.call(this, name, function(knode) { @@ -4864,6 +4888,11 @@ KEditor.prototype = { }, loadPlugin : function(name, fn) { var self = this; + //新加 + var _pluginStatus = this._pluginStatus; + if (!_pluginStatus) { + _pluginStatus = this._pluginStatus = {}; + } if (_plugins[name]) { if (!_isFunction(_plugins[name])) { setTimeout(function() { @@ -4871,7 +4900,12 @@ KEditor.prototype = { }, 100); return self; } - _plugins[name].call(self, KindEditor); + //_plugins[name].call(self, KindEditor); + //新加 + if(!_pluginStatus[name]) { + _plugins[name].call(self, KindEditor); + _pluginStatus[name] = 'inited'; + } if (fn) { fn.call(self); } @@ -5510,6 +5544,11 @@ function _create(expr, options) { _each(_plugins, function(name, fn) { if (_isFunction(fn)) { fn.call(editor, KindEditor); + //新加 + if (!editor._pluginStatus) { + editor._pluginStatus = {}; + } + editor._pluginStatus[name] = 'inited'; } }); return editor.create(); @@ -5772,13 +5811,14 @@ _plugin('core', function(K) { click : function() { self.select().exec('formatblock', '<' + key + '>').hideMenu(); //by yk利用html的特性使h1 h2 h3 h4标签之间不能相互包含 并将空的标签去掉 - if (key != "p"){ +// if (key != "p"){ var val = self.select().html(); self.select().html(val); + self.cmd.doc.body.innerHTML = self.cmd.doc.body.innerHTML.replace(/

\s*<\/p>/g,""); val = self.select().html().replace(/(

\s*<\/h1>)|(

\s*<\/h2>)|(

\s*<\/h3>)|(

\s*<\/h4>)/g,""); self.select().html(val); self.select(); - } +// } } }); }); @@ -6059,6 +6099,9 @@ _plugin('core', function(K) { } else { cmd.range.selectNodeContents(div[0]); cmd.select(); + //新加 + div[0].tabIndex = -1; + div[0].focus(); } setTimeout(function() { movePastedData(); diff --git a/public/assets/kindeditor/plugins/autoheight/autoheight.js b/public/assets/kindeditor/plugins/autoheight/autoheight.js index cdd3f94f8..1a067e134 100644 --- a/public/assets/kindeditor/plugins/autoheight/autoheight.js +++ b/public/assets/kindeditor/plugins/autoheight/autoheight.js @@ -27,9 +27,19 @@ KindEditor.plugin('autoheight', function(K) { var edit = self.edit; var body = edit.doc.body; edit.iframe.height(minHeight); + + //最高418 超过用滚动条 self.resize(null, Math.max( - (K.IE ? body.scrollHeight : body.offsetHeight) + (K.IE ? body.scrollHeight : body.offsetHeight) > 385 ? 385+33 : (K.IE ? body.scrollHeight : body.offsetHeight) + 33, minHeight)); + + if( self.height == "418px" ){ + edit.iframe[0].scroll = 'yes'; + body.style.overflowY = 'auto'; + } + else{ + hideScroll(); + } } function init() { diff --git a/public/assets/kindeditor/plugins/code/code.js b/public/assets/kindeditor/plugins/code/code.js index 760f20bc7..3a3a982ea 100644 --- a/public/assets/kindeditor/plugins/code/code.js +++ b/public/assets/kindeditor/plugins/code/code.js @@ -42,6 +42,9 @@ KindEditor.plugin('code', function(K) { yesBtn : { name : self.lang('yes'), click : function(e) { + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(self.edit.html())){ + self.edit.html(''); + } var type = K('.ke-code-type', dialog.div).val(), code = textarea.val(), cls = type === '' ? '' : ' lang-' + type, diff --git a/public/assets/kindeditor/plugins/code/previewcode.css b/public/assets/kindeditor/plugins/code/previewcode.css index cf9c219e9..8c0f07af4 100644 --- a/public/assets/kindeditor/plugins/code/previewcode.css +++ b/public/assets/kindeditor/plugins/code/previewcode.css @@ -46,7 +46,7 @@ .ke-content div.ref .ref_body {margin:0;padding:2px;line-height:20px;color:#666;font-size:9pt;} -.ke-content blockquote {margin:15px 10px;border:2px solid #eee;padding:5px 5px 5px 35px;background:#f4f5f7 url('../img/blockquote.gif') no-repeat left top;color:#060;font-size:9pt;} +.ke-content blockquote {margin:15px 10px;border:2px solid #eee;padding:5px 5px 5px 35px;} span.at {color:#269ac9;} span.at a{color:#269ac9;text-decoration: none;} diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 303fc3ac9..633ade4aa 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1353,7 +1353,7 @@ function autoUrl(id){ $("#"+id+" p,#"+ id +" span,#"+id+" em,#"+id+" h1,#"+id+" h2,#"+id+" h3,#"+id+" h4,#"+id+" strong,#"+id+" b,#"+id+" font,#"+id+" i").each(function(){ if ($(this).children().length == 0){ var html = $(this).text(); - html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+(aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { + html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+(aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|cn)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[A-Za-z0-9_\-\.~]+)*(\?[A-Za-z0-9+_\-\.%=&]*)?(\/([A-Za-z0-9_\-\.]*)(\?[A-Za-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { //没有://的都加上http:// var reStr = full; if (full.length > 0){ @@ -1372,7 +1372,7 @@ function autoUrl(id){ } else{ var html = $("#"+id).text(); - html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+(aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { + html = html.replace(/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+(aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|cn)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[A-Za-z0-9_\-\.~]+)*(\?[A-Za-z0-9+_\-\.%=&]*)?(\/([A-Za-z0-9_\-\.]*)(\?[A-Za-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?/g,function(full) { //没有://的都加上http:// var reStr = full; if (full.length > 0){ diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 8d27be744..27f836a15 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -152,6 +152,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #15bccf;} +.homepagePostIntro blockquote{background: none;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;} .homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;} .homepagePostReply {width:710px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} @@ -194,6 +195,7 @@ a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;} .homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} .homepagePostReplyContent a{color: #15bccf;} +.homepagePostReplyContent blockquote{background: none;} .table_maxWidth table {max-width: 642px;} .homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} .homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;} @@ -301,6 +303,7 @@ a:hover.talk_btn{ background:#2a9dc1;} /****讨论区内页***/ .mt0{ margin-top:0px !important;} .talk_info{ color:#7d7d7d; margin-left:60px; margin-top:10px;} +.talk_info a{ color:#15bccf; } a.talk_edit{ color:#269ac9; margin-right:5px;} a:hover.talk_edit{ color:#297fb8;} .talk_reply { background:#eeeeee; padding:10px; margin-bottom:10px;} @@ -1141,6 +1144,7 @@ a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; paddin .postDetailDes ul li{list-style-type: disc;margin-left: 40px;} .postDetailDes td,.postDetailDes tr {border: 1px solid; border-color: inherit;} .postDetailDes a{color: #15bccf;} +.postDetailDes blockquote{background: none;} .homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; } .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 0231f6a8a..c456d3075 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -683,6 +683,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #15bccf;} +.homepagePostIntro blockquote{background: none;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} .borderBottomNone {border-bottom:none !important;} .homepagePostReplyBanner {width:718px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;} @@ -723,6 +724,7 @@ a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 40px;} .homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} .homepagePostReplyContent a{color: #15bccf;} +.homepagePostReplyContent blockquote{background: none;} .table_maxWidth table {max-width: 642px;} .homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} .homepagePostAssignTo {float:left; font-size:14px; color:#269ac9;} @@ -868,6 +870,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailDes ul li{list-style-type: disc;margin-left: 40px;} .postDetailDes td,.postDetailDes tr {border: 1px solid; border-color: inherit;} .postDetailDes a{color: #15bccf;} +.postDetailDes blockquote{background: none;} .homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; } /*line-height: 18px !important;*/ .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index f5690a12c..4247d092d 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -219,6 +219,7 @@ a:hover.talk_btn{ background:#2a9dc1;} /****讨论区内页***/ .mt0{ margin-top:0px;} .talk_info{ margin-left:60px; margin-top:10px;} +.talk_info a{ color:#15bccf; } /*.issue_desc li{list-style-type: decimal;margin-left: 20px;}*/ .issue_desc ol li{list-style-type: decimal;margin-left: 40px;} .issue_desc ul li{list-style-type: disc;margin-left: 40px;} @@ -977,6 +978,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #15bccf;} +.homepagePostIntro blockquote{background: none;} .topBorder { border-top: 1px solid #E4E4E4; } @@ -1119,6 +1121,7 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .postDetailDes ul li{list-style-type: disc;margin-left: 40px;} .postDetailDes td,.postDetailDes tr {border: 1px solid; border-color: inherit;} .postDetailDes a{color: #15bccf;} +.postDetailDes blockquote{background: none;} .homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 98fd0ec20..0ea98c79d 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -614,6 +614,7 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro ul li{list-style-type: disc;margin-left: 40px;} .homepagePostIntro td,.homepagePostIntro tr {border: 1px solid; border-color: inherit;} .homepagePostIntro a{color: #15bccf;} +.homepagePostIntro blockquote{background: none;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;} .homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;} .homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888; position: relative;} @@ -651,6 +652,7 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 40px;} .homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} .homepagePostReplyContent a{color: #15bccf;} +.homepagePostReplyContent blockquote{background: none;} .table_maxWidth table {max-width: 642px;} .homepagePostProjectState {width:42px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} .homepagePostAssignTo {float:left; font-size:14px; color:#15bccf;}