在图像标记IE11上添加自定义属性时无法发布表单。有没有其他方法可以做到这一点,或者我需要用不同的方式来做?
contentCKEditor = CKEDITOR.replace( 'SimpleTemplate_HTML', {
'height': 400,
'removePlugins': 'autogrow',
'filebrowserImageWindowWidth' : '700',
'filebrowserImageWindowHeight' : '540',
'image_previewText': '',
'insertMode' : true,
});
CKEDITOR.on('dialogDefinition', function( ev ) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
dialogDefinition.removeContents('Link');
if (dialogName == 'image') {
dialogDefinition.onOk = function(e) {
var imageSrcUrl = e.sender.originalElement.$.src;
var assetId = $('div[rel="ckeditor"]').attr('data-id');
var style = "width:200px;";
this.imageElement.setAttribute( 'data-assetid', assetId);
this.imageElement.setAttribute( 'style', style);
this.imageElement.setAttribute( 'src', imageSrcUrl );
contentCKEditor.insertNode(this.imageElement);
}
}
});
可能是您的表单未命中:
enctype="multipart/form-data"
当enctype
缺失时,不会创建$_FILES
变量
我的表单如下:(不使用自定义文件浏览器)
<form action="require/fileup.php" method="post" enctype="multipart/form-data" class="imageForm">
<center>
<input name="file_up" type="file" class="file_up">
</center>
</form>
在你的一条评论中,你写了
<p><img data-assetid="6d39a9ec-8c4e-d297-786b-fecb9cc79e63" src="localhost/image/show/id/6d39a9ec.jpg"; style="width: 200px;" /></p>
有一个分号AFTER src=",它不应该在那里。这可能是问题所在,还是打字错误?