Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image: Shorthand syntax should enable functionality and UI for the lightbox #54635

Open
artemiomorales opened this issue Sep 19, 2023 · 1 comment
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Enhancement A suggestion for improvement.

Comments

@artemiomorales
Copy link
Contributor

artemiomorales commented Sep 19, 2023

The following shorthand syntaxes are currently filtered out when specified in theme.json, so we are unable to use them for configuring the lightbox:

"settings": {
    "lightbox": true
}
"settings": {
    "blocks": {
        "core/image": {
            "lightbox": true
         }
    }
}

Presumably, these would be shorthand for the following:

"settings": {
    "lightbox": {
        "enabled": false,
        "allowEditing": true
    }
}
"settings": {
    "blocks": {
        "core/image": {
            "lightbox": {
                "enabled": false,
                "allowEditing": true
            }
         }
    }
}

The following values are likewise filtered out:

"settings": {
    "lightbox": false
}
"settings": {
    "blocks": {
        "core/image": {
            "lightbox": false
         }
    }
}

These could be shorthand for the following:

"settings": {
    "lightbox": {
        "enabled": false,
        "allowEditing": false
    }
}
"settings": {
    "blocks": {
        "core/image": {
            "lightbox": {
                "enabled": false,
                "allowEditing": false
            }
         }
    }
}

We should determine what needs to change in the codebase to allow for this shorthand syntax, determine what the behavior should be, decide whether we should indeed support the shorthand syntax or not and, if so, implement.

@oandregal
Copy link
Member

I see how we want to make this more convenient in making it shorter, thanks for thinking about this. At the same time, I also see how some people would expect that lightbox: true to be unfolded into lightbox: { allowEditing: true, enabled: true }.

Moreover, the lightbox feature only works for the image block, so theme authors would not have to write it more than once ever (either at the top-level or the block-level). It's not like they have to write it dozens of times for different blocks. Given all this, I don't think it's worth implementing at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants