Skip to content

Commit

Permalink
Merge pull request zenoamaro#372 from audiolion/docs/unprivileged-editor
Browse files Browse the repository at this point in the history
(docs) Add makeUnprivilegedEditor example to README
  • Loading branch information
alexkrolick authored Jun 19, 2018
2 parents ce332cf + 362d2b8 commit a795638
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,23 @@ class Editor extends React.Component {

</details>


`makeUnprivilegedEditor`
: 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.


<details>
<summary>Example</summary>

```jsx
const editor = this.reactQuillRef.getEditor();
const unprivilegedEditor = this.reactQuillRef.makeUnprivilegedEditor(editor);
// You may now use the unprivilegedEditor proxy methods
unprivilegedEditor.getText();
```

</details>

### The unprivileged editor

During events, ReactQuill will make a restricted subset of the Quill API available as the `editor` argument. This prevents access to destructive methods, which might case 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/):
Expand All @@ -703,7 +720,6 @@ During events, ReactQuill will make a restricted subset of the Quill API availab
`getBounds()`
: Returns the pixel position, relative to the editor container, and dimensions, of a selection, at a given location.


## Building and testing

You can run the automated test suite:
Expand Down

0 comments on commit a795638

Please sign in to comment.