mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 06:31:28 +02:00
Add optional id
prop to the Editor
component (#2402)
This commit is contained in:
committed by
Ian Storm Taylor
parent
eb79c3dbff
commit
13107b0c43
@@ -10,6 +10,7 @@ The top-level React component that renders the Slate editor itself.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
<Editor
|
<Editor
|
||||||
|
id={String}
|
||||||
autoCorrect={Boolean}
|
autoCorrect={Boolean}
|
||||||
autoFocus={Boolean}
|
autoFocus={Boolean}
|
||||||
className={String}
|
className={String}
|
||||||
@@ -28,6 +29,12 @@ The top-level React component that renders the Slate editor itself.
|
|||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `id`
|
||||||
|
|
||||||
|
`String`
|
||||||
|
|
||||||
|
Id for the top-level rendered HTML element of the editor.
|
||||||
|
|
||||||
### `autoCorrect`
|
### `autoCorrect`
|
||||||
|
|
||||||
`Boolean`
|
`Boolean`
|
||||||
|
@@ -41,6 +41,7 @@ class Content extends React.Component {
|
|||||||
autoCorrect: Types.bool.isRequired,
|
autoCorrect: Types.bool.isRequired,
|
||||||
className: Types.string,
|
className: Types.string,
|
||||||
editor: Types.object.isRequired,
|
editor: Types.object.isRequired,
|
||||||
|
id: Types.string,
|
||||||
readOnly: Types.bool.isRequired,
|
readOnly: Types.bool.isRequired,
|
||||||
role: Types.string,
|
role: Types.string,
|
||||||
spellCheck: Types.bool.isRequired,
|
spellCheck: Types.bool.isRequired,
|
||||||
@@ -421,6 +422,7 @@ class Content extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const { props, handlers } = this
|
const { props, handlers } = this
|
||||||
const {
|
const {
|
||||||
|
id,
|
||||||
className,
|
className,
|
||||||
readOnly,
|
readOnly,
|
||||||
editor,
|
editor,
|
||||||
@@ -467,6 +469,7 @@ class Content extends React.Component {
|
|||||||
data-key={document.key}
|
data-key={document.key}
|
||||||
contentEditable={readOnly ? null : true}
|
contentEditable={readOnly ? null : true}
|
||||||
suppressContentEditableWarning
|
suppressContentEditableWarning
|
||||||
|
id={id}
|
||||||
className={className}
|
className={className}
|
||||||
autoCorrect={props.autoCorrect ? 'on' : 'off'}
|
autoCorrect={props.autoCorrect ? 'on' : 'off'}
|
||||||
spellCheck={spellCheck}
|
spellCheck={spellCheck}
|
||||||
|
@@ -35,6 +35,7 @@ class Editor extends React.Component {
|
|||||||
autoCorrect: Types.bool,
|
autoCorrect: Types.bool,
|
||||||
autoFocus: Types.bool,
|
autoFocus: Types.bool,
|
||||||
className: Types.string,
|
className: Types.string,
|
||||||
|
id: Types.string,
|
||||||
onChange: Types.func,
|
onChange: Types.func,
|
||||||
options: Types.object,
|
options: Types.object,
|
||||||
placeholder: Types.any,
|
placeholder: Types.any,
|
||||||
|
1
packages/slate-react/src/plugins/react.js
vendored
1
packages/slate-react/src/plugins/react.js
vendored
@@ -60,6 +60,7 @@ function ReactPlugin(options = {}) {
|
|||||||
autoCorrect={props.autoCorrect}
|
autoCorrect={props.autoCorrect}
|
||||||
className={props.className}
|
className={props.className}
|
||||||
editor={editor}
|
editor={editor}
|
||||||
|
id={props.id}
|
||||||
onEvent={(handler, event) => editor.run(handler, event)}
|
onEvent={(handler, event) => editor.run(handler, event)}
|
||||||
readOnly={props.readOnly}
|
readOnly={props.readOnly}
|
||||||
role={props.role}
|
role={props.role}
|
||||||
|
Reference in New Issue
Block a user