mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 23:27:04 +00:00
Media: Restore 3.4 editor behavior and remove TinyMCE views.
* Reactivates the `wpgallery` and `wpeditimage` TinyMCE plugins. Deactivates the `wpviews` TinyMCE plugin. * Moves still-relevant logic from `mce-views.js` to `media-upload.js` and `shortcode.js`. * No longer include `wp-includes/js/mce-views.js`. This code will not be used in 3.5, and should be considered unstable. * Currently, this is the real 3.4 experience; as such, editing triggers the old modals. Changing this is the next major step. When reassessing views, we should look over all of these tickets and anticipate these bugs accordingly. fixes #21813, #22123, #22155, #22161, #22257, #22266, #22318, #22407, see #21390. git-svn-id: https://develop.svn.wordpress.org/trunk@22567 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -272,3 +272,71 @@ window.wp = window.wp || {};
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
// HTML utility functions
|
||||
// ----------------------
|
||||
//
|
||||
// Experimental. These functions may change or be removed in the future.
|
||||
(function(){
|
||||
wp.html = _.extend( wp.html || {}, {
|
||||
// ### Parse HTML attributes.
|
||||
//
|
||||
// Converts `content` to a set of parsed HTML attributes.
|
||||
// Utilizes `wp.shortcode.attrs( content )`, which is a valid superset of
|
||||
// the HTML attribute specification. Reformats the attributes into an
|
||||
// object that contains the `attrs` with `key:value` mapping, and a record
|
||||
// of the attributes that were entered using `empty` attribute syntax (i.e.
|
||||
// with no value).
|
||||
attrs: function( content ) {
|
||||
var result, attrs;
|
||||
|
||||
// If `content` ends in a slash, strip it.
|
||||
if ( '/' === content[ content.length - 1 ] )
|
||||
content = content.slice( 0, -1 );
|
||||
|
||||
result = wp.shortcode.attrs( content );
|
||||
attrs = result.named;
|
||||
|
||||
_.each( result.numeric, function( key ) {
|
||||
if ( /\s/.test( key ) )
|
||||
return;
|
||||
|
||||
attrs[ key ] = '';
|
||||
});
|
||||
|
||||
return attrs;
|
||||
},
|
||||
|
||||
// ### Convert an HTML-representation of an object to a string.
|
||||
string: function( options ) {
|
||||
var text = '<' + options.tag,
|
||||
content = options.content || '';
|
||||
|
||||
_.each( options.attrs, function( value, attr ) {
|
||||
text += ' ' + attr;
|
||||
|
||||
// Use empty attribute notation where possible.
|
||||
if ( '' === value )
|
||||
return;
|
||||
|
||||
// Convert boolean values to strings.
|
||||
if ( _.isBoolean( value ) )
|
||||
value = value ? 'true' : 'false';
|
||||
|
||||
text += '="' + value + '"';
|
||||
});
|
||||
|
||||
// Return the result if it is a self-closing tag.
|
||||
if ( options.single )
|
||||
return text + ' />';
|
||||
|
||||
// Complete the opening tag.
|
||||
text += '>';
|
||||
|
||||
// If `content` is an object, recursively call this function.
|
||||
text += _.isObject( content ) ? wp.html.string( content ) : content;
|
||||
|
||||
return text + '</' + options.tag + '>';
|
||||
}
|
||||
});
|
||||
}());
|
||||
Reference in New Issue
Block a user