Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class RichText extends Component {
this.valueToFormat = this.valueToFormat.bind( this );
this.setRef = this.setRef.bind( this );
this.isActive = this.isActive.bind( this );
this.onBlur = this.onBlur.bind( this );

this.formatToValue = memize( this.formatToValue.bind( this ), { size: 1 } );

Expand Down Expand Up @@ -405,6 +406,10 @@ export class RichText extends Component {
}
}

onBlur() {
this.applyRecord( this.formatToValue( this.savedContent ) );
}

/**
* Handle input on the next selection change event.
*/
Expand Down Expand Up @@ -921,6 +926,7 @@ export class RichText extends Component {
key={ key }
onPaste={ this.onPaste }
onInput={ this.onInput }
onBlur={ this.onBlur }
multilineTag={ this.multilineTag }
setRef={ this.setRef }
/>
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/components/rich-text/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export default class TinyMCE extends Component {
isPlaceholderVisible,
onPaste,
onInput,
onBlur,
multilineTag,
} = this.props;

Expand Down Expand Up @@ -243,6 +244,7 @@ export default class TinyMCE extends Component {
dangerouslySetInnerHTML: { __html: initialHTML },
onPaste,
onInput,
onBlur,
} );
}
}