Skip to content

Commit

Permalink
Re-add embed blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
amarie4224 committed Nov 14, 2024
1 parent c6db2ea commit 3e0756b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion assets/js/block-filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*/

// Import the block filter file.
import './unregister-core-embed';
import './unregister-core-blocks';
import './buttons';
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ document.addEventListener('DOMContentLoaded', function () {
// },
];

// Keep only the necessary embed variations.
const embedBlockVariations = wp.blocks.getBlockVariations('core/embed');
const keepEmbeds = [
'twitter',
'wordpress',
'spotify',
'soundcloud',
'flickr',
];

// Unregister unused blocks.
unusedBlocks.forEach((block) => {
wp.blocks.unregisterBlockType(block);
Expand All @@ -46,16 +36,6 @@ document.addEventListener('DOMContentLoaded', function () {
variation.blockVariationName
);
});

// Keep only necessary embed variations.
embedBlockVariations.forEach((variation) => {
if (!keepEmbeds.includes(variation.name)) {
wp.blocks.unregisterBlockVariation(
'core/embed',
variation.name
);
}
});
} else {
// eslint-disable-next-line no-console
console.error('wp.blocks object is not available.');
Expand Down

0 comments on commit 3e0756b

Please sign in to comment.