Skip to content

Commit

Permalink
DataViews Extensibility: Add a hook to allow third-party scripts to r…
Browse files Browse the repository at this point in the history
…egister/unregister post type actions (#64138)

Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
  • Loading branch information
4 people authored Aug 2, 2024
1 parent 2218059 commit 6533c32
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 353 deletions.
2 changes: 0 additions & 2 deletions packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { unlock } from './lock-unlock';

const {
BackButton: __experimentalMainDashboardButton,
registerDefaultActions,
registerCoreBlockBindingsSources,
bootstrapBlockBindingsSourcesFromServer,
} = unlock( editorPrivateApis );
Expand Down Expand Up @@ -97,7 +96,6 @@ export function initializeEditor(
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,
} );
}
registerDefaultActions();

// Show a console log warning if the browser is not in Standards rendering mode.
const documentMode =
Expand Down
2 changes: 0 additions & 2 deletions packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { unlock } from './lock-unlock';
import App from './components/app';

const {
registerDefaultActions,
registerCoreBlockBindingsSources,
bootstrapBlockBindingsSourcesFromServer,
} = unlock( editorPrivateApis );
Expand Down Expand Up @@ -59,7 +58,6 @@ export function initializeEditor( id, settings ) {
enableFSEBlocks: true,
} );
}
registerDefaultActions();

// We dispatch actions and update the store synchronously before rendering
// so that we won't trigger unnecessary re-renders with useEffect.
Expand Down

This file was deleted.

185 changes: 0 additions & 185 deletions packages/editor/src/components/document-outline/test/index.js

This file was deleted.

6 changes: 5 additions & 1 deletion packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { decodeEntities } from '@wordpress/html-entities';
import { store as coreStore } from '@wordpress/core-data';
import { __, sprintf, _x } from '@wordpress/i18n';
import { store as noticesStore } from '@wordpress/notices';
import { useMemo, useState } from '@wordpress/element';
import { useMemo, useState, useEffect } from '@wordpress/element';
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
import { parse } from '@wordpress/blocks';
import { DataForm, isItemValid } from '@wordpress/dataviews';
Expand Down Expand Up @@ -589,6 +589,10 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
},
[ postType ]
);
const { registerPostTypeActions } = unlock( useDispatch( editorStore ) );
useEffect( () => {
registerPostTypeActions( postType );
}, [ registerPostTypeActions, postType ] );

const duplicatePostAction = useDuplicatePostAction( postType );
const reorderPagesAction = useReorderPagesAction( postType );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const exportPattern = undefined;

export default exportPattern;
31 changes: 0 additions & 31 deletions packages/editor/src/dataviews/actions/index.ts

This file was deleted.

Loading

0 comments on commit 6533c32

Please sign in to comment.