Allow choosing only Fences Presets in the field config

Created on 11 April 2025, about 2 months ago

Problem/Motivation

The Fences Presets idea is great, but actually it works not fully as expected. If we create a preset, apply it to 10+ fields, and then - change the preset settings (eg, change the class name in it), all already configured fields will keep the previous value.

Also, in many cases I want to limit the content editor to choose only pre-defined presets, without allowing to add some custom classes, and seems it can be resolved in the scope of this issue too.

Proposed resolution

Add checkboxes "Show Presets" and "Show custom styles" to the config form and follow it.
Alternatively, we can create separate per-role permissions for this.

Also, we need to rework how the chosen preset affects the settings, seems it should add the pre-defined styles to the current values (or merge) on the render stage, not on the field settings save stage.

Feature request
Status

Active

Version

3.0

Component

Code (fences)

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @murz
  • 🇦🇲Armenia murz Yerevan, Armenia
  • 🇩🇪Germany Anybody Porta Westfalica

    @murz yes, that's by design. There are definitely cases for both. Feel free to add another formatter setting to use the reference on the preset instead. We decided to not implement that ourselves. In 95% it's good enough for us and the reference alternative also has drawbacks, so the user needs to decide per formatter then. (That's why it's called "Presets")

    I disagree with the proposed solution a bit. Maybe there's a better way with backwards compatibility. I imagine something like a "Customize values" checkbox after selecting a preset, which then shows the fields. Otherwise the fields are hidden when selecting a preset and reference is used.

    Let's first discuss that in detail and sketch the UX, before you invest time into the implementation. Thanks and great ideas! :)

Production build 0.71.5 2024