{"id":13398839,"url":"https://github.com/zenoamaro/react-quill","last_synced_at":"2025-05-12T03:39:29.452Z","repository":{"id":22968803,"uuid":"26318730","full_name":"zenoamaro/react-quill","owner":"zenoamaro","description":"A Quill component for React.","archived":false,"fork":false,"pushed_at":"2025-02-22T19:33:37.000Z","size":4259,"stargazers_count":6913,"open_issues_count":424,"forks_count":936,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-05-09T08:41:17.860Z","etag":null,"topics":["editor","quill","react","rich-text-editor","wysiwyg-editor"],"latest_commit_sha":null,"homepage":"https://zenoamaro.github.io/react-quill","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zenoamaro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-11-07T12:25:40.000Z","updated_at":"2025-05-09T08:34:44.000Z","dependencies_parsed_at":"2023-01-14T01:00:15.860Z","dependency_job_id":"a3fd618b-df9a-4cfe-8a24-a691e6ceddff","html_url":"https://github.com/zenoamaro/react-quill","commit_stats":{"total_commits":383,"total_committers":57,"mean_commits":6.719298245614035,"dds":0.608355091383812,"last_synced_commit":"91aa93f4f909c2b8023657d8ee3669a0990be891"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenoamaro%2Freact-quill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenoamaro%2Freact-quill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenoamaro%2Freact-quill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenoamaro%2Freact-quill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenoamaro","download_url":"https://codeload.github.com/zenoamaro/react-quill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253669227,"owners_count":21945062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editor","quill","react","rich-text-editor","wysiwyg-editor"],"created_at":"2024-07-30T19:00:32.121Z","updated_at":"2025-05-12T03:39:29.425Z","avatar_url":"https://github.com/zenoamaro.png","language":"JavaScript","funding_links":[],"categories":["React","UI Components","Uncategorized","JavaScript","Rich text editor","Demos","基于 React","\u003csummary\u003eUI Components\u003c/summary\u003e","Editor","For React"],"sub_categories":["Form Components","Uncategorized"],"readme":"ReactQuill [![Build Status](https://travis-ci.org/zenoamaro/react-quill.svg?branch=master)](https://travis-ci.org/zenoamaro/react-quill) [![npm](https://img.shields.io/npm/v/react-quill.svg)](https://www.npmjs.com/package/react-quill)\n[![npm downloads](https://img.shields.io/npm/dt/react-quill.svg?maxAge=2592000)](http://www.npmtrends.com/react-quill)\n==============================================================================\n\nA [Quill] component for [React].\n\n\u003e **2025 Note**\n\u003e \n\u003e You probably don't need this library to use Quill with React. See https://quilljs.com/playground/react\n\nSee a [live demo] or [Codepen](http://codepen.io/alexkrolick/pen/xgyOXQ/left?editors=0010#0).\n\n[quill]: https://quilljs.com\n[react]: https://facebook.github.io/react/\n[live demo]: https://zenoamaro.github.io/react-quill/\n\n- [Quick Start](#quick-start)\n  - [With webpack or create-react-app](#with-webpack-or-create-react-app)\n  - [With the browser bundle](#with-the-browser-bundle)\n- [Usage](#usage)\n  - [Controlled mode caveats](#controlled-mode-caveats)\n  - [Using Deltas](#using-deltas)\n  - [Themes](#themes)\n  - [Custom Toolbar](#custom-toolbar)\n    - [Default Toolbar Elements](#default-toolbar-elements)\n    - [HTML Toolbar](#html-toolbar)\n  - [Custom Formats](#custom-formats)\n  - [Custom editing area](#custom-editing-area)\n- [Upgrading to ReactQuill v2](#upgrading-to-reactquill-v2)\n  - [Deprecated props](#deprecated-props)\n  - [ReactQuill Mixin](#reactquill-mixin)\n  - [Toolbar component](#toolbar-component)\n- [API reference](#api-reference)\n  - [Exports](#exports)\n  - [Props](#props)\n  - [Methods](#methods)\n  - [The unprivileged editor](#the-unprivileged-editor)\n- [Building and testing](#building-and-testing)\n- [Browser support](#browser-support)\n- [Changelog](#changelog)\n- [Contributors](#contributors)\n- [License](#license)\n\n---\n\nThis is the documentation for ReactQuill v2 — Previous releases: [v1](/../../tree/v1)\n\n---\n\n💯 **ReactQuill v2**\n\nReactQuill 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.\n\nWe worked hard to avoid introducing any behavioral changes. For the vast majority of the cases, no migration is necessary at all. However, support for long-deprecated props, the ReactQuill Mixin, and the Toolbar component have been removed. Be sure to read the [migration guide](#upgrading-to-reactquill-v2).\n\nWe expect this release to be a drop-in upgrade – if that isn't the case, please [file an issue](/../../issues/new) with the `v2` label.\n\n---\n\n## Quick Start\n\n### With webpack or create-react-app\n\nMake sure you have `react` and `react-dom`, and some way to load styles, like [style-loader](https://www.npmjs.com/package/style-loader). See the documentation on [themes](#themes) for more information.\n\n```sh\nnpm install react-quill --save\n```\n\n```jsx\nimport React, { useState } from 'react';\nimport ReactQuill from 'react-quill';\nimport 'react-quill/dist/quill.snow.css';\n\nfunction MyComponent() {\n  const [value, setValue] = useState('');\n\n  return \u003cReactQuill theme=\"snow\" value={value} onChange={setValue} /\u003e;\n}\n```\n\n### With the browser bundle\n\n```html\n\u003clink\n  rel=\"stylesheet\"\n  href=\"https://unpkg.com/react-quill@1.3.3/dist/quill.snow.css\"\n/\u003e\n```\n\n```html\n\u003cscript\n  src=\"https://unpkg.com/react@16/umd/react.development.js\"\n  crossorigin\n\u003e\u003c/script\u003e\n\u003cscript\n  src=\"https://unpkg.com/react-dom@16/umd/react-dom.development.js\"\n  crossorigin\n\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/react-quill@1.3.3/dist/react-quill.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/babel-standalone@6/babel.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/babel\" src=\"/my-scripts.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n### Controlled mode caveats\n\nIn controlled mode, components are supposed to prevent local stateful changes, and instead only have them happen through `onChange` and `value`.\n\nBecause Quill handles its own changes, and does not allow preventing edits, ReactQuill has to settle for a hybrid between controlled and uncontrolled mode. It can't prevent the change, but will still override the content whenever `value` differs from current state.\n\nIf you frequently need to manipulate the DOM or use the [Quill API](https://quilljs.com/docs/api/)s imperatively, you might consider switching to fully uncontrolled mode. ReactQuill will initialize the editor using `defaultValue`, but won't try to reset it after that. The `onChange` callback will still work as expected.\n\nRead more about uncontrolled components in the [React docs](https://facebook.github.io/react/docs/uncontrolled-components.html#default-values).\n\n### Using Deltas\n\nYou can pass a [Quill Delta](https://quilljs.com/docs/delta/), instead of an HTML string, as the `value` and `defaultValue` properties. Deltas have a number of advantages over HTML strings, so you might want use them instead. 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.\n\nNote 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.\n\n⚠️ Do not use the `delta` object you receive from the `onChange` event as `value`. 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. Use `editor.getContents()` during the event to obtain a Delta of the full document instead. 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.\n\n### Themes\n\nThe Quill editor supports [themes](http://quilljs.com/docs/themes/). 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. At the very least, the _core_ theme must be included for modules like toolbars or tooltips to work.\n\nTo activate a theme, pass the name of the theme to the `theme` [prop](#props). Pass a falsy value (eg. `null`) to use the core theme.\n\n```jsx\n\u003cReactQuill theme=\"snow\" .../\u003e\n```\n\nThen, import the stylesheet for the themes you want to use.\n\nThis may vary depending how application is structured, directories or otherwise. For example, if you use a CSS pre-processor like SASS, you may want to import that stylesheet inside your own. These stylesheets can be found in the Quill distribution, but for convenience they are also linked in ReactQuill's `dist` folder.\n\nHere's an example using [style-loader](https://www.npmjs.com/package/style-loader) for Webpack, or `create-react-app`, that will automatically inject the styles on the page:\n\n```jsx\nimport 'react-quill/dist/quill.snow.css';\n```\n\nThe styles are also available via CDN:\n\n```html\n\u003clink\n  rel=\"stylesheet\"\n  href=\"https://unpkg.com/react-quill@1.3.3/dist/quill.snow.css\"\n/\u003e\n```\n\n### Custom Toolbar\n\n#### Default Toolbar Elements\n\nThe [Quill Toolbar Module](http://quilljs.com/docs/modules/toolbar/) API provides an easy way to configure the default toolbar icons using an array of format names.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample Code\u003c/summary\u003e\n\n```jsx\nclass MyComponent extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      text: \"\",\n    }\n  }\n\n  modules = {\n    toolbar: [\n      [{ 'header': [1, 2, false] }],\n      ['bold', 'italic', 'underline','strike', 'blockquote'],\n      [{'list': 'ordered'}, {'list': 'bullet'}, {'indent': '-1'}, {'indent': '+1'}],\n      ['link', 'image'],\n      ['clean']\n    ],\n  },\n\n  formats = [\n    'header',\n    'bold', 'italic', 'underline', 'strike', 'blockquote',\n    'list', 'bullet', 'indent',\n    'link', 'image'\n  ],\n\n  render() {\n    return (\n      \u003cdiv className=\"text-editor\"\u003e\n        \u003cReactQuill theme=\"snow\"\n                    modules={this.modules}\n                    formats={this.formats}\u003e\n        \u003c/ReactQuill\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nexport default MyComponent;\n```\n\n\u003c/details\u003e\n\n#### HTML Toolbar\n\nYou can also supply your own HTML/JSX toolbar with custom elements that are not part of the Quill theme.\n\nSee this example live on Codepen: [Custom Toolbar Example](https://codepen.io/alexkrolick/pen/gmroPj?editors=0010)\n\n\u003cdetails\u003e\n\u003csummary\u003eExample Code\u003c/summary\u003e\n\n```jsx\n/*\n * Custom \"star\" icon for the toolbar using an Octicon\n * https://octicons.github.io\n */\nconst CustomButton = () =\u003e \u003cspan className=\"octicon octicon-star\" /\u003e;\n\n/*\n * Event handler to be attached using Quill toolbar module\n * http://quilljs.com/docs/modules/toolbar/\n */\nfunction insertStar() {\n  const cursorPosition = this.quill.getSelection().index;\n  this.quill.insertText(cursorPosition, '★');\n  this.quill.setSelection(cursorPosition + 1);\n}\n\n/*\n * Custom toolbar component including insertStar button and dropdowns\n */\nconst CustomToolbar = () =\u003e (\n  \u003cdiv id=\"toolbar\"\u003e\n    \u003cselect\n      className=\"ql-header\"\n      defaultValue={''}\n      onChange={(e) =\u003e e.persist()}\n    \u003e\n      \u003coption value=\"1\"\u003e\u003c/option\u003e\n      \u003coption value=\"2\"\u003e\u003c/option\u003e\n      \u003coption selected\u003e\u003c/option\u003e\n    \u003c/select\u003e\n    \u003cbutton className=\"ql-bold\"\u003e\u003c/button\u003e\n    \u003cbutton className=\"ql-italic\"\u003e\u003c/button\u003e\n    \u003cselect className=\"ql-color\"\u003e\n      \u003coption value=\"red\"\u003e\u003c/option\u003e\n      \u003coption value=\"green\"\u003e\u003c/option\u003e\n      \u003coption value=\"blue\"\u003e\u003c/option\u003e\n      \u003coption value=\"orange\"\u003e\u003c/option\u003e\n      \u003coption value=\"violet\"\u003e\u003c/option\u003e\n      \u003coption value=\"#d0d1d2\"\u003e\u003c/option\u003e\n      \u003coption selected\u003e\u003c/option\u003e\n    \u003c/select\u003e\n    \u003cbutton className=\"ql-insertStar\"\u003e\n      \u003cCustomButton /\u003e\n    \u003c/button\u003e\n  \u003c/div\u003e\n);\n\n/*\n * Editor component with custom toolbar and content containers\n */\nclass Editor extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = { editorHtml: '' };\n    this.handleChange = this.handleChange.bind(this);\n  }\n\n  handleChange(html) {\n    this.setState({ editorHtml: html });\n  }\n\n  render() {\n    return (\n      \u003cdiv className=\"text-editor\"\u003e\n        \u003cCustomToolbar /\u003e\n        \u003cReactQuill\n          onChange={this.handleChange}\n          placeholder={this.props.placeholder}\n          modules={Editor.modules}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\n/*\n * Quill modules to attach to editor\n * See http://quilljs.com/docs/modules/ for complete options\n */\nEditor.modules = {\n  toolbar: {\n    container: '#toolbar',\n    handlers: {\n      insertStar: insertStar,\n    },\n  },\n};\n\n/*\n * Quill editor formats\n * See http://quilljs.com/docs/formats/\n */\nEditor.formats = [\n  'header',\n  'font',\n  'size',\n  'bold',\n  'italic',\n  'underline',\n  'strike',\n  'blockquote',\n  'list',\n  'bullet',\n  'indent',\n  'link',\n  'image',\n  'color',\n];\n\n/*\n * PropType validation\n */\nEditor.propTypes = {\n  placeholder: React.PropTypes.string,\n};\n\n/*\n * Render component on page\n */\nReactDOM.render(\n  \u003cEditor placeholder={'Write something or insert a star ★'} /\u003e,\n  document.querySelector('.app')\n);\n```\n\n\u003c/details\u003e\n\n### Custom Formats\n\nThe component has two types of formats:\n\n1. The default [Quill formats](http://quilljs.com/docs/formats/) that are enabled/disabled using the [`formats` prop](#props). All formats are enabled by default.\n2. Custom formats created using Parchment and registered with your component's Quill instance\n\n\u003cdetails\u003e\n\u003csummary\u003eExample Code\u003c/summary\u003e\n\n```js\nimport ReactQuill, { Quill } from 'react-quill'; // ES6\nconst ReactQuill = require('react-quill'); // CommonJS\n```\n\n```jsx\n/*\n * Example Parchment format from\n * https://quilljs.com/guides/cloning-medium-with-parchment/\n * See the video example in the guide for a complex format\n */\nlet Inline = Quill.import('blots/inline');\nclass BoldBlot extends Inline {}\nBoldBlot.blotName = 'bold';\nBoldBlot.tagName = 'strong';\nQuill.register('formats/bold', BoldBlot);\n\nconst formats = ['bold']; // add custom format name + any built-in formats you need\n\n/*\n * Editor component with default and custom formats\n */\nclass MyComponent extends React.Component {\n  constructor(props) {\n    this.formats = formats;\n    this.state = { text: '' };\n  }\n\n  handleChange(value) {\n    this.setState({ text: value });\n  }\n\n  render() {\n    return (\n      \u003cReactQuill\n        value={this.state.text}\n        onChange={this.handleChange}\n        formats={this.formats}\n      /\u003e\n    );\n  }\n}\n```\n\n\u003c/details\u003e\n\n### Custom editing area\n\nIf you instantiate ReactQuill without children, it will create a `\u003cdiv\u003e` for you, to be used as the editing area for Quill. If you prefer, you can specify your own element for ReactQuill to use. Note that `\u003ctextarea\u003e`s are not supported by Quill at this time.\n\nNote: Custom editing areas lose focus when using React 16 as a peer dep at this time ([bug](https://github.com/zenoamaro/react-quill/issues/309)).\n\n\u003cdetails\u003e\n\n```jsx\nclass MyComponent extends React.Component {\n\n  render() {\n    return (\n      \u003cReactQuill\u003e\n        \u003cdiv className=\"my-editing-area\"/\u003e\n      \u003c/ReactQuill\u003e\n    );\n  }\n\n});\n```\n\n\u003c/details\u003e\n\n## Upgrading to ReactQuill v2\n\nUpgrading to ReactQuill v2 should be as simple as updating your dependency. However, it also removes support for long-deprecated props, the ReactQuill Mixin, and the Toolbar component.\n\n### Deprecated props\n\nSupport for the `toolbar`, `styles`, `pollInterval` Quill options has long disabled. Starting from this release, ReactQuill will not warn you anymore if you try using them.\n\n### ReactQuill Mixin\n\nThe ReactQuill Mixin allowed injecting the core functionality that made ReactQuill tick into your own components, and create deeply customized versions.\n\nThe Mixin has been considered an anti-pattern for a long time now, so we have decided to finalize its deprecation.\n\nThere is no upgrade path. If you have a use case that relied on the Mixin, you're encouraged to open an issue, and we will try to provide you with a new feature to make it possible, or dedicated support to migrate out of it.\n\n### Toolbar component\n\nQuill has long provided built-in support for custom toolbars, which replaced ReactQuill's (quite inflexible) Toolbar component.\n\nUse the [Toolbar Module](#default-toolbar-elements) or the [HTML Toolbar](#html-toolbar) feature instead.\n\n## API reference\n\n### Exports\n\n```jsx\n// ES6\nimport ReactQuill, { Quill } from 'react-quill';\n\n// CommonJS\nconst ReactQuill = require('react-quill');\nconst { Quill } = ReactQuill;\n```\n\n`Quill`\n: The `Quill` namespace on which you can call `register`.\n\n### Props\n\n`id`\n: ID to be applied to the DOM element.\n\n`className`\n: Classes to be applied to the DOM element.\n\n`value`\n: Value for the editor as a controlled component. Can be a string containing HTML, a [Quill Delta](https://quilljs.com/docs/delta/) instance, or a plain object representing a Delta.\nNote that due to limitations in Quill, this is actually a _semi-controlled_ mode, meaning that the edit is not prevented, but changing `value` will still replace the contents.\nAlso note that passing a Quill Delta here, and then an HTML string, or vice-versa, will always trigger a change, regardless of whether they represent the same document.\n⚠️ Do not pass the `delta` object from the `onChange` event as `value`, as it will cause a loop. See [Using Deltas](#using-deltas) for details.\n\n`defaultValue`\n: Initial value for the editor as an uncontrolled component. Can be a string containing HTML, a [Quill Delta](https://quilljs.com/docs/delta/), or a plain object representing a Delta.\n\n`readOnly`\n: If true, the editor won't allow changing its contents. Wraps the Quill [`disable` API](https://quilljs.com/docs/api/#enable).\n\n`placeholder`\n: The default value for the empty editor. Note: The Quill API does not support changing this value dynamically. Use refs and data-attributes instead (see [#340](https://github.com/zenoamaro/react-quill/issues/340#issuecomment-376176878)).\n\n`modules`\n: An object specifying which modules are enabled, and their configuration. The editor toolbar is a commonly customized module. See the [modules section](http://quilljs.com/docs/modules/) over the Quill documentation for more information on what modules are available.\n\n`formats`\n: An array of formats to be enabled during editing. All implemented formats are enabled by default. See [Formats](http://quilljs.com/docs/formats/) for a list.\nCustom formats should not be included in the array as of version 1.0.0. Instead they should be created through [Parchment](https://github.com/quilljs/parchment) and registered with the module's [Quill export](#exports).\n\n`style`\n: An object with custom CSS rules to apply on the editor's container. Rules should be in React's \"camelCased\" naming style.\n\n`theme`\n: The name of the theme to apply to the editor. Defaults to `snow`, Quill's standard theme. Pass `null` to use the minimal core theme. See the [docs on themes](#themes) for more information on including the required stylesheets.\n\n`tabIndex`\n: The order in which the editor becomes focused, among other controls in the page, during keyboard navigation.\n\n`bounds`\n: Selector or DOM element used by Quill to constrain position of popups. Defaults to `document.body`.\n\n`children`\n: A single React element that will be used as the editing area for Quill in place of the default, which is a `\u003cdiv\u003e`. Note that you cannot use a `\u003ctextarea\u003e`, as it is not a supported target. Also note that updating children is costly, as it will cause the Quill editor to be recreated. Set the `value` prop if you want to control the html contents of the editor.\n\n`onChange(content, delta, source, editor)`\n: Called back with the new contents of the editor after change. It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to [editor accessors](#the-unprivileged-editor) such as `getHTML()`.\n⚠️ Do not use this `delta` object as `value`, as it will cause a loop. Use `editor.getContents()` instead. See [Using Deltas](#using-deltas) for details.\n\n`onChangeSelection(range, source, editor)`\n: Called back with the new selected range, or null when unfocused. It will be passed the selection range, the source of the change, and finally a read-only proxy to editor accessors such as `getBounds()`.\n\n`onFocus(range, source, editor)`\n: Called when the editor becomes focused. It will receive the new selection range.\n\n`onBlur(previousRange, source, editor)`\n: Called when the editor loses focus. It will receive the selection range it had right before losing focus.\n\n`onKeyPress(event)`\n: Called after a key has been pressed and released.\n: Note that, like its native counterpart, this won't be called for special keys such as \u003ckbd\u003eshift\u003c/kbd\u003e or \u003ckbd\u003eenter\u003c/kbd\u003e. If you need those, hook onto `onKeyDown` or `onKeyUp`.\n\n`onKeyDown(event)`\n: Called after a key has been pressed, but before it is released.\n: Note that, due to how Quill works, it's possible that you won't receive events for keys such as \u003ckbd\u003eenter\u003c/kbd\u003e, \u003ckbd\u003ebackspace\u003c/kbd\u003e or \u003ckbd\u003edelete\u003c/kbd\u003e. If that's the case, try hooking onto `onKeyUp` instead.\n\n`onKeyUp(event)`\n: Called after a key has been released.\n\n`preserveWhitespace`\n: If true, a `pre` tag is used for the editor area instead of the default `div` tag. This prevents Quill from\ncollapsing continuous whitespaces on paste. [Related issue](https://github.com/quilljs/quill/issues/1751).\n\n### Methods\n\nIf you have [a ref](https://facebook.github.io/react/docs/more-about-refs.html) to a ReactQuill node, you will be able to invoke the following methods:\n\n`focus()`\n: Focuses the editor.\n\n`blur()`\n: Removes focus from the editor.\n\n`getEditor()`\n: Returns the Quill instance that backs the editor. While you can freely use this to access methods such as `getText()`, please avoid from imperatively manipulating the instance, to avoid getting ReactQuill and Quill out-of-sync. A much-safer [unprivileged editor](#the-unprivileged-editor) is available as replacement.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n[View this example on Codepen](https://codepen.io/alexkrolick/pen/YNmGar?editors=0011)\n\n```jsx\nclass Editor extends React.Component {\n  constructor(props) {\n    super(props);\n    this.quillRef = null; // Quill instance\n    this.reactQuillRef = null; // ReactQuill component\n  }\n\n  componentDidMount() {\n    this.attachQuillRefs();\n  }\n\n  componentDidUpdate() {\n    this.attachQuillRefs();\n  }\n\n  attachQuillRefs = () =\u003e {\n    if (typeof this.reactQuillRef.getEditor !== 'function') return;\n    this.quillRef = this.reactQuillRef.getEditor();\n  };\n\n  insertText = () =\u003e {\n    var range = this.quillRef.getSelection();\n    let position = range ? range.index : 0;\n    this.quillRef.insertText(position, 'Hello, World! ');\n  };\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cReactQuill\n          ref={(el) =\u003e {\n            this.reactQuillRef = el;\n          }}\n          theme={'snow'}\n        /\u003e\n        \u003cbutton onClick={this.insertText}\u003eInsert Text\u003c/button\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n\u003c/details\u003e\n\n`makeUnprivilegedEditor`\n: Creates an [unprivileged editor](#unprivileged-editor). Pass this method a reference to the Quill instance from `getEditor`. Normally you do not need to use this method since the editor exposed to event handlers is already unprivileged.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n```jsx\nconst editor = this.reactQuillRef.getEditor();\nconst unprivilegedEditor = this.reactQuillRef.makeUnprivilegedEditor(editor);\n// You may now use the unprivilegedEditor proxy methods\nunprivilegedEditor.getText();\n```\n\n\u003c/details\u003e\n\n### The unprivileged editor\n\nDuring events, ReactQuill will make a restricted subset of the Quill API available as the `editor` argument. This prevents access to destructive methods, which might cause ReactQuill to get out-of-sync with the component. It provides the following methods, which are mostly proxies of existing [Quill methods](https://quilljs.com/docs/api/):\n\n`getLength()`\n: Returns the length of the editor contents, in characters, not including any HTML tag.\n\n`getText()`\n: Returns the string contents of the editor, not including any HTML tag.\n\n`getHTML()`\n: Returns the full HTML contents of the editor.\n\n`getContents()`\n: Returns a [Quill Delta](https://quilljs.com/docs/delta/) of the complete document.\n\n`getSelection()`\n: Returns the current selection range, or `null` if the editor is unfocused.\n\n`getBounds()`\n: Returns the pixel position, relative to the editor container, and dimensions, of a selection, at a given location.\n\n## Building and testing\n\nYou can build libs, types and bundles:\n\n```sh\nnpm build  # or watch\n```\n\nYou can also run the automated test suite:\n\n```sh\nnpm test\n```\n\nMore tasks are available as package scripts:\n\n| Script          | Description                                 |\n| --------------- | ------------------------------------------- |\n| `npm run build` | Builds lib and browser bundle               |\n| `npm run watch` | Rebuilds on source code changes             |\n| `npm run test`  | Runs unit tests and coverage                |\n| `npm run clean` | Cleans build artifacts                      |\n| `npm run demo`  | Serves a simple ReactQuill test application |\n\n## Browser support\n\nPlease check the browser support table for the upstream [Quill](https://github.com/quilljs/quill) dependency. The ReactQuill distributable itself is ES5-compatible.\n\n## Changelog\n\n[Full changelog](CHANGELOG.md)\n\n## Contributors\n\nReactQuill would not be where it is today without the contributions of many people, which we are incredibly grateful for:\n\n- @zenoamaro (maintainer)\n- @alexkrolick (maintainer)\n- @g12i\n- @clemmy\n- @asiniy\n- @webcarrot\n- @druti\n- @e-jigsaw\n- @zhang-z\n- @Sajam\n- @0bird512\n- @jacktrades\n- @1000hz\n- @kkerr1\n- @csk157\n- @Janekk\n- @AndyTheGiant\n- @chrismcv\n- @wouterh\n- @tdg5\n- @jrmmnr\n- @l3kn\n- @rpellerin\n- @sandbochs\n- @wouterh\n- @MattKunze\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2020, zenoamaro \u003czenoamaro@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenoamaro%2Freact-quill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenoamaro%2Freact-quill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenoamaro%2Freact-quill/lists"}