From 6b63d53a81c9b17be8685faf9b5fc67e8d78f470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Tue, 10 Dec 2024 15:32:06 +0100 Subject: [PATCH] BUGFIX: Prevent warnings for unrecognized DOM props This change addresses React warnings related to invalid DOM attributes: - Removed `executeCommand` and `formattingUnderCursor` from being passed to DOM elements. - Ensured these props are only handled within components where they are relevant, preventing them from being incorrectly rendered on DOM elements. These update prevent unnecessary warnings in the console. Resolves: #3894 --- .../src/EditorToolbar/Helpers/renderToolbarComponents.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/neos-ui-ckeditor5-bindings/src/EditorToolbar/Helpers/renderToolbarComponents.js b/packages/neos-ui-ckeditor5-bindings/src/EditorToolbar/Helpers/renderToolbarComponents.js index 24fb15ec08..7b74674f06 100644 --- a/packages/neos-ui-ckeditor5-bindings/src/EditorToolbar/Helpers/renderToolbarComponents.js +++ b/packages/neos-ui-ckeditor5-bindings/src/EditorToolbar/Helpers/renderToolbarComponents.js @@ -31,7 +31,7 @@ export default richtextToolbarRegistry => { const restProps = omit(props, ['isVisible', 'isActive']); const isActiveProp = isToolbarItemActive(formattingUnderCursor, inlineEditorOptions)(componentDefinition); - const finalProps = { + let finalProps = { ...restProps, key: index, isActive: isActiveProp, @@ -41,6 +41,11 @@ export default richtextToolbarRegistry => { [callbackPropName]: e => e.stopPropagation() || executeCommand(commandName, ...commandArgs) }; + // filter out props that are not needed by the component and lead to a render warning + if (commandName === 'code') { + finalProps = omit(finalProps, ['executeCommand', 'formattingUnderCursor']); + } + const Component = component; return ;