How to pass other props to custom tool

1 Answer 76 Views
Editor
Shane
Top achievements
Rank 2
Iron
Iron
Iron
Shane asked on 03 May 2022, 01:38 PM

I would like to be able to pass props other than view to custom toolbar components. Here is an example of a custom title tip I would like to add to the button. Any idea how I would do something like this?

https://stackblitz.com/edit/react-nmy4tg?file=app/backgroundColorTool.jsx

 

Shane
Top achievements
Rank 2
Iron
Iron
Iron
commented on 03 May 2022, 01:56 PM

And would it be possible to show a tool based on a prop passed in? For example can I pass showBackgroundColorTool = true to show the background color tool and not show it if I passed false to showBackgroundColorTool?
Shane
Top achievements
Rank 2
Iron
Iron
Iron
commented on 03 May 2022, 02:28 PM

I figured it out.


const customClearFormatting = (props) => {
		return (
			<ClearAll {...props} toolTip={messages.editor.cleanFormatting} />
		)
	};

1 Answer, 1 is accepted

Sort by
0
Accepted
Shane
Top achievements
Rank 2
Iron
Iron
Iron
answered on 03 May 2022, 02:30 PM

figured out how to dynamically add to toolbar too. 


const customAddComment = (props) => {
		if (allowComments === true) {
			return (
				<AddComment {...props} toolTip={messages.editor.addCommentButtonTooltip} />
			)
		} else {
			return null;
		}
	};
thanks.
Tags
Editor
Asked by
Shane
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Shane
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or