Skip to content

Commit 80407dd

Browse files
committed
rollbacks weird buggy code
1 parent b4a43b5 commit 80407dd

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
class="apos-wizard apos-i18n-localize"
44
:class="{ 'apos-wizard-busy': wizard.busy }"
55
:modal="modal"
6-
:modal-data="modalData"
7-
@esc="close()"
6+
@esc="close"
87
@inactive="modal.active = false"
98
@show-modal="modal.showModal = true"
109
>
@@ -28,7 +27,7 @@
2827
type="default"
2928
label="apostrophe:cancel"
3029
:modifiers="[ 'block' ]"
31-
@click="cancel()"
30+
@click="cancel"
3231
/>
3332
</div>
3433
</template>
@@ -326,10 +325,6 @@ export default {
326325
required: true,
327326
type: String
328327
},
329-
modalData: {
330-
type: Object,
331-
required: true
332-
},
333328
shouldRedirect: {
334329
type: Boolean,
335330
default: true
@@ -493,6 +488,13 @@ export default {
493488
isBatchMode() {
494489
return this.batchOptions.enabled;
495490
},
491+
currentLocale() {
492+
// We need to grab the locale from the modal data, because it can change
493+
// while in modal (switch locale in editor modal).
494+
// Exposing `modalData` property breaks the internally used AposModal
495+
// component for some unknown reason, so we need to use the attrs.
496+
return this.$attrs['modal-data']?.locale ?? this.moduleOptions.locale;
497+
},
496498
action() {
497499
return this.doc.slug.startsWith('/')
498500
? apos.page.action
@@ -518,7 +520,7 @@ export default {
518520
},
519521
relatedDocTypes() {
520522
if (this.isBatchMode) {
521-
return this.getRelatedSchemaTypes(this.batchOptions.checkedTypes);
523+
this.getRelatedSchemaTypes(this.batchOptions.checkedTypes);
522524
}
523525
524526
const types = {};
@@ -708,7 +710,7 @@ export default {
708710
return this.wizard.step === name;
709711
},
710712
isCurrentLocale(locale) {
711-
return this.modalData.locale === locale.name;
713+
return this.currentLocale === locale.name;
712714
},
713715
canEditLocale(locale) {
714716
return !!locale._edit;
@@ -1178,7 +1180,7 @@ export default {
11781180
this.wizard.values.translateTargets.data = [];
11791181
return;
11801182
}
1181-
const sourceLocale = this.modalData.locale;
1183+
const sourceLocale = this.currentLocale;
11821184
const targets = this.wizard.values.toLocales.data;
11831185
11841186
let response;

‎modules/@apostrophecms/modal/ui/apos/components/AposModal.vue‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ const props = defineProps({
171171
}
172172
});
173173
174+
console.log('props.modalData', props.modalData);
175+
174176
const store = useModalStore();
175177
176178
const slots = useSlots();

0 commit comments

Comments
 (0)