WordPress.org

Make WordPress Core

Changeset 22162


Ignore:
Timestamp:
10/10/2012 10:52:14 AM (7 years ago)
Author:
koopersmith
Message:

Add a class to the TinyMCE view end marker.

Certain TinyMCE plugins scan for all spans in the document and remove any that do not have classes (or a handful of other attributes). This is quite aggressive, and breaks the regex used to scan for MCE views when transforming them back to plain text. Adding a class ensures that any plugins that do so will not break MCE views.

see #21812, #21390.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/mce-view.js

    r22155 r22162  
    326326                // and add an ending marker to the wrapper to help regexes
    327327                // scan the HTML string.
    328                 wrapper.empty().append( view.el ).append('<span data-wp-view-end></span>');
     328                wrapper.empty().append( view.el ).append('<span data-wp-view-end class="wp-view-end"></span>');
    329329            });
    330330        },
     
    334334        // their respective text representations.
    335335        toText: function( content ) {
    336             return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?<span data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) {
     336            return content.replace( /<(?:div|span)[^>]+data-wp-view="([^"]+)"[^>]*>.*?<span[^>]+data-wp-view-end[^>]*><\/span><\/(?:div|span)>/g, function( match, id ) {
    337337                var instance = instances[ id ],
    338338                    view;
Note: See TracChangeset for help on using the changeset viewer.