![]() ![]() Can be a string containing HTML, a Quill Delta instance, or a plain object representing a Delta. ![]() : Value for the editor as a controlled component. : Classes to be applied to the DOM element. : The Quill namespace on which you can call register. * * Custom "star" icon for the toolbar using an Octicon * */ const CustomButton = ( ) => /* * Event handler to be attached using Quill toolbar module * */ function insertStar ( ) = ReactQuill To activate a theme, pass the name of the theme to the theme prop. At the very least, the core theme must be included for modules like toolbars or tooltips to work. It includes a full-fledged theme, called snow, that is Quill's standard appearance, and a bubble theme that is similar to the inline editor on Medium. ReactQuill will prevent you from making such a mistake, however if you are absolutely sure that this is what you want, you can pass the object through new Delta() again to un-taint it. Use editor.getContents() during the event to obtain a Delta of the full document instead. This object does not contain the full document, but only the last modifications, and doing so will most likely trigger an infinite loop where the same changes are applied over and over again. ⚠️ Do not use the delta object you receive from the onChange event as value. Note that switching value from an HTML string to a Delta, or vice-versa, will trigger a change, regardless of whether they represent the same document, so you might want to stick to a format and keep using it consistently throughout. Be aware, however, that comparing Deltas for changes is more expensive than comparing HTML strings, so it might be worth to profile your usage patterns. Deltas have a number of advantages over HTML strings, so you might want use them instead. You can pass a Quill Delta, instead of an HTML string, as the value and defaultValue properties. Read more about uncontrolled components in the React docs. The onChange callback will still work as expected. ReactQuill will initialize the editor using defaultValue, but won't try to reset it after that. If you frequently need to manipulate the DOM or use the Quill APIs imperatively, you might consider switching to fully uncontrolled mode. It can't prevent the change, but will still override the content whenever value differs from current state. In controlled mode, components are supposed to prevent local stateful changes, and instead only have them happen through onChange and value.īecause Quill handles its own changes, and does not allow preventing edits, ReactQuill has to settle for a hybrid between controlled and uncontrolled mode. See the documentation on themes for more information. Make sure you have react and react-dom, and some way to load styles, like style-loader. Quick Start With webpack or create-react-app We expect this release to be a drop-in upgrade – if that isn't the case, please file an issue with the v2 label. However, support for long-deprecated props, the ReactQuill Mixin, and the Toolbar component have been removed. For the vast majority of the cases, no migration is necessary at all. We worked hard to avoid introducing any behavioral changes. ReactQuill 2 is here, baby! And it brings a full port to TypeScript and React 16+, a refactored build system, and a general tightening of the internal logic. This is the documentation for ReactQuill v2 - Previous releases: v1
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |