diff --git a/editor/components/rich-text/tinymce.js b/editor/components/rich-text/tinymce.js index c88044cf12e4c0..3d02af7565d585 100644 --- a/editor/components/rich-text/tinymce.js +++ b/editor/components/rich-text/tinymce.js @@ -9,6 +9,7 @@ import classnames from 'classnames'; * WordPress dependencies */ import { Component, createElement } from '@wordpress/element'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies @@ -16,8 +17,93 @@ import { Component, createElement } from '@wordpress/element'; import { diffAriaProps, pickAriaProps } from './aria'; import { valueToString } from './format'; +const { BACKSPACE, DELETE } = keycodes; + +/** + * Determines whether we need a fix to provide `input` events for contenteditable. + * + * @param {Element} editorNode The root editor node. + * + * @return {boolean} A boolean indicating whether the fix is needed. + */ +function needsInternetExplorerInputFix( editorNode ) { + return ( + // Rely on userAgent in the absence of a reasonable feature test for contenteditable `input` events. + /Trident/.test( window.navigator.userAgent ) && + // IE11 dispatches input events for `` and `