Mar*_*ins 2 html css wysiwyg ckeditor responsive-design
我遇到了使用ckeditor的恼人特征.
当您上传图像时,在文本内容之间或任何地方,ckeditor会自动填写宽度和高度输入字段作为默认值,从而导致在属性中使用width和height设置html标记style:
<img alt="" src="/uploads/ckeditor/pictures/196/content_David_Leo006.jpg" style="width: 2000px; height: 669px;">
Run Code Online (Sandbox Code Playgroud)
但是,如果删除输入字段中的值然后提交,则不会设置宽度和高度:
<img alt="" src="/uploads/ckeditor/pictures/196/content_David_Leo006.jpg">
Run Code Online (Sandbox Code Playgroud)
就像21世纪任何一个普通,聪明的健康网络开发者一样,我有一个响应式设计来处理这些事情,所以我希望标签总是像后者一样生成.如何隐藏和禁用宽度/高度的输入字段?
CK编辑的文档非常混乱
我做了类似桌子的事情.我不希望最终用户输入愚蠢的值,因为我们强制响应式样和宽度.
也许这段代码可以帮到你:
CKEDITOR.on( 'dialogDefinition', function( ev )
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName == 'table') {
// Get the advanced tab reference
var infoTab2 = dialogDefinition.getContents('advanced');
//Set the default
// Remove the 'Advanced' tab completely
dialogDefinition.removeContents('advanced');
// Get the properties tab reference
var infoTab = dialogDefinition.getContents('info');
// Remove unnecessary bits from this tab
infoTab.remove('txtBorder');
infoTab.remove('cmbAlign');
infoTab.remove('txtWidth');
infoTab.remove('txtHeight');
infoTab.remove('txtCellSpace');
infoTab.remove('txtCellPad');
infoTab.remove('txtCaption');
infoTab.remove('txtSummary');
}
});
Run Code Online (Sandbox Code Playgroud)