core icon indicating copy to clipboard operation
core copied to clipboard

template encoding problem with collection fields

Open dadaxr opened this issue 2 years ago • 2 comments

There are some encoding problems with collections fields ... especially when nested fields template have prop with json encoded value... (like editor-image :labels prop)

For instance, look at the popup opened in both screenshot :

Screenshot from 2022-03-29 00-26-27 a standalone "image field"

Screenshot from 2022-03-29 00-26-41 an "image field" within a collection. => you can spot the encoding problem

I started trace the bug, but I'm not sure how to resolve it ...

Some context : Collections field works by using a :templates prop :

<editor-collection
      :existing-fields='{{ existing_fields }}'
      :templates='{{ templated_fields }}'
      :labels='{{ labels | json_encode }}'
      :limit='{{ limit | json_encode }}'
      :name="{{  field.name | json_encode }}"
      :variant="{{ variant|json_encode }}"
    ></editor-collection>

templated_fields is a json encoded string

# macro.generate_collection_fields return an escaped json encoded string
{% set templated_fields %}{{  macro.generate_collection_fields(field, field.templates, record, true) }}{% endset %}

I guess this current bug is the same as the one mentioned here : to https://github.com/bolt/core/pull/3146

Question Answer
Relevant Bolt Version 5.1.5

dadaxr avatar Mar 28 '22 22:03 dadaxr

Sorry I was unclear while saying :

I guess this current bug is the same as the one mentioned here : to https://github.com/bolt/core/pull/3146

But fixing 3146 does not solve this bug. You should reopened it. What I would mean was "there is also an encoding problem here, and maybe solving this one (#3147) would solve #3146" and not the otherway around

dadaxr avatar Mar 30 '22 13:03 dadaxr

Aha sorry for misunderstandingđŸ˜…. I should really learn to read more carefully before closing issues...

Joossensei avatar Mar 30 '22 13:03 Joossensei