From 99da50a9bf09ecd7176981c2f5eae4ec9d8331ca Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Tue, 27 Nov 2018 08:29:14 -0500 Subject: [PATCH] Editor: Apply IE11 input fix only when mounting TinyMCE (#12335) --- .../editor/src/components/rich-text/tinymce.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/editor/src/components/rich-text/tinymce.js b/packages/editor/src/components/rich-text/tinymce.js index dc6f7f46b3831..833a740c690ec 100644 --- a/packages/editor/src/components/rich-text/tinymce.js +++ b/packages/editor/src/components/rich-text/tinymce.js @@ -259,17 +259,14 @@ export default class TinyMCE extends Component { this.props.setRef( editorNode ); } - /** - * A ref function can be used for cleanup because React calls it with - * `null` when unmounting. - */ - if ( this.removeInternetExplorerInputFix ) { - this.removeInternetExplorerInputFix(); - this.removeInternetExplorerInputFix = null; - } - if ( IS_IE ) { - this.removeInternetExplorerInputFix = applyInternetExplorerInputFix( editorNode ); + if ( editorNode ) { + // Mounting: + this.removeInternetExplorerInputFix = applyInternetExplorerInputFix( editorNode ); + } else { + // Unmounting: + this.removeInternetExplorerInputFix(); + } } }