您现在的位置是:首页>技术分享>UEditor百度富文本编辑器 自适应宽度
UEditor百度富文本编辑器 自适应宽度
发布时间:2017-10-13 编辑:小付 浏览(861) 评论(0)
解决方案:
1.打开/ueditor/ueditor.config.js
找到initialFrameWidth属性,默认值是1000.即是initialFrameWidth: 1000
把值更改为'100%' , 即是initialFrameWidth: '100%'
保存后,刷新浏览器再看看...
示例:
/** * 实例化编辑器 */ function initEditor(){ var ue = UE.getEditor('container', { toolbars: [[ 'source', //源代码 'undo', //撤销 'redo', //重做 'bold', //加粗 'indent', //首行缩进 'italic', //斜体 'underline', //下划线 'strikethrough', //删除线 'print', //打印 'preview', //预览 'horizontal', //分隔线 'inserttitle', //插入标题 'deletecaption', //删除表格标题 'inserttable', //插入表格 'insertrow', //前插入行 'insertcol', //前插入列 'mergeright', //右合并单元格 'mergedown', //下合并单元格 'deleterow', //删除行 'deletecol', //删除列 'splittorows', //拆分成行 'splittocols', //拆分成列 'splittocells', //完全拆分单元格 'deletecaption', //删除表格标题 'mergecells', //合并多个单元格 'deletetable', //删除表格 'insertparagraphbeforetable', //"表格前插入行" 'date', //日期 'time', //时间 'link', //超链接 'unlink', //取消链接 'insertcode', //代码语言 'fontfamily', //字体 'fontsize', //字号 'paragraph', //段落格式 'edittable', //表格属性 'edittd', //单元格属性 'justifyleft', //居左对齐 'justifyright', //居右对齐 'justifycenter', //居中对齐 'justifyjustify', //两端对齐 'forecolor', //字体颜色 'backcolor', //背景色 'insertorderedlist', //有序列表 'insertunorderedlist', //无序列表 'fullscreen', //全屏 'rowspacingtop', //段前距 'rowspacingbottom', //段后距 'autotypeset', //自动排版 'background' //背景 ] ], elementPathEnabled:false,//不显示元素路径 enableAutoSave:false,//不启用自动保存 initialFrameHeight:document.documentElement.clientHeight-400, initialFrameWidth:'100%' }); return ue; }
关键字词:UEditor,富文本,宽度