As in Marks restrication in text block doesn't work in preview for marks I noticed this for nodes: restriction for nodes, to only show ul
and ol
, work in drawer but not in preview, all nodes will be shown.
Kirby 3.6.2
As in Marks restrication in text block doesn't work in preview for marks I noticed this for nodes: restriction for nodes, to only show ul
and ol
, work in drawer but not in preview, all nodes will be shown.
Kirby 3.6.2
Hm, works for me?
fields:
blocks:
type: blocks
fieldsets:
text:
extends: blocks/text
fields:
text:
nodes:
- bulletList
name: Aside
icon: info
fields:
text:
label: Text
type: writer
placeholder: Enter Aside text …
nodes:
- bulletList
- orderedList
I must be doing something wrong … ?
So this is a custom block with your own preview?
yes
Any reason you don’t use the text preview?
name: Aside
icon: info
preview: text
fields:
text:
label: Text
type: writer
placeholder: Enter Aside text …
nodes:
- bulletList
- orderedList
Hmmm, wasn’t aware of that but that destroys my nice custom aside preview. Although the nodes work properly in that case. How can I get both
Could you post your preview code?
<template>
<div class="aside" :data-icon="icon" :style="hue">
<k-writer
class="label"
ref="textbox"
:marks="textField.marks"
:value="content.text"
:placeholder="textField.placeholder"
@input="update({ text: $event })"
/>
</div>
</template>
<script>
export default {
computed: {
textField() {
return this.field("text");
},
hue() {
return '--hue:' + this.content.color + ';'
},
icon() {
if (this.content.icon.length) {
return this.content.icon;
} else if (this.content.icon_text.length) {
return this.content.icon_text;
} else {
return false;
}
}
},
};
</script>
You haven’t defined the nodes attribute like in the original text field preview:
<template>
<k-writer
ref="input"
:inline="textField.inline"
:marks="textField.marks"
:nodes="textField.nodes"
:placeholder="textField.placeholder"
:value="content.text"
class="k-block-type-text-input"
@input="update({ text: $event })"
/>
</template>
Yup, of course that’s it, thanks.
So, where can I read more about the preview thingy?
General stuff you can find in the different block recipes in the cookbook.
But there is also the documentation about all Panel components: UI Kit | Kirby CMS
Yeah, plenty to read. But not much about “preview”?
All blocks recipes are about previews. What exactly are you missing?
Never mind. Your remark “Any reason you don’t use the text preview?” made me think there was more to it and why do I need text preview on custom block …