tinymce 图片上传失败关闭进度条重新上传
可以在上传图片的过程中加入一个进度条,在上传失败时,关闭进度条并提示用户重新上传。具体实现方式如下:
- 在上传图片的代码中加入进度条的显示和隐藏:
// 显示进度条
editor.notificationManager.open({
text: '上传中...',
type: 'info',
timeout: 0
});
// 隐藏进度条
editor.notificationManager.close();
- 在上传失败的回调函数中关闭进度条并提示用户重新上传:
if (xhr.status !== 200) {
// 关闭进度条
editor.notificationManager.close();
// 提示用户重新上传
editor.windowManager.alert('上传失败,请重新上传!');
return;
}
这样,当图片上传失败时,就会关闭进度条并提示用户重新上传。
原文地址: http://www.cveoy.top/t/topic/bO6w 著作权归作者所有。请勿转载和采集!