Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
### Fixes

* The `?render-areas=1` API feature now correctly disregards areas in separate documents loaded via relationship fields. Formerly their presence resulted in an error, not a rendering.
* Make conditional fields work in Image Editor.

## 4.20.0 (2025-08-06)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
:trigger-validation="triggerValidation"
:doc-id="docFields.data._id"
:following-values="followingValues()"
:conditional-fields="conditionalFields"
:server-errors="serverErrors"
@validate="triggerValidate"
@reset="$emit('modified', false)"
Expand Down Expand Up @@ -231,6 +232,7 @@ export default {
'docFields.data': {
deep: true,
handler(newData, oldData) {
this.evaluateConditions();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-evaluate when a field is changed

this.$nextTick(() => {
// If either old or new state are an empty object, it's not
// "modified."
Expand All @@ -252,8 +254,8 @@ export default {
}
}
},
media(newVal) {
this.updateActiveDoc(newVal);
async media(newVal) {
await this.updateActiveDoc(newVal);
Comment on lines +257 to +258

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.updateActiveDoc(newVal); is asynchronous

}
},
mounted() {
Expand All @@ -271,6 +273,8 @@ export default {
this.restoreOnly = !!this.activeMedia.archived;
this.original = klona(newMedia);
this.docFields.data = klona(newMedia);
this.evaluateConditions();
await this.evaluateExternalConditions();

@ETLaurent ETLaurent Aug 1, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evaluate external conditions when selecting an image for edition.
It means making an XHR request every time we select an image but it makes external conditions work there...

this.generateLipKey();
await this.unlock();
// Distinguish between an actual doc and an empty placeholder
Expand Down Expand Up @@ -402,7 +406,7 @@ export default {
}

await this.cancel();
this.updateActiveDoc(this.activeMedia);
await this.updateActiveDoc(this.activeMedia);
}
apos.bus.$emit('admin-menu-click', {
itemName: '@apostrophecms/i18n:localize',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
async evaluateExternalConditions() {
this.externalConditionsResults = await evaluateExternalConditions(
this.schema,
this.docId || this.docFields?.data?._docId,
this.docId || this.docFields?.data?._docId || this.docFields?.data?._id,
this.$t
);
},
Expand Down