diff --git a/resources/js/components/field-actions/FieldAction.js b/resources/js/components/field-actions/FieldAction.js index 53963ee0d20..d5117762ec0 100644 --- a/resources/js/components/field-actions/FieldAction.js +++ b/resources/js/components/field-actions/FieldAction.js @@ -60,7 +60,7 @@ export default class FieldAction { const response = this.#run(payload); if (response instanceof Promise) { - const progress = this.#payload.vm.$progress; + const progress = Statamic.$progress; const name = this.#payload.fieldPathPrefix ?? this.#payload.handle; progress.loading(name, true); response.finally(() => progress.loading(name, false)); diff --git a/resources/js/components/fieldtypes/Fieldtype.vue b/resources/js/components/fieldtypes/Fieldtype.vue index e4b824a7678..e6c693f8e6d 100644 --- a/resources/js/components/fieldtypes/Fieldtype.vue +++ b/resources/js/components/fieldtypes/Fieldtype.vue @@ -84,7 +84,6 @@ export default { fieldActionPayload() { return { - vm: this, fieldPathPrefix: this.fieldPathPrefix, handle: this.handle, value: this.value, @@ -93,6 +92,7 @@ export default { update: this.update, updateMeta: this.updateMeta, isReadOnly: this.isReadOnly, + container: this.injectedPublishContainer, }; }, }, diff --git a/resources/js/components/fieldtypes/bard/Set.vue b/resources/js/components/fieldtypes/bard/Set.vue index e7f6824eb75..f0ee1f0c38e 100644 --- a/resources/js/components/fieldtypes/bard/Set.vue +++ b/resources/js/components/fieldtypes/bard/Set.vue @@ -265,18 +265,17 @@ export default { fieldActionPayload() { return { - // vm: this, - // fieldVm: this.fieldVm, - // fieldPathPrefix: this.fieldVm.fieldPathPrefix || this.fieldVm.handle, + fieldPathPrefix: this.fieldPathPrefix, index: this.index, values: this.values, config: this.config, - // meta: this.meta, + meta: this.meta, update: (handle, value) => this.publishContainer.setFieldValue(`${this.fieldPathPrefix}.${handle}`, value), updateMeta: (handle, value) => this.publishContainer.setFieldMeta(`${this.metaPathPrefix}.${handle}`, value), isReadOnly: this.isReadOnly, + container: this.publishContainer, }; }, diff --git a/resources/js/components/fieldtypes/fieldtype.js b/resources/js/components/fieldtypes/fieldtype.js index ce3871a709f..252fe824d6c 100644 --- a/resources/js/components/fieldtypes/fieldtype.js +++ b/resources/js/components/fieldtypes/fieldtype.js @@ -5,8 +5,11 @@ import props from './props.js'; import { computed, ref, watch } from 'vue'; import FieldAction from '@/components/field-actions/FieldAction.js'; import toFieldActions from '@/components/field-actions/toFieldActions.js'; +import { injectPublishContext } from "@ui"; const use = function(emit, props) { + const { container } = injectPublishContext() ?? {}; + const name = computed(() => { if (props.namePrefix) { return `${props.namePrefix}[${props.handle}]`; @@ -63,7 +66,6 @@ const use = function(emit, props) { }; const fieldActionPayload = computed(() => ({ - // vm: this, fieldPathPrefix: props.fieldPathPrefix, handle: props.handle, value: props.value, @@ -72,6 +74,7 @@ const use = function(emit, props) { update, updateMeta, isReadOnly: isReadOnly.value, + container, })); const internalFieldActions = ref([]); diff --git a/resources/js/components/fieldtypes/replicator/Set.vue b/resources/js/components/fieldtypes/replicator/Set.vue index d00b36f1052..264a4033fcb 100644 --- a/resources/js/components/fieldtypes/replicator/Set.vue +++ b/resources/js/components/fieldtypes/replicator/Set.vue @@ -19,6 +19,7 @@ import PreviewHtml from '@/components/fieldtypes/replicator/PreviewHtml.js'; import FieldAction from '@/components/field-actions/FieldAction.js'; import toFieldActions from '@/components/field-actions/toFieldActions.js'; import { reveal } from '@api'; +import { data_get } from "@/bootstrap/globals.js"; const emit = defineEmits(['collapsed', 'expanded', 'duplicated', 'removed']); @@ -44,7 +45,9 @@ const props = defineProps({ const { setFieldValue, setFieldMeta, - previews + previews, + container, + meta } = injectContainerContext(); const fieldPathPrefix = computed(() => `${props.fieldPath}.${props.index}`); const metaPathPrefix = computed(() => `${props.metaPath}.existing.${props.id}`); @@ -63,16 +66,15 @@ const setGroup = computed(() => { const isSetGroupVisible = computed(() => replicatorSets.length > 1 && setGroup.value.display); const fieldActionPayload = computed(() => ({ - // vm: this, - // fieldVm: this.fieldVm, - // fieldPathPrefix: this.fieldPathPrefix, + fieldPathPrefix: fieldPathPrefix.value, index: props.index, values: props.values, config: props.config, - // meta: this.meta, + meta: data_get(meta.value, metaPathPrefix.value), update: (handle, value) => setFieldValue(`${fieldPathPrefix.value}.${handle}`, value), updateMeta: (handle, value) => setFieldMeta(`${metaPathPrefix.value}.${handle}`, value), isReadOnly: props.readOnly, + container, })); const fieldActions = computed(() => {