diff --git a/plugins/ui/src/js/src/widget/WidgetUtils.tsx b/plugins/ui/src/js/src/widget/WidgetUtils.tsx index 09c4b77ec..0247e6270 100644 --- a/plugins/ui/src/js/src/widget/WidgetUtils.tsx +++ b/plugins/ui/src/js/src/widget/WidgetUtils.tsx @@ -35,6 +35,7 @@ import { isCallableNode, CALLABLE_KEY, wrapTextChildren, + isPrimitive, } from '../elements/utils/ElementUtils'; import HTMLElementView from '../elements/HTMLElementView'; import { isHTMLElementNode } from '../elements/utils/HTMLElementUtils'; @@ -160,14 +161,20 @@ export function getComponentForElement(element: ElementNode): React.ReactNode { const Component = getComponentTypeForElement(newElement); if (Component != null) { - const props = + const props = { ...newElement.props }; + if ( shouldWrapTextChildren.has(newElement[ELEMENT_KEY]) && - newElement.props?.children != null - ? { - ...newElement.props, - children: wrapTextChildren(newElement.props.children), - } - : newElement.props; + props?.children != null + ) { + props.children = wrapTextChildren(props.children); + } + if (props?.contextualHelp != null && isPrimitive(props.contextualHelp)) { + props.contextualHelp = ( + + {props.contextualHelp} + + ); + } return ; }