Make WordPress Core

Ticket #64318: 64318-exclude-math-arrows.diff

File 64318-exclude-math-arrows.diff, 1.2 KB (added by iflairwebtechnologies, 3 months ago)

should not be replaced by Twemoji

  • wp-includes/formatting.php

     
    51205120       return $char;
    51215121   }
    51225122
     5123   /*
     5124    * Prevent math/logic arrow symbols from being replaced by Twemoji.
     5125    * These symbols (e.g., ↦ ↤ ↥ ↧) belong to the Math Operators block
     5126    * and should not be interpreted as emoji because it changes meaning.
     5127    */
     5128   $blocked_math_arrows = array( '↦', '↤', '↥', '↧' );
     5129
     5130   if ( in_array( $char, $blocked_math_arrows, true ) ) {
     5131       return $char;
     5132   }
     5133
    51235134   // Default emoji replacement.
    51245135   return sprintf(
    51255136       '<img src="%s" class="emoji" alt="%s" />',
  • wp-includes/js/wp-emoji.js

     
    240240    // Emoji regex matches too many symbols including math arrows.
    241241    // Add an explicit exclusion range for U+21A6–U+21AA.
    242242
    243     var emojiRegex = /\p{Extended_Pictographic}/u;
     243    var emojiRegex = /\p{Extended_Pictographic}(?![\u21A6-\u21AA])/u;
    244244
    245245    window.wpEmojiRegex = emojiRegex;
    246246})();