Fix persistence of <track> elements in the body of a [video] shotcode in TinyMCE views.

Merges [28183] and [28169] to the 3.9 branch.

props azaozz, wonderboymusic.
fixes #27915.

Built from https://develop.svn.wordpress.org/branches/3.9@28273


git-svn-id: http://core.svn.wordpress.org/branches/3.9@28101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-05-06 04:51:14 +00:00
parent 8b65448e85
commit c51b6347e4
9 changed files with 28 additions and 17 deletions

View File

@ -1781,7 +1781,8 @@
margin-top: 24px; margin-top: 24px;
} }
.media-embed .setting input.hidden { .media-embed .setting input.hidden,
.media-embed .setting textarea.hidden {
display: none; display: none;
} }

File diff suppressed because one or more lines are too long

View File

@ -1781,7 +1781,8 @@
margin-top: 24px; margin-top: 24px;
} }
.media-embed .setting input.hidden { .media-embed .setting input.hidden,
.media-embed .setting textarea.hidden {
display: none; display: none;
} }

File diff suppressed because one or more lines are too long

View File

@ -483,11 +483,13 @@ window.wp = window.wp || {};
* @returns {string} * @returns {string}
*/ */
getHtml: function() { getHtml: function() {
var attrs = _.defaults( var attrs = this.shortcode.attrs.named;
this.shortcode.attrs.named, attrs.content = this.shortcode.content;
wp.media[ this.shortcode.tag ].defaults
); return this.template({ model: _.defaults(
return this.template({ model: attrs }); attrs,
wp.media[ this.shortcode.tag ].defaults )
});
}, },
unbind: function() { unbind: function() {

File diff suppressed because one or more lines are too long

View File

@ -332,17 +332,24 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
tinymce.each( dom.select( 'div[data-wpview-text]', event.node ), function( node ) { tinymce.each( dom.select( 'div[data-wpview-text]', event.node ), function( node ) {
// Empty the wrap node // Empty the wrap node
if ( 'textContent' in node ) { if ( 'textContent' in node ) {
node.textContent = ''; node.textContent = '\u00a0';
} else { } else {
node.innerText = ''; node.innerText = '\u00a0';
} }
// This makes all views into block tags (as we use <div>).
// Can use 'PostProcess' and a regex instead.
dom.replace( dom.create( 'p', null, window.decodeURIComponent( dom.getAttrib( node, 'data-wpview-text' ) ) ), node );
}); });
}); });
editor.on( 'PostProcess', function( event ) {
if ( event.content ) {
event.content = event.content.replace( /<div [^>]*?data-wpview-text="([^"]*)"[^>]*>[\s\S]*?<\/div>/g, function( match, shortcode ) {
if ( shortcode ) {
return '<p>' + window.decodeURIComponent( shortcode ) + '</p>';
}
return ''; // If error, remove the view wrapper
});
}
});
editor.on( 'keydown', function( event ) { editor.on( 'keydown', function( event ) {
var keyCode = event.keyCode, var keyCode = event.keyCode,
body = editor.getBody(), body = editor.getBody(),

File diff suppressed because one or more lines are too long