62,041
社区成员
发帖
与我相关
我的任务
分享
if(stateText==0||stateText==""){
if (toolbarItem == 'fullscreen'||toolbarItem == 'toggletool') {
目的是把这个按钮也跟全屏按钮一样放到首行
themes/default/ueditor.css 中
1. 加css(跟全屏按钮一样浮动到右边)
.edui-default .edui-toolbar .edui-for-toggletool {
float: right;
}
2. 定义按钮背景图片
.edui-default .edui-for-toggletool .edui-icon {
background-position: -400px -40px;
}
二 、在引用ueditor的网页代码里
var stateText=0;
var countnum=0;
//实例化编辑器
var ue = UE.getEditor('editor',{toolbars:[[
'toggletool','fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist','|',
'simpleupload', 'insertimage','|', 'selectall', 'cleardoc'
]],initialFrameWidth:1024,initialFrameHeight:500});
baidu.editor.commands['toggletool']={
execCommand:function () {
var fullscreenstate=this.ui.isFullScreen();
if(fullscreenstate==true){
this.ui.setFullScreen(false);//取消全屏模式
}
countnum++;
//this.setContent(" <a href='http://www.lzzx.cn' target='_blank'>连云港市厉庄高级中学</a> "+"第"+countnum+"次:原stateText值:"+stateText+"<br>", true);
this.destroy();
if(stateText<0||stateText==""){
//alert("简易");
ue = UE.getEditor('editor',{toolbars:[[
'toggletool','fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
'directionalityltr', 'directionalityrtl', 'indent', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
'print', 'preview', 'searchreplace', 'help', 'drafts'
]],initialFrameWidth:1024,initialFrameHeight:500});
stateText=1;
}else if(stateText>0){
//alert("复杂");
ue = UE.getEditor('editor',{toolbars:[[
'toggletool','fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist','|',
'simpleupload', 'insertimage','|', 'selectall', 'cleardoc'
]],initialFrameWidth:1024,initialFrameHeight:500});
stateText=0;
}
return true;
}
}