File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,13 @@ var ContentEditable = function (_React$Component) {
9696 if ( ! this . htmlEl ) return ;
9797 var html = this . htmlEl . innerHTML ;
9898 if ( this . props . onChange && html !== this . lastHtml ) {
99- evt . target = { value : html } ;
99+ // Clone event with Object.assign to avoid
100+ // "Cannot assign to read only property 'target' of object"
101+ var evt = Object . assign ( { } , evt , {
102+ target : {
103+ value : html
104+ }
105+ } ) ;
100106 this . props . onChange ( evt ) ;
101107 }
102108 this . lastHtml = html ;
@@ -107,4 +113,4 @@ var ContentEditable = function (_React$Component) {
107113} ( _react2 . default . Component ) ;
108114
109115exports . default = ContentEditable ;
110- module . exports = exports [ 'default' ] ;
116+ module . exports = exports [ 'default' ] ;
Original file line number Diff line number Diff line change @@ -56,7 +56,13 @@ export default class ContentEditable extends React.Component {
5656 if ( ! this . htmlEl ) return ;
5757 var html = this . htmlEl . innerHTML ;
5858 if ( this . props . onChange && html !== this . lastHtml ) {
59- evt . target = { value : html } ;
59+ // Clone event with Object.assign to avoid
60+ // "Cannot assign to read only property 'target' of object"
61+ var evt = Object . assign ( { } , evt , {
62+ target : {
63+ value : html
64+ }
65+ } ) ;
6066 this . props . onChange ( evt ) ;
6167 }
6268 this . lastHtml = html ;
You can’t perform that action at this time.
0 commit comments