Add Page Template Body Class to Gutenber Editor

<?php
// add page template body class to admin
function admin_body_template_class( $str_classes ) {
    global $post;
    $template_slug = get_page_template_slug( $post );
    $classes   = explode(' ', $str_classes);
    $classes[] = $template_slug;
    $new_classes = join(' ', $classes);
    $remove_php = '.php';
    $new_str_classes = str_replace( $remove_php, '', $new_classes );
    return $new_str_classes;
}
add_filter( 'admin_body_class', 'admin_body_template_class' );