getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

Extending blocks type "text" adds p tags to the input #3016

Closed jnetzlr closed 2 years ago

jnetzlr commented 3 years ago

Description
I’m currently extending the text block type:

text:
  extends: blocks/text
  fields:
    text:
      type: textarea

But when editing the block, there are p tags added to the content. Even while writing in the input field (while the right side modal of the block is opened) there are p tags added to each typed character.

Expected behavior
p tags shouldn't be added to the input field.

Kirby version
3.5

Desktop

afbora commented 3 years ago

Forum discussion: https://forum.getkirby.com/t/issue-extending-blocks-type-text/20416

afbora commented 3 years ago

@bastianallgeier Is this an issue or enhancement or expected behavior?

bastianallgeier commented 3 years ago

@afbora I consider this an expected behaviour. The text blocks expects a writer field. But we need to document it and/or add error handling if another field type is chosen.

afbora commented 3 years ago

If the previews do not meet certain requirements, it would be nice if the default block appears instead of the warning.

bastianallgeier commented 3 years ago

@afbora that's a fantastic idea!

marianruberg commented 3 years ago

It also happens when using a custom block with a field called “text”. The only workaround i found is renaming the field or setting preview: false in the block’s blueprint

SkidX commented 3 years ago

I can confirm the behavior described by @marianruberg

I would like to point out that a lot of people were using the builder plugins definining a custom text block, with a textarea field named "text" inside, a pretty common naming choice. Now switching to the new blocks field suddenly those textarea fields are broken because - I guess - the writer features kick in making the textare field totally unusable.

Having a feature somehow based on a field name without making that name reserved complicates a lot of real world situations.

distantnative commented 2 years ago

What we could do is

afbora commented 2 years ago