Fix refresh of photo on edit
parent
3d0905628a
commit
ebdc776237
|
@ -178,6 +178,7 @@ export default class ImageEditor extends Mixins(GlobalMixin) {
|
|||
} else {
|
||||
emit("files:file:updated", { fileid: this.fileid });
|
||||
}
|
||||
this.onClose(undefined, false);
|
||||
} catch (error) {
|
||||
showError(this.t("viewer", "Error saving image"));
|
||||
}
|
||||
|
|
|
@ -172,11 +172,15 @@ export default class Viewer extends Mixins(GlobalMixin) {
|
|||
mounted() {
|
||||
subscribe("files:sidebar:opened", this.handleAppSidebarOpen);
|
||||
subscribe("files:sidebar:closed", this.handleAppSidebarClose);
|
||||
subscribe("files:file:created", this.handleFileUpdated);
|
||||
subscribe("files:file:updated", this.handleFileUpdated);
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
unsubscribe("files:sidebar:opened", this.handleAppSidebarOpen);
|
||||
unsubscribe("files:sidebar:closed", this.handleAppSidebarClose);
|
||||
unsubscribe("files:file:created", this.handleFileUpdated);
|
||||
unsubscribe("files:file:updated", this.handleFileUpdated);
|
||||
}
|
||||
|
||||
/** Number of buttons to show inline */
|
||||
|
@ -224,6 +228,15 @@ export default class Viewer extends Mixins(GlobalMixin) {
|
|||
: null;
|
||||
}
|
||||
|
||||
/** Event on file changed */
|
||||
handleFileUpdated({ fileid }: { fileid: number }) {
|
||||
console.log("file updated", fileid);
|
||||
if (this.currentPhoto && this.currentPhoto.fileid === fileid) {
|
||||
this.currentPhoto.etag += "_";
|
||||
this.photoswipe.refreshSlideContent(this.currIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/** Create the base photoswipe object */
|
||||
private async createBase(args: PhotoSwipeOptions) {
|
||||
this.show = true;
|
||||
|
|
|
@ -79,6 +79,12 @@ export default class Photo extends Mixins(GlobalMixin) {
|
|||
}
|
||||
}
|
||||
|
||||
@Watch("data.etag")
|
||||
onEtagChange() {
|
||||
this.hasFaceRect = false;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.hasFaceRect = false;
|
||||
this.refresh();
|
||||
|
|
|
@ -98,9 +98,9 @@ export function getDownloadLink(photo: IPhoto) {
|
|||
route.params.name
|
||||
);
|
||||
if (fInfos.length) {
|
||||
return `/remote.php/dav/${fInfos[0].originalFilename}`;
|
||||
return `/remote.php/dav${fInfos[0].originalFilename}`;
|
||||
}
|
||||
}
|
||||
|
||||
return `/remote.php/dav/${photo.filename}`; // normal route
|
||||
return `/remote.php/dav${photo.filename}`; // normal route
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue