WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.5k stars 4.19k forks source link

Add ability to show `dropCap` tools panel by default #45755

Open fabiankaegy opened 1 year ago

fabiankaegy commented 1 year ago

What problem does this address?

It is currently not possible to show the Drop Cap setting in the Settings sidebar by default. If your design system makes use of this option frequently it has become more difficult over time to actually add this control.

What is your proposed solution?

All of the other typography supports which actually technically are block support options make use of the __experimentalDefaultControls in the block supports configuration object to control which settings get shown by default.

It would be great if this mechanism (or any other way to achieve this) would also work for custom registered tools panels such as the drop cap setting

import { addFilter } from '@wordpress/hooks';

function addDropCapSettingByDefault(settings, name) {
    if (name !== 'core/paragraph') {
        return settings;
    }

    return {
        ...settings,
        supports: {
            ...settings?.supports,
            typography: {
                ...settings?.supports?.typography,
                __experimentalDefaultControls: {
                    ...settings?.supports?.typography?.__experimentalDefaultControls,
                    dropCap: true,
                },
            },
        },
    };
}

addFilter(
    'blocks.registerBlockType',
    'add-drop-cap-setting-by-default',
    addDropCapSettingByDefault,
);
github-actions[bot] commented 1 year ago

Hi, This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

github-actions[bot] commented 1 year ago

Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

jordesign commented 1 year ago

As noted in the linked PRS (eg. https://github.com/WordPress/gutenberg/pull/45994) this approach isn't the best fit for the dropCap panel - so I'll close this issue.

jeffpaul commented 3 days ago

Copying over my note in https://github.com/WordPress/gutenberg/pull/45994#issuecomment-2454911148 in case this is a better place to converse on the topic:

Noting that I just ran into a project where dropcap's were prominently utilized in the frontend design and having to get all editors/authors to make all the additional clicks to set this on a paragraph block was not the most graceful experience for anyone. While I totally agree that the dropcap setting should not be exposed as a default, at least having the ability in code to do so for a specific site need (e.g. frontend design uses it on intro paragraph on posts) makes for a dramatically better editor experience.

Re-opening for consideration as this feels like a decent "paper cut" sort of simple improvement that may not impact the large majority but for those who do benefit its a much better experience than the current experience.