Keyboard shortcuts with TinyMCE custom styles in Wordpress - possible?

I’ve defined some custom styles as directed in the article here, they work splendidly: https://codex.wordpress.org/TinyMCE_Custom_Styles

However, I’d like to add keyboard shortcuts for these styles, and I’m unclear how to do that. It seems easy enough for custom defined buttons on the toolbar, but I don’t see any way to define them for the styles in the drop down.

I have found this TinyMCE doc, https://www.tiny.cloud/docs/api/tinymce/tinymce.shortcuts, so I know shortcuts are supported, I just don't understand how to map them to a custom style in the dropdown defined as follows:

function myplugin_mce_before_init( $settings ) {
    $style_formats = array(
        array(
            'title' = 'Full Width Paragraph',
            'selector' = 'p',
            'classes' = 'full-width-container'
            ),
    );
    $settings['style_formats'] = json_encode( $style_formats );
    return $settings;
}

Any help would be appreciated.

I should note that this question seems to acheive what I'm looking for, but outside of Wordpress. I'd like to figure out how to do this with custom_styles defined via the WP methodology: https://stackoverflow.com/questions/21307182/tinymce-adding-shortcuts-for-custom-styles

Topic add-editor-style plugin-tinymce tinymce Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.