I have this block with a k-writer component. I want the panel preview to be able to update the corresponding field. When using a field named “text“ it works, but I’m not sure how to update a different field.
My component adds paragraph tags inside the field for every input. This is my component. The second k-writer that is bound to textField works just fine.
I haven’t found any information about the update function. How does it work and what does it take as arguments?
Thanks!
<template>
<div>
<k-writer
v-bind="nameField"
:value="content.name"
class="name k-block-type-text-input"
@input="update({ name: $event })"
/>
<k-writer
v-bind="textField"
:value="content.text"
class="text k-block-type-text-input"
@input="update({ text: $event })"
/>
</div>
</template>
<script>
export default {
computed: {
nameField() {
return this.field("name", {});
},
textField() {
return this.field("text", {});
}
},
};
</script>
<style>
.k-block-type-text-input {
font-size: var(--text-base);
line-height: 1.5em;
height: 100%;
}
.k-block-type-text,
.k-block-container-type-text,
.k-block-type-text .k-writer .ProseMirror {
height: 100%;
}
.name {
font-size: 120%;
}
.text {
padding-left: 1rem;
}
</style>