-
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
Re-rendering after props change adds another toolbar #147
Comments
Try the version from master, Quill 1.x is out of date. |
I'm a bit confused - you say that Quill 1.x is out of date, but I'm looking at https://www.npmjs.com/package/quill, and 1.2 is the latest version. If you're talking about react-quill, I see the latest version is 0.4.1, which is what I'm using. Are you recommending not using the npm published version? |
Sorry, yes, the react-quill package on NPM is pre-1.0 and bundles a pre-1.0 version of Quill. The Github version on master and the releases at https://github.com/alexkrolick/react-quill/releases use Quill 1.x and have a corresponding major version bump. |
I'm looking into feasibility of pointing to github instead of npm in our build system. In the meantime, is there a reason that a more recent version of master isn't being pushed to npm? |
Any major gotcha's I should know about when upgrading to 2.0.1 from 0.4.1? I just did the package.json updates, and getting: document is not defined from line 2377 of quill.js:
|
Are you trying to render on a server or something? Quill depends on some
document APIs; you can browse some of the issues for the react-quill wrapper
and quill upstream that mention this.
![](https://link.nylas.com/open/em0zs7e0r9hzrphf5nhjj19u/local-bb7f59c0-eca1?r
=cmVwbHkrMDAxN2ZiNTM0MTg5NmYxNWY5NGJiZWNjMjU3YTYzYzk1YTZiODUyMmIzNWMxZTlhOTJjZ
jAwMDAwMDAxMTQ5ZmJlMGY5MmExNjljZTBjMTkxYjFlQHJlcGx5LmdpdGh1Yi5jb20=)
Other than that, if you were using the README on master you probably have
already configured it correctly. See release notes for breaking changes.
|
Yes - we do server side rendering. I've disabled that so now it only renders client side, and getting tons of issues w/ the toolbar. I've updated the component to use a module for the toolbar, but it is completely horked. Whenever the textarea is updated, componentDidUpdate is being called, which calls componentDidMount, which calls |
Hey Alex - any update here? Are you fairly certain that the latest commit is stable, and doesn't have issues w/ the toolbar? |
Looking at https://github.com/alexkrolick/react-quill/blob/v2.0.2/src/component.js I'm seeing Are you using a configuration like this: https://github.com/alexkrolick/react-quill#toolbar? It seems like you must be sending one of the "dirty" props in a parent component that would trigger a rerender of the quill container. |
Wow - because I was inlining the module in the declaration, when component.js was doing equality for the dirty props, it was seeing this.props["modules"] as !== prevProps["modules"]. I think the last thing I'm looking at now is it doesn't appear that the newer code supports formats. Is format supposed to go through a module now? I don't see that on quill's docs, however I do see in component.js that setCustomFormats is commented out. New preferred way to set formats for > 1.0?
|
Meh - this appears to be some css that isn't being applied properly. I'm all set now - thanks for the help, closing out bug. |
This is an actual issue that needs to be dealt with. Re-rendering Quill is causing toolbars to multiply exponentially. We're most definitely doing something wrong when re-instantiating Quill. |
I'm having difficulty reproducing this one. In this example with the deprecated component In this one with a custom toolbar ID provided to Quill via the modules prop, it works fine: http://codepen.io/alexkrolick/pen/gmroPj |
@alexkrolick, the issue is not specifically about toolbars, however the symptoms are the same. Check this codepen here, and interact with the editor: http://codepen.io/anon/pen/KWqNbr I am causing Quill to re-render each time by setting a bogus random class on ReactQuill – ideally nothing of the sort should happen. |
The basic problem is that Quill creates uncontrolled DOM elements that don't get cleaned up after a remount/rerender. I can stop the additional of the toolbar by deleting the previous toolbar from the DOM in the |
Will have to pay attention to this change in the unmount/mount ordering coming in React 16: facebook/react#9214 (comment) |
@alexkrolick, good catch. I guess this is a Quill bug actually? So I'd be fine with applying hacks here until it's fixed. |
|
Interestingly I can get a simple example working where React resets the DOM successfully after a props change: http://codepen.io/alexkrolick/pen/yMEXPe I wonder if the issue is the toolbar is being created outside of the DOM element created by React? |
I've updated the Codepen to isolate the problem: https://codepen.io/alexkrolick/pen/yMEXPe?editors=0010 The issue is very much the position of the toolbar in the DOM tree. It's essentially a sibling of the node created by the component, so it sits outside of the tree that React knows about and thus never gets cleaned up by the reconciliation algorithm. |
When pasting elements into quill editor, all formatting is lost if I provide ReactQuill with a formats prop. If I remove the
formats={formats}
, then a copy paste of formatted text inserts properly (still formatted).Below is a snippet of code:
Is this expected? What can I do to debug the issue?
Versions: react-quill: 0.4.1, Quill: 1.2.0
The text was updated successfully, but these errors were encountered: