WordPress.org

Make WordPress Core

Ticket #43686: 43686.diff

File 43686.diff, 709 bytes (added by soulseekah, 20 months ago)

wordCount patch

  • src/wp-admin/js/word-count.js

    diff --git a/src/wp-admin/js/word-count.js b/src/wp-admin/js/word-count.js
    index 711268a..002e42e 100644
    a b  
    6161
    6262                // If there are any localization shortcodes, add this as type in the settings.
    6363                if ( shortcodes && shortcodes.length ) {
    64                         this.settings.shortcodesRegExp = new RegExp( '\\[\\/?(?:' + shortcodes.join( '|' ) + ')[^\\]]*?\\]', 'g' );
     64                        this.settings.shortcodesRegExp = new RegExp( '\\[\\/?(?:' + $( shortcodes ).map( function( _, s ) {
     65                                // Escape special regual expression characters
     66                                return s.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
     67                        } ).get().join( '|' ) + ')[^\\]]*?\\]', 'g' );
    6568                }
    6669        }
    6770