<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[32022] trunk/src/wp-includes: TinyMCE wpView:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/32022">32022</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/32022","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-04-04 22:59:07 +0000 (Sat, 04 Apr 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>TinyMCE wpView:
- Fix editor undo levels.
- Remove views and markers in the DOM before serialization.
- Unbind views before removing them on hide.
- Empty the content in the timeout, so it doesn't render iframes twice.
Props iseulde. Fixes <a href="https://core.trac.wordpress.org/ticket/31669">#31669</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmceviewjs">trunk/src/wp-includes/js/mce-view.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpviewpluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js</a></li>
<li><a href="#trunksrcwpincludesversionphp">trunk/src/wp-includes/version.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmceviewjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/mce-view.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/mce-view.js 2015-04-04 22:56:04 UTC (rev 32021)
+++ trunk/src/wp-includes/js/mce-view.js 2015-04-04 22:59:07 UTC (rev 32022)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -87,6 +87,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * and creates a new instance for every match.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {String} content The string to scan.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @return {String} The string with markers.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> setMarkers: function( content ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var pieces = [ { content: content } ],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -298,11 +300,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Renders all view nodes tied to this view instance that are not yet rendered.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param {String} content The content to render. Optional.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param {Boolean} force Rerender all view nodes tied to this view instance.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- render: function( force ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ render: function( content, force ) {
+ if ( content != null ) {
+ this.content = content;
+ }
+
+ content = this.getContent();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // If there's nothing to render an no loader needs to be shown, stop.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! this.loader && ! this.getContent() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! this.loader && ! content ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -312,9 +321,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Replace any left over markers.
</span><span class="cx" style="display: block; padding: 0 10px"> this.replaceMarkers();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( this.getContent() ) {
- this.setContent( this.getContent(), function( editor, node ) {
- $( node ).data( 'rendered', true ).trigger( 'wp-mce-view-bind' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( content ) {
+ this.setContent( content, function( editor, node ) {
+ $( node ).data( 'rendered', true );
+ this.bindNode.call( this, editor, node );
</ins><span class="cx" style="display: block; padding: 0 10px"> }, force ? null : false );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> this.setLoader();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -322,11 +332,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Binds a given node after its content is added to the DOM.
+ */
+ bindNode: function() {},
+
+ /**
+ * Unbinds a given node before its content is removed from the DOM.
+ */
+ unbindNode: function() {},
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Unbinds all view nodes tied to this view instance.
</span><span class="cx" style="display: block; padding: 0 10px"> * Runs before their content is removed from the DOM.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> unbind: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.getNodes( function( editor, node ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.unbindNode.call( this, editor, node );
</ins><span class="cx" style="display: block; padding: 0 10px"> $( node ).trigger( 'wp-mce-view-unbind' );
</span><span class="cx" style="display: block; padding: 0 10px"> }, true );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -447,7 +468,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> contentNode.innerHTML = '';
</span><span class="cx" style="display: block; padding: 0 10px"> contentNode.appendChild( _.isString( content ) ? editor.dom.createFragment( content ) : content );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- callback && callback.apply( this, arguments );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ callback && callback.call( this, editor, node, contentNode );
</ins><span class="cx" style="display: block; padding: 0 10px"> }, rendered );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -461,30 +482,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {Boolean} rendered Only set for (un)rendered nodes. Optional.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> setIframes: function( head, body, callback, rendered ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
+ self = this;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.getNodes( function( editor, node, content ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Seems Firefox needs a bit of time to insert/set the view nodes,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dom = editor.dom,
+ styles = '',
+ bodyClasses = editor.getBody().className || '',
+ editorHead = editor.getDoc().getElementsByTagName( 'head' )[0],
+ iframe, iframeDoc, observer, i;
+
+ tinymce.each( dom.$( 'link[rel="stylesheet"]', editorHead ), function( link ) {
+ if ( link.href && link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 &&
+ link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 ) {
+
+ styles += dom.getOuterHTML( link );
+ }
+ } );
+
+ // Seems the browsers need a bit of time to insert/set the view nodes,
</ins><span class="cx" style="display: block; padding: 0 10px"> // or the iframe will fail especially when switching Text => Visual.
</span><span class="cx" style="display: block; padding: 0 10px"> setTimeout( function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var dom = editor.dom,
- styles = '',
- bodyClasses = editor.getBody().className || '',
- iframe, iframeDoc, observer, i;
-
- tinymce.each( dom.$(
- 'link[rel="stylesheet"]',
- editor.getDoc().getElementsByTagName( 'head' )[0]
- ), function( link ) {
- if (
- link.href &&
- link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 &&
- link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1
- ) {
- styles += dom.getOuterHTML( link );
- }
- } );
-
</del><span class="cx" style="display: block; padding: 0 10px"> content.innerHTML = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> iframe = dom.add( content, 'iframe', {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -582,7 +600,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> editor.off( 'wp-body-class-change', classChange );
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- callback && callback.apply( this, arguments );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ callback && callback.call( self, editor, node );
</ins><span class="cx" style="display: block; padding: 0 10px"> }, 50 );
</span><span class="cx" style="display: block; padding: 0 10px"> }, rendered );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -664,6 +682,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {HTMLElement} node The view node to remove.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> remove: function( editor, node ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.unbindNode.call( this, editor, node, $( node ).find( '.wpview-content' ).get( 0 ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $( node ).trigger( 'wp-mce-view-unbind' );
</span><span class="cx" style="display: block; padding: 0 10px"> editor.dom.remove( node );
</span><span class="cx" style="display: block; padding: 0 10px"> editor.focus();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -728,12 +747,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.content = self.template( {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.render( self.template( {
</ins><span class="cx" style="display: block; padding: 0 10px"> attachments: attachments,
</span><span class="cx" style="display: block; padding: 0 10px"> columns: attrs.columns ? parseInt( attrs.columns, 10 ) : wp.media.galleryDefaults.columns
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } );
-
- self.render();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> } )
</span><span class="cx" style="display: block; padding: 0 10px"> .fail( function( jqXHR, textStatus ) {
</span><span class="cx" style="display: block; padding: 0 10px"> self.setError( textStatus );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -754,16 +771,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp.ajax.send( this.action, {
- data: {
- post_ID: postID,
- type: this.shortcode.tag,
- shortcode: this.shortcode.string()
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.ajax.post( this.action, {
+ post_ID: postID,
+ type: this.shortcode.tag,
+ shortcode: this.shortcode.string()
</ins><span class="cx" style="display: block; padding: 0 10px"> } )
</span><span class="cx" style="display: block; padding: 0 10px"> .done( function( response ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.content = response;
- self.render();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.render( response );
</ins><span class="cx" style="display: block; padding: 0 10px"> } )
</span><span class="cx" style="display: block; padding: 0 10px"> .fail( function( response ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( self.url ) {
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswpviewpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js 2015-04-04 22:56:04 UTC (rev 32021)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js 2015-04-04 22:59:07 UTC (rev 32022)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress View plugin.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> tinymce.PluginManager.add( 'wpview', function( editor ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var selected,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $ = editor.$,
+ selected,
</ins><span class="cx" style="display: block; padding: 0 10px"> Env = tinymce.Env,
</span><span class="cx" style="display: block; padding: 0 10px"> VK = tinymce.util.VK,
</span><span class="cx" style="display: block; padding: 0 10px"> TreeWalker = tinymce.dom.TreeWalker,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -153,13 +154,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove the content of view wrappers from HTML string
</span><span class="cx" style="display: block; padding: 0 10px"> function emptyViews( content ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return content.replace(/<div[^>]+data-wpview-text=\"([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>(?: |\u00a0)*<\/p><\/div>/g, '$1' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ content = content.replace( /<div[^>]+data-wpview-text="([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>[^<>]*<\/p>\s*<\/div>/g, function( all, match ) {
+ return '<p>' + window.decodeURIComponent( match ) + '</p>';
+ });
+
+ return content.replace( / data-wpview-marker="[^"]+"/g, '' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Prevent adding undo levels on changes inside a view wrapper
</span><span class="cx" style="display: block; padding: 0 10px"> editor.on( 'BeforeAddUndo', function( event ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( event.lastLevel && emptyViews( event.level.content ) === emptyViews( event.lastLevel.content ) ) {
- event.preventDefault();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( event.level.content ) {
+ event.level.content = emptyViews( event.level.content );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,6 +174,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> editor.on( 'BeforeSetContent', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var node;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! event.selection ) {
+ wp.mce.views.unbind();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! event.content ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -339,22 +348,30 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on( 'PreProcess', function( event ) {
- // Empty the wpview wrap nodes
- tinymce.each( editor.dom.select( 'div[data-wpview-text]', event.node ), function( node ) {
- node.textContent = node.innerText = '\u00a0';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function resetViews( rootNode ) {
+ // Replace view nodes
+ $( 'div[data-wpview-text]', rootNode ).each( function( i, node ) {
+ var $node = $( node ),
+ text = window.decodeURIComponent( $node.attr( 'data-wpview-text' ) || '' );
+
+ if ( text && node.parentNode ) {
+ $node.replaceWith( $( editor.dom.create('p') ).text( text ) );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove marker attributes
+ $( 'p[data-wpview-marker]', rootNode ).attr( 'data-wpview-marker', null );
+ }
+
+ editor.on( 'PreProcess', function( event ) {
+ // Replace the view nodes with their text in the DOM clone.
+ resetViews( event.node );
+ }, true );
+
+ editor.on( 'hide', function() {
+ // Replace the view nodes with their text directly in the editor body.
+ wp.mce.views.unbind();
+ resetViews( editor.getBody() );
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Excludes arrow keys, delete, backspace, enter, space bar.
</span></span></pre></div>
<a id="trunksrcwpincludesversionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/version.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/version.php 2015-04-04 22:56:04 UTC (rev 32021)
+++ trunk/src/wp-includes/version.php 2015-04-04 22:59:07 UTC (rev 32022)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +18,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string $tinymce_version
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$tinymce_version = '4109-20150310';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$tinymce_version = '4109-20150404';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Holds the required PHP version
</span></span></pre>
</div>
</div>
</body>
</html>