First of all, thank you for the great new block field in Kirby. I’m currently working on a website and would like to extend the default block type “text” so that only “bold” and “link” are available as editing options. Unfortunately, I haven’t found a way to do this. It also looks like the Default Vue Component is not made for it. With the “text” field (writer) for the default block type “heading”, for example, this works perfect!
Is there a reason why the restriction of this formatting option for the default block type “text” is apparently not intended, or am I doing something fundamentally wrong?
I’ve already tried this:
type: blocks
filedsets:
heading:
.... # works perfect
text:
extends: blocks/text
fields:
text:
marks: # doesn't work
- bold
- link
Unfortunately that’s the problem that it doesn’t seem to work. Overwriting works with the text in the heading block type and I think so with the writer field.
Only with the text block type it doesn’t work…
I have now created the file “text.yml” in the folder “site/blueprints/blocks” with the following content:
name: field.blocks.text.name
icon: text
preview: text
fields:
text:
type: writer
nodes: false
placeholder: field.blocks.text.placeholder
marks:
- bold
- link
However, the restricted editing field is now only displayed in the pop-up window (on the right side when i’m editing the field). in the field itself I have the complete editor available…
Has someone found a solution for this issue or does someone have the same problem?
In addition to the block for headlines, the restricted formatting options also work for the list element … unfortunately this does not seem to work for the text element. Am I doing something wrong, or is a solution planned?
Hello again …
I’m even working on a project where I want to restrict the formatting in the text element of the block field for the customer as I wrote it above. The project should go online this month. Is there a solution to my “problem”? Am I doing something wrong with expanding the text block?
Ask again for help or at least a hint.
The problem is that you can set the marks in a custom site/blueprints/blocks/text.yml blueprint and the changes are reflected when editing the field in the drawer.
name: field.blocks.text.name
icon: text
preview: text
fields:
text:
type: writer
nodes: false
placeholder: field.blocks.text.placeholder
marks:
- bold
However, the preview for the field ignores those blueprint settings. So I guess that you would have to overwrite the preview as well.
This is my first project with Kirby. I have been working with ProcessWire for about 5 years (as already written in an other post) and before that I used Redaxo for my customer projects for about 5 years. However, I’ve been interested in Kirby for a long time, and personally I think the panel is awesome and kirby is today genearlly more suitable for my needs . With the new Blocks fields at the core, I have now decided to use Kirby as a preference for my customer projects.
So I’m not a total newcomer to CMS, but I would be very grateful for a short tip on how to overwrite the preview too… Everything is going really well with Kirby, but I currently don’t have the capacity to to get an even deeper insight into the Kirby documentation.
Although hardcoding the marks here is probably not a good idea, because you could end up with two different results for the drawer and the preview. But I don’t really know how to fetch the marks from the blueprint here.
I’ve already read the documentation for blocks. I’ll have a deeper look at the part with the Text.vue and how to manage js files in a plugin asap. Maybe this function will soon be in the core anyway? It would be a pity if that only works for headlines and lists in the future …