1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-20 06:01:24 +02:00

Add optional id prop to the Editor component (#2402)

This commit is contained in:
Dundercover
2018-11-09 00:36:44 +01:00
committed by Ian Storm Taylor
parent eb79c3dbff
commit 13107b0c43
4 changed files with 12 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ class Content extends React.Component {
autoCorrect: Types.bool.isRequired,
className: Types.string,
editor: Types.object.isRequired,
id: Types.string,
readOnly: Types.bool.isRequired,
role: Types.string,
spellCheck: Types.bool.isRequired,
@@ -421,6 +422,7 @@ class Content extends React.Component {
render() {
const { props, handlers } = this
const {
id,
className,
readOnly,
editor,
@@ -467,6 +469,7 @@ class Content extends React.Component {
data-key={document.key}
contentEditable={readOnly ? null : true}
suppressContentEditableWarning
id={id}
className={className}
autoCorrect={props.autoCorrect ? 'on' : 'off'}
spellCheck={spellCheck}

View File

@@ -35,6 +35,7 @@ class Editor extends React.Component {
autoCorrect: Types.bool,
autoFocus: Types.bool,
className: Types.string,
id: Types.string,
onChange: Types.func,
options: Types.object,
placeholder: Types.any,

View File

@@ -60,6 +60,7 @@ function ReactPlugin(options = {}) {
autoCorrect={props.autoCorrect}
className={props.className}
editor={editor}
id={props.id}
onEvent={(handler, event) => editor.run(handler, event)}
readOnly={props.readOnly}
role={props.role}