Designer customization Issue #80
-
|
I customized the designer as shown below, but it has some issues. I’ll provide the code as well. I added a custom button to the designer and hide all the icons in the header toolbar. I placed the custom button in the top-right corner to serve the same purpose as the original Edit/Preview toggle and theme switch button. Now, I need to include the Undo/Redo and Multilanguage buttons. However, I’m unable to access these specific buttons from the designer. When I set hidden: false for these two buttons in builder customization, they don’t appear. These buttons only work when I remove the entire builder customization from the code. const builderCustomizations: CustomizationMap = { and const toggleMode = useCallback(() => { }, [builder]); return {label}; and <FormBuilder |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi, @linesh98 const RenderIn = ({inBuilder, inViewer}: {inBuilder: ReactNode, inViewer: ReactNode}) => {
const {builderMode} = useFormBuilder()
if (builderMode === 'builder') return <>{inBuilder}</>
return <>{inViewer}</>
}
const headerStyle = {display: 'flex', width: '100%', justifyContent: 'flex-end'}
const HeaderWrapper = ({children}: PropsWithChildren) => (
<RenderIn
inBuilder={children}
inViewer={<div style={headerStyle}>{children}</div>}
/>
)
const builderCustomizations: CustomizationMap = {
JsonViewButton: {hidden: true},
MainMenu_Button: {hidden: true},
ResolutionSelect: {hidden: true},
ToggleThemeButton: {hidden: true},
Header_Toolbar: {
customRenderer: defaultEl => <RenderIn inBuilder={defaultEl} inViewer={null}/>},
LocalizationSelect: {
customRenderer: defaultEl => <RenderIn inBuilder={null} inViewer={defaultEl}/>},
ToggleModeButton: {
customRenderer: () => <CustomToggleModeButton/>},
Header: {
customRenderer: defaultEl => <HeaderWrapper>{defaultEl}</HeaderWrapper>
}
} |
Beta Was this translation helpful? Give feedback.
Hi, @linesh98
here is an example of advanced customization, with your case: