日期:2014-05-17 浏览次数:20924 次
解决extjs中htmleditor自动添加?问题
当内容为空的时候,htmleditor会自动在内容前面添加?,在视图编辑模式中,当内容为空的时候,打开源码编辑模式,发现源码中是有<br>标签,所以htmleditor内容的默认值不能为空,必须为<br>,这样就可以解决ExtJS内部引起的自动添加?问题
?
var htmleditor=new Ext.form.HtmlEditor({
id: config.id || '',
name: config.name || '',
fieldLabel: config.fieldLabel || '',
hideLabel: config.hideLabel || false,
value:'<br>', //设置默认值,解决视图编辑模式下内容为空时,自动添加 ? 问题
anchor: config.anchor || '100%',
allowBlank: config.allowBlank || false,
createLinkText: config.createLinkText || '创建超链接', // 创建连接的提示信息
defaultLinkValue: config.defaultLinkValue || "http://www.", // 连接的默认格式
enableAlignments: config.enableAlignments || true, // 启用左、中、右对齐按钮
enableColors: config.enableColors || true, // 启用前景色、背景色选择按钮
enableFont: config.enableFont || true, //启用字体选择按钮
enableFontSize: config.enableFontSize || true, // 启用字体增大和缩小按钮
enableFormat: config.enableFormat || true, // 启用粗体、斜体、下划线按钮
enableLinks: config.enableLinks || true, // 启用创建连接按钮
enableLists: config.enableLists || true, // 启用列表按钮
enableSourceEdit: config.enableSourceEdit || false, // 不启用源代码编辑按钮
xtype:'htmleditor',
fontFamilies : ['宋体', '隶书', '黑体', '楷体'], // 字体列表
buttonTips : {
bold : {title:'Bold (Ctrl+B)',text:'粗体'},
italic : {title:'Italic (Ctrl+I)',text:'斜体'},
underline : {title:'Underline (Ctrl+U)',text:'下划线'},
increasefontsize : {title:'Grow Text',text:'增大字体'},
decreasefontsize : {title:'Shrink Text',text:'缩小字体'},
backcolor : {title:'Text Highlight',text:'背景色'},
forecolor : {title:'Font Color',text:'前景色'},
justifyleft : {title:'Align Text Left',text:'左对齐'},
justifycenter : {title:'Center Text',text:'居中对齐'},
justifyright : {title:'Align Text Right',text:'右对齐'},
insertunorderedlist : {title:'Bullet List',text:'项目符号'},
insertorderedlist : {title:'Numbered List',text:'数字编号'},
createlink : {title:'Hyperlink',text:'超链接'},
sourceedit : {title:'Source Ecit',text:'切换源代码编辑模式'}
},
plugins: plugin
});
?