mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
Add div to editor as editor.el (#2820)
This commit is contained in:
committed by
Ian Storm Taylor
parent
d7b37a8dca
commit
accba53f56
@@ -111,6 +111,17 @@ class Content extends React.Component {
|
|||||||
|
|
||||||
ref = React.createRef()
|
ref = React.createRef()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set both `this.ref` and `editor.el`
|
||||||
|
*
|
||||||
|
* @type {DOMElement}
|
||||||
|
*/
|
||||||
|
|
||||||
|
setRef = el => {
|
||||||
|
this.ref.current = el
|
||||||
|
this.props.editor.el = el
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a set of bound event handlers.
|
* Create a set of bound event handlers.
|
||||||
*
|
*
|
||||||
@@ -506,7 +517,7 @@ class Content extends React.Component {
|
|||||||
key={this.props.contentKey}
|
key={this.props.contentKey}
|
||||||
{...handlers}
|
{...handlers}
|
||||||
{...data}
|
{...data}
|
||||||
ref={this.ref}
|
ref={this.setRef}
|
||||||
contentEditable={readOnly ? null : true}
|
contentEditable={readOnly ? null : true}
|
||||||
suppressContentEditableWarning
|
suppressContentEditableWarning
|
||||||
id={id}
|
id={id}
|
||||||
|
Reference in New Issue
Block a user