Skip to content

Commit 6fcd212

Browse files
jeryjjeryjyouknowriadMamadukacbravobernal
authored andcommitted
Check for RichText bindings from context instead of new subscription (#72496)
Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: cbravobernal <cbravobernal@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
1 parent a66a55c commit 6fcd212

File tree

1 file changed

+5
-11
lines changed
  • packages/block-editor/src/components/rich-text

1 file changed

+5
-11
lines changed

packages/block-editor/src/components/rich-text/index.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { getAllowedFormats } from './utils';
4141
import { Content, valueToHTMLString } from './content';
4242
import { withDeprecations } from './with-deprecations';
4343
import BlockContext from '../block-context';
44+
import { PrivateBlockContext } from '../block-list/private-block-context';
4445

4546
export const keyboardShortcutContext = createContext();
4647
keyboardShortcutContext.displayName = 'keyboardShortcutContext';
@@ -124,9 +125,10 @@ export function RichTextWrapper(
124125
const instanceId = useInstanceId( RichTextWrapper );
125126
const anchorRef = useRef();
126127
const context = useBlockEditContext();
127-
const { clientId, isSelected: isBlockSelected, name: blockName } = context;
128+
const { clientId, isSelected: isBlockSelected } = context;
128129
const blockBindings = context[ blockBindingsKey ];
129130
const blockContext = useContext( BlockContext );
131+
const { bindableAttributes } = useContext( PrivateBlockContext );
130132
const registry = useRegistry();
131133
const selector = ( select ) => {
132134
// Avoid subscribing to the block editor store if the block is not
@@ -171,15 +173,7 @@ export function RichTextWrapper(
171173

172174
const { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = useSelect(
173175
( select ) => {
174-
const { __experimentalBlockBindingsSupportedAttributes } =
175-
select( blockEditorStore ).getSettings();
176-
177-
if (
178-
! blockBindings?.[ identifier ] ||
179-
! (
180-
blockName in __experimentalBlockBindingsSupportedAttributes
181-
)
182-
) {
176+
if ( ! blockBindings?.[ identifier ] || ! bindableAttributes ) {
183177
return {};
184178
}
185179

@@ -252,7 +246,7 @@ export function RichTextWrapper(
252246
[
253247
blockBindings,
254248
identifier,
255-
blockName,
249+
bindableAttributes,
256250
adjustedValue,
257251
clientId,
258252
blockContext,

0 commit comments

Comments
 (0)