mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-07 11:24:35 +08:00
Added the ability to replace existing image files
- Updated UI with image form dropdown containing delete and replace image actions. - Adds new endpoint and service/repo handling for replacing existing image. - Includes tests to cover.
This commit is contained in:
@ -15,6 +15,7 @@ export class Dropzone extends Component {
|
||||
this.isActive = true;
|
||||
|
||||
this.url = this.$opts.url;
|
||||
this.method = (this.$opts.method || 'post').toUpperCase();
|
||||
this.successMessage = this.$opts.successMessage;
|
||||
this.errorMessage = this.$opts.errorMessage;
|
||||
this.uploadLimitMb = Number(this.$opts.uploadLimit);
|
||||
@ -167,6 +168,9 @@ export class Dropzone extends Component {
|
||||
startXhrForUpload(upload) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', upload.file, upload.file.name);
|
||||
if (this.method !== 'POST') {
|
||||
formData.append('_method', this.method);
|
||||
}
|
||||
const component = this;
|
||||
|
||||
const req = window.$http.createXMLHttpRequest('POST', this.url, {
|
||||
|
Reference in New Issue
Block a user