editor修改

This commit is contained in:
lizanle 2015-12-17 15:41:36 +08:00
parent 505d1b5546
commit 1809a93770
5 changed files with 15 additions and 30 deletions

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true) %>
<%= import_ke(enable_at: false) %>
<%= javascript_include_tag 'create_kindeditor'%>
<% end %>
<script>

View File

@ -13,9 +13,7 @@ issue_desc_editor = KindEditor.create('#issue_description',
"resizeType":0,
"no_label":true,
"autoHeightMode":true,
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\"),$(this.toolbar.div).hide();})",
"afterFocus":"eval(function(){$(this.toolbar.div).show();})",
"afterBlur":"eval(function(){$(this.toolbar.div).hide();})",
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\")})",
"emotionsBasePath":"http://localhost:3000","height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",

View File

@ -1,8 +1,6 @@
module RailsKindeditor
module Helper
EVAL_STR = %Q|eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin("autoheight"),$(this.toolbar.div).hide();})|
EVAL_STR_AFTER_FOCUS = %Q|eval(function(){$(this.toolbar.div).show();})|
EVAL_STR_AFTER_BLUR = %Q|eval(function(){$(this.toolbar.div).hide();})|
EVAL_STR = %Q|eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin("autoheight")})|
def kindeditor_tag(name, content = nil, options = {})
id = sanitize_to_id(name)
@ -13,8 +11,6 @@ module RailsKindeditor
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: EVAL_STR,
afterFocus:EVAL_STR_AFTER_FOCUS,
afterBlur:EVAL_STR_AFTER_BLUR,
emotionsBasePath: 'http://' + Setting.host_name
)))
end
@ -28,8 +24,6 @@ module RailsKindeditor
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: EVAL_STR,
afterFocus:EVAL_STR_AFTER_FOCUS,
afterBlur:EVAL_STR_AFTER_BLUR,
emotionsBasePath: 'http://' + Setting.host_name
)))
end

View File

@ -3932,9 +3932,7 @@ _extend(KToolbar, KWidget, {
pdiv = $("#define",container);
}else if(!$("#full",container).is(':hidden')){
pdiv = $("#full",container);
}else if($("#full",container).is(':hidden') && $("#define",container).is(':hidden')){ //都隐藏的情况下
pdiv = $("#define", container);
}
}
return (this._itemMap[name] = K('span.ke-icon-' + name, pdiv).parent());
},
select : function(name) {
@ -4731,21 +4729,15 @@ function _bindTabEvent() {
}
function _bindFocusEvent() {
var self = this;
K(self.edit.textarea[0], self.edit.win).focus(function(e) {
if(typeof self.afterFocus == 'string'){
self.afterFocus = eval(self.afterFocus);
}
if ( typeof self.afterFocus == 'function') {
self.afterFocus.call(self, e);
}
}).blur(function(e) {
if(typeof self.afterBlur == 'string'){
self.afterBlur = eval(self.afterBlur);
}
if ( typeof self.afterBlur == 'function') {
self.afterBlur.call(self, e);
}
});
K(self.edit.textarea[0], self.edit.win).focus(function(e) {
if (self.afterFocus) {
self.afterFocus.call(self, e);
}
}).blur(function(e) {
if (self.afterBlur) {
self.afterBlur.call(self, e);
}
});
}
function _removeBookmarkTag(html) {
return _trim(html.replace(/<span [^>]*id="?__kindeditor_bookmark_\w+_\d+__"?[^>]*><\/span>/ig, ''));

View File

@ -1081,4 +1081,5 @@ img.date-trigger {
.proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
a.link_file_a{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;}