Skip to content

Commit

Permalink
Move code
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed Jul 4, 2024
1 parent f52ccb3 commit f1f4b43
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/editor/src/hooks/block-bindings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/**
* Internal dependencies
*/
import {
canBindAttribute,
getBindableAttributes,
} from './use-bindings-attributes';
import { unlock } from '../lock-unlock';
import { store as editorStore } from '../store';

/**
* WordPress dependencies
*/
Expand All @@ -12,17 +22,10 @@ import {
} from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import { plus, reset } from '@wordpress/icons';
import { InspectorControls } from '@wordpress/block-editor';

/**
* Internal dependencies
*/
import {
canBindAttribute,
getBindableAttributes,
} from './use-bindings-attributes';
import { unlock } from '../lock-unlock';
import { store as blockEditorStore } from '../store';
InspectorControls,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { addFilter } from '@wordpress/hooks';
import { createHigherOrderComponent } from '@wordpress/compose';

Expand Down Expand Up @@ -60,7 +63,7 @@ const BlockBindingsPanel = ( { name, metadata } ) => {
} );
const postMeta = useSelect( ( select ) => {
// eslint-disable-next-line @wordpress/data-no-store-string-literals
return select( 'core/editor' ).getEditedPostAttribute( 'meta' );
return select( editorStore ).getEditedPostAttribute( 'meta' );
}, [] );

const { updateBlockAttributes } = useDispatch( blockEditorStore );
Expand Down Expand Up @@ -214,6 +217,7 @@ const BlockBindingsPanel = ( { name, metadata } ) => {
* @return {Component} Wrapped component.
*/
const withBlockBindings = createHigherOrderComponent(
// Prevent this from running on every write block.
( BlockEdit ) => ( props ) => {
const bindableAttributes = getBindableAttributes( props?.name );
return (
Expand Down

0 comments on commit f1f4b43

Please sign in to comment.