Skip to content

Commit

Permalink
Update default web editor action label via WP hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot committed Sep 15, 2023
1 parent 4c645ac commit 6e64270
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useSelect } from '@wordpress/data';
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
import { getBlockType, serialize } from '@wordpress/blocks';
import { useCallback, useState } from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';

/**
* Internal dependencies
Expand Down Expand Up @@ -129,14 +130,19 @@ const UnsupportedBlockDetails = ( {
onCloseSheet,
] );

const webEditorDefaultLabel = applyFilters(
'native.unsupported_block_details_web_editor_action',
__( 'Edit using web editor' )
);

const canUseWebEditor =
( isUnsupportedBlockEditorSupported ||
canEnableUnsupportedBlockEditor ) &&
isEditableInUnsupportedBlockEditor;
const actions = [
...[
canUseWebEditor && {
label: actionButtonLabel || __( 'Edit using web editor' ),
label: actionButtonLabel || webEditorDefaultLabel,
onPress: requestFallback,
},
],
Expand Down

0 comments on commit 6e64270

Please sign in to comment.