Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
Add nonce to AutoSizer style for Content Security Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
akihikodaki committed Apr 29, 2017
1 parent cb3102e commit 64cf712
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ var settings = {
<EmojiPicker categories={categories} emojione={settings} />
```

## Content Security Policy

The picker uses _react-virtualized_, which creates an inlined style. Give the
picker a nonce and set `Content-Security-Policy` field in HTTP header
accordingly.

```
<EmojiPicker nonce={NONCE_GENERATED_WHEN_TRANSMITTING} />
```

```
Content-Security-Policy: style-src: 'self' 'nonce-NONCE_GENERATED_WHEN_TRANSMITTING'
```


## Development

Expand Down
2 changes: 1 addition & 1 deletion src/categories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class Categories extends Component {
const rowCount = this.props.rows.length;

return (
<AutoSizer>
<AutoSizer nonce={this.props.nonce}>
{({ height, width }) => (
<List
height={height}
Expand Down
1 change: 1 addition & 0 deletions src/picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default class Picker extends Component {
return (
<div className="emoji-categories-wrapper">
<Categories
nonce={this.props.nonce}
ref={this._setCategoriesRef}
rows={rows}
modifier={this.state.modifier}
Expand Down

0 comments on commit 64cf712

Please sign in to comment.