Ckeditor5 Custom upload Adapter failed to upload without clearing the files that failed to be uploaded

I use the custom upload adapter of custom ckeditor5, which can upload normally, but I don"t use the official adapter to clear the files that failed to upload, and I use my own adapter. After failure, the edit box cannot be edited

class MyUploadAdapter {
    constructor(loader) {
      this.loader = loader;
    }

    upload() {
      return new Promise((resolve, reject) => {
        // let size = this.loader.file.size;
        // if (size / 1024 > 2048) {
        //   reject("2M");
        // }
        const data = new FormData();
        const config = {
          headers: {"content-type": "multipart/form-data"}
        };
        data.append("imageFile", this.loader.file);
        axios.post("xxxx", data, config).then(res => {
          if (res) {
            if (res.data.code == 200) {
              resolve({
                default: res.data.data
              });
            } else {
              reject(res.data.msg);
            }
          } else {
            reject();
          }
        }).catch(error => {
          console.log("33333");
          console.log(error);
          reject(error)
        });
      }).catch(error => {
        console.log(error);
      });
    }

    abort() {
    }
  }
Mar.06,2022

I defined a value of oldValue before modification. After failure, set this oldValue

class MyUploadAdapter {
          constructor(loader) {
            self.loader = loader;
            self.oldValue = self.editor.getData();
          }

          upload() {
            return self.loader.file.then(file => new Promise((resolve, reject) => {
              let size = file.size;
              let type = file.type;
              let isImg = self.accepts.indexOf(type) != -1 ? true : false;~~~~
              if (isImg && size / 1024 > 1024) {
                self.$message({
                  message: "1M"
                });
                self.editor.setData(self.oldValue);
                return false;
              }
              const data = new FormData();
              data.append("imageFile", file);
              self.$http.post("/editor/uploadImg", data).then(res => {
                if (res) {
                  if (res.data.code == 200) {
                    resolve({
                      default: res.data.data
                    });
                  } else {
                    self.$message({
                      message: res.data.msg
                    });
                    self.editor.setData(self.oldValue);
                  }
                } else {
                  self.$message({
                    message: "can not upload file: " + file.name
                  });
                  self.editor.setData(self.oldValue);
                }
              });
            }).catch(error => {
              console.log(error);
            }))
          }

          abort() {
          }
        }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36ad7-2b7ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36ad7-2b7ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?