draft-js-plugins icon indicating copy to clipboard operation
draft-js-plugins copied to clipboard

Headline buttons are broken in the Custom Inline Toolbar Example

Open hongbo-miao opened this issue 9 years ago • 7 comments

These buttons "HeadlineOneButton", "HeadlineTwoButton", "HeadlineThreeButton" are broken in the Custom Inline Toolbar Example.

Tested on Chrome and Firefox.

hongbo-miao avatar Nov 15 '17 03:11 hongbo-miao

#951 PR resolves the problem you reported, sadly the bugfix it's not yet merged.

slobodanl avatar Dec 04 '17 08:12 slobodanl

@slobodanl: Thanks for the PR, hoping for it to be merged soon.

Will the PR https://github.com/draft-js-plugins/draft-js-plugins/pull/951 solve the case when overrideContent is not used?

In this sandbox I have a button wherein I just want to have an alert show up when it is clicked but the click goes right through it.

Any ideas?

divyenduz avatar Dec 08 '17 08:12 divyenduz

@divyenduz PR #951 effectively resolves the problem with overrideContent functionality case when you want to render custom component as result of toolbar button onClick. I don't think that your specific use case will be supported, nevertheless, I don't think that alerting is useful by itself so maybe what you are actually up for is rendering custom content in the inline toolbar?

slobodanl avatar Dec 11 '17 08:12 slobodanl

What I actually want to achieve is this - which is to enter a custom block mode when I click an inline toolbar button.

But I am not able to get the click callback right, I might be doing something stupid. This is where I was just trying to add a custom inline button to the inline toolbar but the click just goes through the button.

divyenduz avatar Dec 11 '17 08:12 divyenduz

@divyenduz Please take a look into https://www.draft-js-plugins.com/plugin/image , Add Image Button Example for some ideas how you can employ custom button to insert a new custom block into the draft editor. In case of the inline plugin, this can be reworked as a custom button that will render custom component with input and ADD button using overrideContent functionality and on ADD onClick call the appropriate plugin modifier e.g. addImage. I suggest to take a moment and review some source code in Video or Image plugin.

Hope this comment helps you.

slobodanl avatar Dec 11 '17 10:12 slobodanl

Thanks for the detailed comment, in my case, I do not want to use the overrideContent but directly enter the custom block mode, but the first click as I have demonstrated in my example, just passes through the inline toolbar. I will revisit this shortly and share my findings.

divyenduz avatar Dec 13 '17 12:12 divyenduz

@slobodanl, Is there any hope that this PR #951 will be merged soon?

sa-adebayo avatar Mar 07 '18 09:03 sa-adebayo