Allow sectioning in meta editor
parent
d47da7d554
commit
608e8556d8
|
@ -114,7 +114,8 @@ export default defineComponent({
|
||||||
title: this.dateOriginalStr,
|
title: this.dateOriginalStr,
|
||||||
subtitle: this.dateOriginalTime,
|
subtitle: this.dateOriginalTime,
|
||||||
icon: CalendarIcon,
|
icon: CalendarIcon,
|
||||||
edit: () => globalThis.editMetadata([globalThis.currentViewerPhoto]),
|
edit: () =>
|
||||||
|
globalThis.editMetadata([globalThis.currentViewerPhoto], [1]),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +142,8 @@ export default defineComponent({
|
||||||
title: title || this.t("memories", "No title"),
|
title: title || this.t("memories", "No title"),
|
||||||
subtitle: [desc || this.t("memories", "No description")],
|
subtitle: [desc || this.t("memories", "No description")],
|
||||||
icon: InfoIcon,
|
icon: InfoIcon,
|
||||||
|
edit: () =>
|
||||||
|
globalThis.editMetadata([globalThis.currentViewerPhoto], [3]),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +152,8 @@ export default defineComponent({
|
||||||
title: this.tagNamesStr,
|
title: this.tagNamesStr,
|
||||||
subtitle: [],
|
subtitle: [],
|
||||||
icon: TagIcon,
|
icon: TagIcon,
|
||||||
|
edit: () =>
|
||||||
|
globalThis.editMetadata([globalThis.currentViewerPhoto], [2]),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,12 +208,12 @@ export default defineComponent({
|
||||||
];
|
];
|
||||||
|
|
||||||
// Ugly: globally exposed functions
|
// Ugly: globally exposed functions
|
||||||
globalThis.editMetadata = (photos: IPhoto[]) => {
|
globalThis.editMetadata = (photos: IPhoto[], sections?: number[]) => {
|
||||||
const sel = new Map<number, IPhoto>();
|
const sel = new Map<number, IPhoto>();
|
||||||
for (const photo of photos) {
|
for (const photo of photos) {
|
||||||
sel.set(photo.fileid, photo);
|
sel.set(photo.fileid, photo);
|
||||||
}
|
}
|
||||||
this.editMetadataSelection(sel);
|
this.editMetadataSelection(sel, sections);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -748,8 +748,11 @@ export default defineComponent({
|
||||||
/**
|
/**
|
||||||
* Open the edit date dialog
|
* Open the edit date dialog
|
||||||
*/
|
*/
|
||||||
async editMetadataSelection(selection: Selection) {
|
async editMetadataSelection(selection: Selection, sections?: number[]) {
|
||||||
(<any>this.$refs.editMetadata).open(Array.from(selection.values()));
|
(<any>this.$refs.editMetadata).open(
|
||||||
|
Array.from(selection.values()),
|
||||||
|
sections
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,21 +17,21 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div v-if="photos">
|
<div v-if="photos">
|
||||||
<div>
|
<div v-if="sections.includes(1)">
|
||||||
<div class="title-text">
|
<div class="title-text">
|
||||||
{{ t("memories", "Date / Time") }}
|
{{ t("memories", "Date / Time") }}
|
||||||
</div>
|
</div>
|
||||||
<EditDate ref="editDate" :photos="photos" />
|
<EditDate ref="editDate" :photos="photos" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="config_tagsEnabled">
|
<div v-if="config_tagsEnabled && sections.includes(2)">
|
||||||
<div class="title-text">
|
<div class="title-text">
|
||||||
{{ t("memories", "Collaborative Tags") }}
|
{{ t("memories", "Collaborative Tags") }}
|
||||||
</div>
|
</div>
|
||||||
<EditTags ref="editTags" :photos="photos" />
|
<EditTags ref="editTags" :photos="photos" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div v-if="sections.includes(3)">
|
||||||
<div class="title-text">
|
<div class="title-text">
|
||||||
{{ t("memories", "EXIF Fields") }}
|
{{ t("memories", "EXIF Fields") }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -83,6 +83,7 @@ export default defineComponent({
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
photos: null as IPhoto[],
|
photos: null as IPhoto[],
|
||||||
|
sections: [] as number[],
|
||||||
show: false,
|
show: false,
|
||||||
processing: false,
|
processing: false,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
|
@ -94,10 +95,11 @@ export default defineComponent({
|
||||||
this.$emit("refresh", val);
|
this.$emit("refresh", val);
|
||||||
},
|
},
|
||||||
|
|
||||||
async open(photos: IPhoto[]) {
|
async open(photos: IPhoto[], sections: number[] = [1, 2, 3]) {
|
||||||
const state = (this.state = Math.random());
|
const state = (this.state = Math.random());
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
this.sections = sections;
|
||||||
|
|
||||||
let done = 0;
|
let done = 0;
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
|
@ -154,7 +156,7 @@ export default defineComponent({
|
||||||
async save() {
|
async save() {
|
||||||
// Perform validation
|
// Perform validation
|
||||||
try {
|
try {
|
||||||
(<any>this.$refs.editDate).validate();
|
(<any>this.$refs.editDate)?.validate?.();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
showError(e);
|
showError(e);
|
||||||
|
@ -162,10 +164,8 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get exif fields diff
|
// Get exif fields diff
|
||||||
const exifResult = (<any>this.$refs.editExif).result();
|
const exifResult = (<any>this.$refs.editExif)?.result?.() || {};
|
||||||
const tagsResult = this.config_tagsEnabled
|
const tagsResult = (<any>this.$refs.editTags)?.result?.() || null;
|
||||||
? (<any>this.$refs.editTags).result()
|
|
||||||
: null;
|
|
||||||
|
|
||||||
// Start processing
|
// Start processing
|
||||||
let done = 0;
|
let done = 0;
|
||||||
|
@ -182,7 +182,7 @@ export default defineComponent({
|
||||||
const raw = JSON.parse(JSON.stringify(exifResult));
|
const raw = JSON.parse(JSON.stringify(exifResult));
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
const date = (<any>this.$refs.editDate).result(p);
|
const date = (<any>this.$refs.editDate)?.result?.(p);
|
||||||
if (date) {
|
if (date) {
|
||||||
raw.DateTimeOriginal = date;
|
raw.DateTimeOriginal = date;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ declare global {
|
||||||
var OC: Nextcloud.v24.OC;
|
var OC: Nextcloud.v24.OC;
|
||||||
var OCP: Nextcloud.v24.OCP;
|
var OCP: Nextcloud.v24.OCP;
|
||||||
|
|
||||||
var editMetadata: (photos: IPhoto[]) => void;
|
var editMetadata: (photos: IPhoto[], sections?: number[]) => void;
|
||||||
var currentViewerPhoto: IPhoto;
|
var currentViewerPhoto: IPhoto;
|
||||||
|
|
||||||
var windowInnerWidth: number; // cache
|
var windowInnerWidth: number; // cache
|
||||||
|
|
Loading…
Reference in New Issue