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