在提交{trix-editor}表单之后,如何重置trix-editor
中的内容后,如何防止附件/图像在trix-editor
内的存储目录中删除。我将重置所有字段并清除表单中的字段。重置后,我发现存储在默认存储磁盘中的附件现在已删除。
这是我处理附件删除的方法
let url = file.attachment.attachment.attributes.values.url.split("/").pop();
console.log(url);
axios.delete(this.remove_attachment_endpoint + `${url}`).then(response => {
console.log(response);
}).catch(error => {
console.log(error);
});
答案 0 :(得分:0)
在我的情况下,我使用localstorage,然后输入图像名称的值。 然后您可以将文件名附加到localstorage get item。如果需要,可以在重置字段后删除项目。
handleAttachmentChanges: (event) =>{
let file = event.attachment.file.name;
localStorage.setItem('file-rich', file);
console.log(file);
console.log(event);
}