I’m using the sync
and wizard
option on the slug field in a blueprint to recreate something like Kirby’s Title and Url Appendix fields (shown when creating a new page or editing a page in the panel). In Kirby, the Url Appendix Field only syncs with Title if it is empty. When there already is a value in Url Appendix the field doesn’t sync. Is this possible with the slug field?
Was able to solve this by extending k-slug-input
:
// New `SlugInput.vue`
export default {
extends: 'k-slug-input',
data() {
return { wasEmptyOnCreate: false }
},
created() {
this.wasEmptyOnCreate = !this.value
},
computed: {
// Conditionally disable the `sync` prop
sync() {
return this.wasEmptyOnCreate ? this.$options.propsData.sync : null
},
},
}