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

Question/Suggestion; Drop 'Drop Cap' feature #6184

Closed
JeroenSormani opened this issue Apr 15, 2018 · 20 comments
Closed

Question/Suggestion; Drop 'Drop Cap' feature #6184

JeroenSormani opened this issue Apr 15, 2018 · 20 comments
Labels
[Type] Question Questions about the design or development of the editor.

Comments

@JeroenSormani
Copy link

JeroenSormani commented Apr 15, 2018

Overview

I've searched a bit around, but couldn't find any resources on this. My main question here is;

  • Where does the need for a 'Drop cap' feature come from?

Doing some research it doesn't seem there's any real need for this feature. The most used WP plugin has only 7,000 active installs, and a post by WP Beginner (first Google result) has 4 comments > which to me indicates there's very little interest for such option.

Only reasonable explanation I can imagine is to have a example of a checkbox/toggle option (which would be a bad reason to leave this in, IMHO)


I'd love to learn more about why this was added, or if there's no real reason / need, propose it to be removed.

@noisysocks noisysocks added the [Type] Question Questions about the design or development of the editor. label Apr 16, 2018
@davisshaver
Copy link
Contributor

@JeroenSormani Medium has the feature.
2018-04-19 16_35_24

@JeroenSormani
Copy link
Author

I hope that isn't the only/best argument for adding the feature 😅

So I've not seen the point in adding a feature like this for all while used by little. Its just a waste of space / setting and effort in BC in the future (when people realize it shouldn't be a setting anymore 🤔)

In my mind adding such feature without real demand / need would mean leaving a door open for other useless settings that little use.
I see drop capping is a theme/style thing, not a content thing.

@danielbachhuber
Copy link
Member

Hi @JeroenSormani,

Thanks for the suggestion! At this point, we're unlikely to remove the drop cap feature. However, we appreciate you taking the time to open this issue, and support your suggestion with research.

@JeroenSormani
Copy link
Author

@danielbachhuber I'd love to get to know the thinking behind the feature though - is it indeed solely because Medium has it? I couldn't find a path back to where the idea came from, so I can't ask directly to anyone 🤔

My own thinking is that this time (pre WP include) would be the best time possible time to deprecate a feature like this. Doing when its in WP core will likely never happen or bring bigger pains for the people involved with it at that time.

@chrisvanpatten
Copy link
Contributor

I suppose it's far too late for this, but this does feel like something that should be enabled via add_theme_support, not on-by-default.

@JeroenSormani
Copy link
Author

I wouldn't say its too late, with the GB plugin active installs 'only' being at 10,000 (~ish) the impact of users using the drop cap feature is very minimal. If you wait till its in WP Core you'll have a real nightmare at hand removing it.

@rickcurran
Copy link

Is there a way to disable the drop caps feature? I also question the inclusion of this feature, however as long as there is a way to disable it (and other text settings) then this is fine. However, I'm struggling to find information about disabling specific options. I regularly remove features like text colouring, sizing etc from the classic editor to prevent clients from getting "creative" with their type colours and sizes so I'd see these abilities as really important in my development / deployment workflow.

@andymb
Copy link

andymb commented Nov 22, 2018

It’s actually a showstopper for me. I code for three designers and none wants to move to Gutenberg unless I can kill the drop caps in the editor.

@adriantoll
Copy link

adriantoll commented Jun 28, 2019

For those like me who ended up here while looking for a way to disable the drop cap toggle (which seems a very esoteric thing to include in core without at the very least an easy way to disable it), there are potentially related discussions going on here - #15450 about a consistent way of controlling common block functionality. However, I'm not entirely sure that this will be dealt with there, given that it seems pretty specific to the paragraph block type.

Because there's no clear resolution in sight, this is what I've done for now:

add_action('admin_head', 'biro_gutenberg_remove_drop_cap');
function biro_gutenberg_remove_drop_cap() {
    echo '<style>.blocks-font-size .components-base-control:first-of-type { margin-bottom: 0; } .blocks-font-size .components-toggle-control { display: none; }</style>';
}

Being relatively new to Gutenberg I'm not entirely sure whether it will have knock-on effects in other areas. The class names are pretty generic, so it's not specifically targeting the drop cap field, just a toggle control in a blocks-font-size block.

