@@ -48,13 +48,35 @@ var ContentEditable = function (_React$Component) {
4848 html = _props . html ,
4949 props = _objectWithoutProperties ( _props , [ 'tagName' , 'html' ] ) ;
5050
51+ var contentEditableState = true ;
52+
53+ if ( this . props . plaintextOnly ) {
54+ contentEditableState = "plaintext-only" ;
55+ }
56+
57+ if ( this . props . typing ) {
58+ contentEditableState = "typing" ;
59+ }
60+
61+ if ( this . props . caret ) {
62+ contentEditableState = "caret" ;
63+ }
64+
65+ if ( this . props . events ) {
66+ contentEditableState = "events" ;
67+ }
68+
69+ if ( this . props . disabled ) {
70+ contentEditableState = false ;
71+ }
72+
5173 return _react2 . default . createElement ( tagName || 'div' , _extends ( { } , props , {
5274 ref : function ref ( e ) {
5375 return _this2 . htmlEl = e ;
5476 } ,
5577 onInput : this . emitChange ,
5678 onBlur : this . props . onBlur || this . emitChange ,
57- contentEditable : ! this . props . disabled ,
79+ contentEditable : contentEditableState ,
5880 dangerouslySetInnerHTML : { __html : html }
5981 } ) , this . props . children ) ;
6082 }
@@ -100,12 +122,12 @@ var ContentEditable = function (_React$Component) {
100122 if ( ! this . htmlEl ) return ;
101123 var html = this . htmlEl . innerHTML ;
102124 if ( this . props . onChange && html !== this . lastHtml ) {
103- // Clone event with Object.assign to avoid
125+ // Clone event with Object.assign to avoid
104126 // "Cannot assign to read only property 'target' of object"
105- var evt = Object . assign ( { } , evt , {
106- target : {
107- value : html
108- }
127+ var evt = Object . assign ( { } , evt , {
128+ target : {
129+ value : html
130+ }
109131 } ) ;
110132 this . props . onChange ( evt ) ;
111133 }
@@ -117,4 +139,4 @@ var ContentEditable = function (_React$Component) {
117139} ( _react2 . default . Component ) ;
118140
119141exports . default = ContentEditable ;
120- module . exports = exports [ 'default' ] ;
142+ module . exports = exports [ 'default' ] ;
0 commit comments