-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown default values not working with custom JSX toolbar #175
Comments
EDIT: Ok I see there is an issue here. Dropping a link to the relevant Quill modules for investigation: https://github.com/quilljs/quill/blob/develop/modules/toolbar.js |
Here's a side-by-side of the different toolbar options: https://codepen.io/alexkrolick/pen/BWVNYx?editors=0010 The JSX custom toolbar option is definitely doing something a little differently than the uncontrolled way - note extra bottom border between the elements. |
@alexkrolick Nice side-by-side, shows the problem really well. I got hit by #147 too at some point but moved away to JSX toolbar which sorted it. Had to move anyway to get more control over it as I am placing some custom markers/icons inside it. |
Note that is possible to have some control over the appearance of the icons Quill creates with the toolbar prop. Use CSS to target Will continue looking into the issue. |
Some additional debugging notes: This line requires one of the If it is missing, the default item will not get the And finally, the defaultItem will not exist here: https://github.com/quilljs/quill/blob/develop/ui/icon-picker.js#L11-L18 Demo: https://codepen.io/alexkrolick/pen/qjMrEN?editors=0010 Note that setting So... it seems the main thing to do is figure out a way to 1) get React to stop swallowing the NOTE: React doesn't allow setting |
@alexkrolick I am coming from another project (https://www.primefaces.org/) which is heavily used by enterprise since your change seems broke our code (primefaces/primefaces#2802), and I have raised another ticket in quill slab/quill#1762 |
💯 I think this can be fixed by adding some hints for React's event system: <select defaultValue={""} onChange={e => e.persist()}> |
Hi @alexkrolick - I'm trying to wrap Quill in a React component for my own custom implementation and I cannot cannot figure out why Here's a streamlined example demonstrating the bug: https://codepen.io/coxandrew/pen/xjxXmy?editors=1011 I've tried with and without jsx toolbar components and about every combination of I have another CodePen that uses a forked version of Quill with this attempted fix, but that doesn't work with my React version either: https://codepen.io/coxandrew/pen/YLzvwJ?editors=0011 Any ideas on what might be different about |
@coxandrew seems to work when I upgrade your Pen to React 16: https://codepen.io/alexkrolick/pen/KRKYLw?editors=1011 |
@alexkrolick Aha! Thanks for the quick response! We may not be able to upgrade to React 16 immediately, but at least we have a path forward. |
Expected:
When you select a text with "normal" font size, the dropdown should reflect that selection.
Actual:
Dropdown shows "large" or "small" but never goes back to "normal". It looks to be only happening with manually created HTML toolbar and only with React. Tired modding official Quill codepen to manual toolbar and it works there with plain HTML.
I assume this is because of the way React handles select tags - https://facebook.github.io/react/docs/forms.html#the-select-tag
I have tried using defaultValue on select etc. but no luck.
http://codepen.io/kamas06/pen/EWLpKm
Quill version:
The text was updated successfully, but these errors were encountered: