This commit is contained in:
whimlex 2015-04-27 17:15:38 +08:00
commit 4982c9f7d2
4 changed files with 64 additions and 7 deletions

View File

@ -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('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-' + name + '" unselectable="on"></span></span>');
}
});
htmlList.unshift('<div style="display:block" id="define"/>')
htmlList.push('</div>')
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('<span class="ke-inline-block ke-separator"></span>');
} else if (name == '/') {
htmlListFull.push('<div class="ke-hr"></div>');
} else {
htmlListFull.push('<span class="ke-outline" data-name="' + name + '" title="' + self.lang(name) + '" unselectable="on">');
htmlListFull.push('<span class="ke-toolbar-icon ke-toolbar-icon-url ke-icon-' + name + '" unselectable="on"></span></span>');
}
});
htmlListFull.unshift('<div style="display:none" id="full"/>')
htmlListFull.push('</div>')
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);

View File

@ -9,6 +9,7 @@
KindEditor.lang({
imagedirectupload:'本地图片',
more: '更多功能',
source : 'HTML代码',
preview : '预览',
undo : '后退(Ctrl+Z)',

View File

@ -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)
});

View File

@ -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;