我在下面包含了我的 javascript 的一部分,我想知道的是成功后它会向编辑器添加图像。但是,如何在添加新图像之前先从编辑器中删除所有图像?
onComplete: function (file, json) {
$('#upload-image').attr('disabled', false);
$('.error-upload').remove();
if (json['success']) {
alert(json['success']);
var oEditor = CKEDITOR.instances.forum_signature;
var value = document.getElementById('forum_signature').value;
if (oEditor.mode == 'wysiwyg') {
oEditor.insertHtml('<img src="' + json['image'] + '" alt="Image" /><p> </p>');
} else {
alert('You must be in WYSIWYG mode!');
}
}
if (json['error']) {
$('#upload').after('<span class="error-upload" style="color:red;">' + json['error'] + '</span>');
}
if (json['error_size']) {
$('#upload').after('<span class="error-upload" style="color:red;">' + json['error_size'] + '</span>');
}
$('.loading').remove();
}