From 4cd2b3f5c97c0696223bb20134d21e8e52cad329 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 18 Apr 2024 04:43:37 +0000 Subject: [PATCH] Allow extenders to remove additional format types. --- classes/class-handler.php | 4 ++++ src/index.tsx | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/classes/class-handler.php b/classes/class-handler.php index b6005e9..d85af19 100644 --- a/classes/class-handler.php +++ b/classes/class-handler.php @@ -331,6 +331,10 @@ private function get_default_settings() { 'imgur', ], ], + 'unregisterFormatType' => [ + 'core/text-color', + 'core/image', + ], 'editorType' => $this->get_editor_type(), 'allowUrlEmbed' => false, 'pastePlainText' => false, diff --git a/src/index.tsx b/src/index.tsx index ae1c89f..204db61 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -39,9 +39,8 @@ domReady( () => { // Modify any blocks we need to addFilter( 'blocks.registerBlockType', 'blocks-everywhere/modify-blocks', customBlocks ); - // Remove some formatting options - unregisterFormatType( 'core/text-color' ); - unregisterFormatType( 'core/image' ); + // Remove any formatting options we need to disable + wpBlocksEverywhere?.unregisterFormatType.forEach( ( formatType ) => unregisterFormatType( formatType ) ); if ( wpBlocksEverywhere.editorType === 'bbpress' && wpBlocksEverywhere.autocompleter ) { addFilter(