@thowmas
Copy link

thowmas commented Sep 3, 2019

Thanks @adriantoll; Try as I might, I found no combination of supplied filter, unregisterBlockStyle, etc that would achieve this. As dirty as it feels, forcing a hide via your editor css is the only way I could remove Drop Caps...

@jamiemitchell
Copy link

add_action('admin_head', 'biro_gutenberg_remove_drop_cap');
function biro_gutenberg_remove_drop_cap() {
    echo '<style>.blocks-font-size .components-base-control:first-of-type { margin-bottom: 0; } .blocks-font-size .components-toggle-control { display: none; }</style>';
}

The above mentioned solution is brilliant. I'm in the process of removing all the core blocks, font sizes/colors etc and only adding in the few I want. There are a few little options which can't be removed like the dropcaps, but hiding it works for me.

@kingkero
Copy link

add_action('admin_head', 'biro_gutenberg_remove_drop_cap');
function biro_gutenberg_remove_drop_cap() {
    echo '<style>.blocks-font-size .components-base-control:first-of-type { margin-bottom: 0; } .blocks-font-size .components-toggle-control { display: none; }</style>';
}

This didn't work anymore for me (WP 5.5.1, Gutenberg 9.0.0). And from a first look there are no fitting CSS selectors to do this anymore. Waiting for theme.json to be finalized to remove this.

@joppuyo
Copy link

joppuyo commented Sep 20, 2020

Looks like an experimental feature was added in WordPress 5.5 that can be used to disable the drop cap, I created a plugin that accomplishes this: https://github.com/joppuyo/remove-drop-cap

@LeoSeyers
Copy link

I suppose it's far too late for this, but this does feel like something that should be enabled via add_theme_support, not on-by-default.

mehh, it's almost 2021 and still not implemented, feels bad

@jenswittmann
Copy link

Thanks @joppuyo ! The following does the trick.

add_filter("block_editor_settings", function ($editor_settings) {
    $editor_settings["__experimentalFeatures"]["global"]["typography"][
        "dropCap"
    ] = false;
    return $editor_settings;
});

@adriantoll
Copy link

@jenswittmann ... until this gets move out of __experimentalFeatures! Rather like my initial dirty CSS hack and WP 5.5.1.

If this is approved and moved out of __experimentalFeatures, is there a pre-agreed location where this setting will end up, or a transition period during which there will be a warning in the JS console that it's about to be moved and a pointer to where it will end up?

I'm using a variation of the JS version in the plugin by @joppuyo and I'd rather know now instead of spend time scrabbling around to fix it on production sites when it's moved in a future version of WP.

@carasmo
Copy link

carasmo commented Feb 4, 2021

The css in the admin head stopped working.

@adriantoll
Copy link

Per @joppuyo at https://siipo.la/blog/disable-drop-cap-in-wordpress-5-5 the javascript version stopped working too, and the only way I currently know is through some PHP detailed in that blog post (in the version below I use a function attached to a filter for ease of debugging):

function yournamespace_remove_drop_cap ( $editor_settings ) {
  $editor_settings['__experimentalFeatures']['global']['typography']['dropCap'] = false;
  return $editor_settings;
}
add_filter( 'block_editor_settings', 'yournamespace_remove_drop_cap' );

@mike-sheppard
Copy link

aaand now from WP 5.7 it looks like global needs to be defaults...

add_filter('block_editor_settings', function ($editor_settings) {
    $editor_settings['__experimentalFeatures']['defaults']['typography']['dropCap'] = false;
    return $editor_settings;
});

@joppuyo
Copy link

joppuyo commented Nov 4, 2021

In WordPress 5.8, you should be able to use the new theme.json feature to disable the drop cap. Just add a file called theme.json in rhe root of your theme with the following content:

{
    "version": 1,
    "settings": {
        "typography": {
            "dropCap": false
        }
    }
}

But if you want to use a plugin, you can now find my plugin on the WordPress plugin directory:

https://wordpress.org/plugins/disable-drop-cap/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Question Questions about the design or development of the editor.
Projects
None yet
Development

No branches or pull requests