mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-24 09:13:24 +01:00
Add prop to optionally enable grammarly (#2855)
This commit is contained in:
parent
9e2e2a1cc5
commit
b1af2d3dc8
@ -4,6 +4,7 @@ import Types from 'prop-types'
|
||||
import getWindow from 'get-window'
|
||||
import warning from 'tiny-warning'
|
||||
import throttle from 'lodash/throttle'
|
||||
import omit from 'lodash/omit'
|
||||
import { List } from 'immutable'
|
||||
import {
|
||||
IS_ANDROID,
|
||||
@ -541,8 +542,11 @@ class Content extends React.Component {
|
||||
[DATA_ATTRS.KEY]: document.key,
|
||||
}
|
||||
|
||||
const domProps = omit(this.props, Object.keys(Content.propTypes))
|
||||
|
||||
return (
|
||||
<Container
|
||||
{...domProps}
|
||||
key={this.tmp.contentKey}
|
||||
{...handlers}
|
||||
{...data}
|
||||
@ -559,7 +563,9 @@ class Content extends React.Component {
|
||||
// COMPAT: The Grammarly Chrome extension works by changing the DOM out
|
||||
// from under `contenteditable` elements, which leads to weird behaviors
|
||||
// so we have to disable it like this. (2017/04/24)
|
||||
data-gramm={false}
|
||||
|
||||
// just the existence of the flag is disabling the extension irrespective of its value
|
||||
data-gramm={domProps['data-gramm'] ? undefined : false}
|
||||
>
|
||||
<Node
|
||||
annotations={value.annotations}
|
||||
|
@ -5,6 +5,7 @@ import Types from 'prop-types'
|
||||
import invariant from 'tiny-invariant'
|
||||
import memoizeOne from 'memoize-one'
|
||||
import warning from 'tiny-warning'
|
||||
import omit from 'lodash/omit'
|
||||
import { Editor as Controller } from 'slate'
|
||||
|
||||
import EVENT_HANDLERS from '../constants/event-handlers'
|
||||
@ -174,8 +175,11 @@ class Editor extends React.Component {
|
||||
tagName,
|
||||
} = this.props
|
||||
|
||||
const domProps = omit(this.props, Object.keys(Editor.propTypes))
|
||||
|
||||
const children = (
|
||||
<Content
|
||||
{...domProps}
|
||||
ref={this.tmp.contentRef}
|
||||
autoCorrect={autoCorrect}
|
||||
className={className}
|
||||
|
Loading…
x
Reference in New Issue
Block a user