From 8b6369a84f8c12d70bb9948b359ddde576fb0bc4 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 27 Apr 2015 17:01:52 +0800 Subject: [PATCH] =?UTF-8?q?kindeditor=E5=A2=9E=E5=8A=A0=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/kindeditor.js | 50 ++++++++++++++++--- public/assets/kindeditor/lang/zh_CN.js | 1 + public/assets/kindeditor/plugins/more/more.js | 15 ++++++ .../kindeditor/themes/default/default.css | 5 ++ 4 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 public/assets/kindeditor/plugins/more/more.js diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index ea6a5b1c7..1abc92ead 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -260,7 +260,7 @@ K.options = { items : [ 'emoticons', 'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|', 'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', - 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link' + 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link', 'fullscreen',"more" ], noDisableItems : ['source', 'fullscreen'], colorTable : [ @@ -3909,10 +3909,15 @@ _extend(KToolbar, KWidget, { }); }, get : function(name) { - if (this._itemMap[name]) { - return this._itemMap[name]; - } - return (this._itemMap[name] = K('span.ke-icon-' + name, this.div).parent()); +// if (this._itemMap[name]) { +// return this._itemMap[name]; +// } + if($("#define").css('display') == 'block'){ + pdiv = $("#define") + }else if($("#full").css('display') == 'block'){ + pdiv = $("#full") + } + return (this._itemMap[name] = K('span.ke-icon-' + name, pdiv).parent()); }, select : function(name) { _selectToolbar.call(this, name, function(knode) { @@ -4915,6 +4920,7 @@ KEditor.prototype = { self.srcElement.before(container); } var toolbarDiv = K('.toolbar', container), + toolBarDivFull = K('.toolbar', container), editDiv = K('.edit', container), statusbar = self.statusbar = K('.statusbar', container); container.removeClass('container') @@ -4959,9 +4965,36 @@ KEditor.prototype = { htmlList.push(''); } }); + htmlList.unshift('
') + htmlList.push('') + var htmlListFull = []; + var fullItems = [ + 'emoticons', + 'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|', + 'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', + 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link', 'fullscreen',"more", + '/', + 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'plainpaste', + 'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript', + 'superscript', 'clearhtml', 'quickformat', 'selectall', 'fontname', + 'strikethrough', 'lineheight', '|', 'imagedirectupload', 'hr', 'pagebreak', + 'anchor', 'unlink' + ] + K.each(fullItems, function(i, name) { + if (name == '|') { + htmlListFull.push(''); + } else if (name == '/') { + htmlListFull.push(''); + } else { + htmlListFull.push(''); + htmlListFull.push(''); + } + }); + htmlListFull.unshift('') + htmlListFull.push('') var toolbar = self.toolbar = _toolbar({ src : toolbarDiv, - html : htmlList.join(''), + html : htmlList.join('')+htmlListFull.join(''), noDisableItems : self.noDisableItems, click : function(e, name) { e.stop(); @@ -4975,6 +5008,7 @@ KEditor.prototype = { self.clickToolbar(name); } }); + var editHeight = _removeUnit(height) - toolbar.div.height(); var edit = self.edit = _edit({ height : editHeight > 0 && _removeUnit(height) > self.minHeight ? editHeight : self.minHeight, @@ -5306,8 +5340,9 @@ KEditor.prototype = { createMenu : function(options) { var self = this, name = options.name, - knode = self.toolbar.get(name), + knode = self.toolbar.get(name), pos = knode.pos(); + options.x = pos.x; options.y = pos.y + knode.height(); options.z = self.options.zIndex; @@ -5992,4 +6027,5 @@ _plugin('core', function(K) { }); }); }); + })(window); diff --git a/public/assets/kindeditor/lang/zh_CN.js b/public/assets/kindeditor/lang/zh_CN.js index f2b474351..a2e1010ea 100644 --- a/public/assets/kindeditor/lang/zh_CN.js +++ b/public/assets/kindeditor/lang/zh_CN.js @@ -9,6 +9,7 @@ KindEditor.lang({ imagedirectupload:'本地图片', + more: '更多功能', source : 'HTML代码', preview : '预览', undo : '后退(Ctrl+Z)', diff --git a/public/assets/kindeditor/plugins/more/more.js b/public/assets/kindeditor/plugins/more/more.js new file mode 100644 index 000000000..31eb8567f --- /dev/null +++ b/public/assets/kindeditor/plugins/more/more.js @@ -0,0 +1,15 @@ +KindEditor.plugin('more', function(K) { + var self = this, name = 'more'; + self.plugin.more = { + click : function(){ + if($("#define").css('display') == 'block'){ + $("#define").css('display','none') + $("#full").css('display','block') + }else if($("#full").css('display') == 'block'){ + $("#full").css('display','none') + $("#define").css('display','block') + } + } + } + self.clickToolbar(name,self.plugin.more.click) +}); \ No newline at end of file diff --git a/public/assets/kindeditor/themes/default/default.css b/public/assets/kindeditor/themes/default/default.css index fcadd4fa6..d8085582e 100644 --- a/public/assets/kindeditor/themes/default/default.css +++ b/public/assets/kindeditor/themes/default/default.css @@ -243,6 +243,11 @@ width: 16px; height: 16px; } +.ke-icon-more { + background-position: 0px -672px; + width: 16px; + height: 16px; +} .ke-icon-plainpaste { background-position: 0px -704px; width: 16px;