Emoji: Stop emoji replacement from happening inside CodeMirror instances, and clean up some logic in the MutationObserver
.
Props pento, hirofumi2012, davidbaumwald. Fixes #46537. git-svn-id: https://develop.svn.wordpress.org/trunk@46393 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0e2b212b57
commit
c411aad31b
@ -121,6 +121,11 @@
|
||||
while ( ii-- ) {
|
||||
node = addedNodes[ ii ];
|
||||
|
||||
// Don't replace emoji inside elements that don't support it.
|
||||
if ( ! node || node.closest( '.wp-exclude-emoji' ) || node.closest( '.CodeMirror' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Node type 3 is a TEXT_NODE.
|
||||
if ( node.nodeType === 3 ) {
|
||||
if ( ! node.parentNode ) {
|
||||
@ -145,14 +150,8 @@
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the class name of a non-element node contains 'wp-exclude-emoji' ignore it.
|
||||
*
|
||||
* Node type 1 is an ELEMENT_NODE.
|
||||
*/
|
||||
if ( ! node || node.nodeType !== 1 ||
|
||||
( node.className && typeof node.className === 'string' && node.className.indexOf( 'wp-exclude-emoji' ) !== -1 ) ) {
|
||||
|
||||
// Only make replacements inside Element nodes.
|
||||
if ( node.nodeType !== 1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user