-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RichText: Fix browser formatting buttons (#13833)
* RichText: Fix browser formatting buttons * Simplify * componentDidMount instead of componentWillMount
- Loading branch information
1 parent
e2edbe5
commit ac0e970
Showing
6 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Component } from '@wordpress/element'; | ||
|
||
export class RichTextInputEvent extends Component { | ||
constructor() { | ||
super( ...arguments ); | ||
|
||
this.onInput = this.onInput.bind( this ); | ||
} | ||
|
||
onInput( event ) { | ||
if ( event.inputType === this.props.inputType ) { | ||
this.props.onInput(); | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
document.addEventListener( 'input', this.onInput, true ); | ||
} | ||
|
||
componentWillUnmount() { | ||
document.removeEventListener( 'input', this.onInput, true ); | ||
} | ||
|
||
render() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters