<!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>[29050] trunk/src: Fix whitespace, quotes and double patch content in wpautoresize plugin, see #28328</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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29050">29050</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-07-09 22:42:28 +0000 (Wed, 09 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix whitespace, quotes and double patch content in wpautoresize plugin, see <a href="http://core.trac.wordpress.org/ticket/28328">#28328</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjseditorexpandjs">trunk/src/wp-admin/js/editor-expand.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpautoresizepluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjseditorexpandjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/editor-expand.js (29049 => 29050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/editor-expand.js   2014-07-09 22:05:06 UTC (rev 29049)
+++ trunk/src/wp-admin/js/editor-expand.js      2014-07-09 22:42:28 UTC (rev 29050)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+/* global tinymce */
</ins><span class="cx"> 
</span><span class="cx"> window.wp = window.wp || {};
</span><span class="cx"> 
</span><span class="lines">@@ -15,14 +16,13 @@
</span><span class="cx">          $bottom = $( '#post-status-info' ),
</span><span class="cx">          $statusBar,
</span><span class="cx">          buffer = 200,
</span><del>-               adjust,
</del><span class="cx">           fullscreen = window.wp.editor && window.wp.editor.fullscreen,
</span><span class="cx">          editorInstance,
</span><span class="cx">          fixedTop = false,
</span><span class="cx">          fixedBottom = false;
</span><span class="cx"> 
</span><span class="cx">  $textEditorClone.insertAfter( $textEditor );
</span><del>-       
</del><ins>+
</ins><span class="cx">   // use to enable/disable
</span><span class="cx">  $contentWrap.addClass( 'wp-editor-expand' );
</span><span class="cx">  $( '#content-resize-handle' ).hide();
</span><span class="lines">@@ -306,7 +306,7 @@
</span><span class="cx">                                  borderTop: 'none',
</span><span class="cx">                                  width: $editor.parent().width() - ( $top.outerWidth() - $top.width() )
</span><span class="cx">                          } );
</span><del>-                               
</del><ins>+
</ins><span class="cx">                           $tools.css( {
</span><span class="cx">                                  position: 'absolute',
</span><span class="cx">                                  top: 0,
</span><span class="lines">@@ -322,14 +322,14 @@
</span><span class="cx">                                  top: window.pageYOffset - $editor.offset().top + adminBarHeight + $tools.outerHeight(),
</span><span class="cx">                                  borderTop: 'none'
</span><span class="cx">                          } );
</span><del>-                               
</del><ins>+
</ins><span class="cx">                           $tools.css( {
</span><span class="cx">                                  position: 'absolute',
</span><span class="cx">                                  top: window.pageYOffset - $contentWrap.offset().top + adminBarHeight,
</span><span class="cx">                                  borderTop: 'none',
</span><span class="cx">                                  width: $contentWrap.width()
</span><span class="cx">                          } );
</span><del>-                       }                               
</del><ins>+                        }
</ins><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          // Maybe adjust the bottom bar.
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswpautoresizepluginjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js (29049 => 29050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js  2014-07-09 22:05:06 UTC (rev 29049)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js     2014-07-09 22:42:28 UTC (rev 29050)
</span><span class="lines">@@ -20,21 +20,21 @@
</span><span class="cx">  * It will retain a minimum height, which is the height of the content area when
</span><span class="cx">  * it's initialized.
</span><span class="cx">  */
</span><del>-tinymce.PluginManager.add('wpautoresize', function(editor) {
</del><ins>+tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
</ins><span class="cx">   var settings = editor.settings, oldSize = 0;
</span><span class="cx"> 
</span><span class="cx">  function isFullscreen() {
</span><span class="cx">          return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       if (editor.settings.inline) {
</del><ins>+        if ( editor.settings.inline ) {
</ins><span class="cx">           return;
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * This method gets executed each time the editor needs to resize.
</span><span class="cx">   */
</span><del>-       function resize(e) {
</del><ins>+        function resize( e ) {
</ins><span class="cx">           var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight, marginTop, marginBottom;
</span><span class="cx"> 
</span><span class="cx">          doc = editor.getDoc();
</span><span class="lines">@@ -46,52 +46,52 @@
</span><span class="cx">          docElm = doc.documentElement;
</span><span class="cx">          resizeHeight = settings.autoresize_min_height;
</span><span class="cx"> 
</span><del>-               if (!body || (e && e.type === "setcontent" && e.initial) || isFullscreen()) {
-                       if (body && docElm) {
-                               body.style.overflowY = "auto";
-                               docElm.style.overflowY = "auto"; // Old IE
</del><ins>+                if ( ! body || ( e && e.type === 'setcontent' && e.initial ) || isFullscreen() ) {
+                       if ( body && docElm ) {
+                               body.style.overflowY = 'auto';
+                               docElm.style.overflowY = 'auto'; // Old IE
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // Calculate outer height of the body element using CSS styles
</span><del>-               marginTop = editor.dom.getStyle(body, 'margin-top', true);
-               marginBottom = editor.dom.getStyle(body, 'margin-bottom', true);
-               myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10);
</del><ins>+                marginTop = editor.dom.getStyle( body, 'margin-top', true );
+               marginBottom = editor.dom.getStyle( body, 'margin-bottom', true );
+               myHeight = body.offsetHeight + parseInt( marginTop, 10 ) + parseInt( marginBottom, 10 );
</ins><span class="cx"> 
</span><span class="cx">          // Make sure we have a valid height
</span><del>-               if (isNaN(myHeight) || myHeight <= 0) {
</del><ins>+                if ( isNaN( myHeight ) || myHeight <= 0 ) {
</ins><span class="cx">                   // Get height differently depending on the browser used
</span><del>-                       myHeight = tinymce.Env.ie ? body.scrollHeight : (tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight);
</del><ins>+                        myHeight = tinymce.Env.ie ? body.scrollHeight : ( tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight );
</ins><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          // Don't make it smaller than the minimum height
</span><del>-               if (myHeight > settings.autoresize_min_height) {
</del><ins>+                if ( myHeight > settings.autoresize_min_height ) {
</ins><span class="cx">                   resizeHeight = myHeight;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // If a maximum height has been defined don't exceed this height
</span><del>-               if (settings.autoresize_max_height && myHeight > settings.autoresize_max_height) {
</del><ins>+                if ( settings.autoresize_max_height && myHeight > settings.autoresize_max_height ) {
</ins><span class="cx">                   resizeHeight = settings.autoresize_max_height;
</span><del>-                       body.style.overflowY = "auto";
-                       docElm.style.overflowY = "auto"; // Old IE
</del><ins>+                        body.style.overflowY = 'auto';
+                       docElm.style.overflowY = 'auto'; // Old IE
</ins><span class="cx">           } else {
</span><del>-                       body.style.overflowY = "hidden";
-                       docElm.style.overflowY = "hidden"; // Old IE
</del><ins>+                        body.style.overflowY = 'hidden';
+                       docElm.style.overflowY = 'hidden'; // Old IE
</ins><span class="cx">                   body.scrollTop = 0;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // Resize content element
</span><span class="cx">          if (resizeHeight !== oldSize) {
</span><span class="cx">                  deltaSize = resizeHeight - oldSize;
</span><del>-                       DOM.setStyle(DOM.get(editor.id + '_ifr'), 'height', resizeHeight + 'px');
</del><ins>+                        DOM.setStyle( DOM.get( editor.id + '_ifr'), 'height', resizeHeight + 'px' );
</ins><span class="cx">                   oldSize = resizeHeight;
</span><span class="cx"> 
</span><span class="cx">                  // WebKit doesn't decrease the size of the body element until the iframe gets resized
</span><span class="cx">                  // So we need to continue to resize the iframe down until the size gets fixed
</span><del>-                       if (tinymce.isWebKit && deltaSize < 0) {
-                               resize(e);
</del><ins>+                        if ( tinymce.isWebKit && deltaSize < 0 ) {
+                               resize( e );
</ins><span class="cx">                   }
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="lines">@@ -113,10 +113,10 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  // Define minimum height
</span><del>-       settings.autoresize_min_height = parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
</del><ins>+        settings.autoresize_min_height = parseInt(editor.getParam( 'autoresize_min_height', editor.getElement().offsetHeight), 10 );
</ins><span class="cx"> 
</span><span class="cx">  // Define maximum height
</span><del>-       settings.autoresize_max_height = parseInt(editor.getParam('autoresize_max_height', 0), 10);
</del><ins>+        settings.autoresize_max_height = parseInt(editor.getParam( 'autoresize_max_height', 0), 10 );
</ins><span class="cx"> 
</span><span class="cx">  function on() {
</span><span class="cx">          if ( ! editor.dom.hasClass( editor.getBody(), 'wp-autoresize' ) ) {
</span><span class="lines">@@ -161,166 +161,3 @@
</span><span class="cx">  editor.addCommand( 'wpAutoResizeOn', on );
</span><span class="cx">  editor.addCommand( 'wpAutoResizeOff', off );
</span><span class="cx"> });
</span><del>-/**
- * plugin.js
- *
- * Copyright, Moxiecode Systems AB
- * Released under LGPL License.
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-// Forked for WordPress so it can be turned on/off after loading.
-
-/*global tinymce:true */
-/*eslint no-nested-ternary:0 */
-
-/**
- * Auto Resize
- *
- * This plugin automatically resizes the content area to fit its content height.
- * It will retain a minimum height, which is the height of the content area when
- * it's initialized.
- */
-tinymce.PluginManager.add('wpautoresize', function(editor) {
-       var settings = editor.settings, oldSize = 0;
-
-       function isFullscreen() {
-               return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
-       }
-
-       if (editor.settings.inline) {
-               return;
-       }
-
-       /**
-        * This method gets executed each time the editor needs to resize.
-        */
-       function resize(e) {
-               var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight, marginTop, marginBottom;
-
-               doc = editor.getDoc();
-               if (!doc) {
-                       return;
-               }
-
-               body = doc.body;
-               docElm = doc.documentElement;
-               resizeHeight = settings.autoresize_min_height;
-
-               if (!body || (e && e.type === "setcontent" && e.initial) || isFullscreen()) {
-                       if (body && docElm) {
-                               body.style.overflowY = "auto";
-                               docElm.style.overflowY = "auto"; // Old IE
-                       }
-
-                       return;
-               }
-
-               // Calculate outer height of the body element using CSS styles
-               marginTop = editor.dom.getStyle(body, 'margin-top', true);
-               marginBottom = editor.dom.getStyle(body, 'margin-bottom', true);
-               myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10);
-
-               // Make sure we have a valid height
-               if (isNaN(myHeight) || myHeight <= 0) {
-                       // Get height differently depending on the browser used
-                       myHeight = tinymce.Env.ie ? body.scrollHeight : (tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight);
-               }
-
-               // Don't make it smaller than the minimum height
-               if (myHeight > settings.autoresize_min_height) {
-                       resizeHeight = myHeight;
-               }
-
-               // If a maximum height has been defined don't exceed this height
-               if (settings.autoresize_max_height && myHeight > settings.autoresize_max_height) {
-                       resizeHeight = settings.autoresize_max_height;
-                       body.style.overflowY = "auto";
-                       docElm.style.overflowY = "auto"; // Old IE
-               } else {
-                       body.style.overflowY = "hidden";
-                       docElm.style.overflowY = "hidden"; // Old IE
-                       body.scrollTop = 0;
-               }
-
-               // Resize content element
-               if (resizeHeight !== oldSize) {
-                       deltaSize = resizeHeight - oldSize;
-                       DOM.setStyle(DOM.get(editor.id + '_ifr'), 'height', resizeHeight + 'px');
-                       oldSize = resizeHeight;
-
-                       // WebKit doesn't decrease the size of the body element until the iframe gets resized
-                       // So we need to continue to resize the iframe down until the size gets fixed
-                       if (tinymce.isWebKit && deltaSize < 0) {
-                               resize(e);
-                       }
-               }
-       }
-
-       /**
-        * Calls the resize x times in 100ms intervals. We can't wait for load events since
-        * the CSS files might load async.
-        */
-       function wait( times, interval, callback ) {
-               setTimeout( function() {
-                       resize({});
-
-                       if ( times-- ) {
-                               wait( times, interval, callback );
-                       } else if ( callback ) {
-                               callback();
-                       }
-               }, interval );
-       }
-
-       // Define minimum height
-       settings.autoresize_min_height = parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
-
-       // Define maximum height
-       settings.autoresize_max_height = parseInt(editor.getParam('autoresize_max_height', 0), 10);
-
-       function on() {
-               if ( ! editor.dom.hasClass( editor.getBody(), 'wp-autoresize' ) ) {
-                       editor.dom.addClass( editor.getBody(), 'wp-autoresize' );
-                       // Add appropriate listeners for resizing the content area
-                       editor.on( 'nodechange setcontent keyup FullscreenStateChanged', resize );
-               }
-       }
-
-       function off() {
-               // Don't turn off if the setting is 'on'
-               if ( ! settings.wp_autoresize_on ) {
-                       editor.dom.removeClass( editor.getBody(), 'wp-autoresize' );
-                       editor.off( 'nodechange setcontent keyup FullscreenStateChanged', resize );
-                       oldSize = 0;
-               }
-       }
-
-       if ( settings.wp_autoresize_on ) {
-               // Turn resizing on when the editor loads
-               editor.on( 'init', function() {
-                       editor.dom.addClass( editor.getBody(), 'wp-autoresize' );
-               });
-               
-               editor.on( 'nodechange setcontent keyup FullscreenStateChanged', resize );
-       
-               if ( editor.getParam( 'autoresize_on_init', true ) ) {
-                       editor.on( 'init', function() {
-                               // Hit it 20 times in 100 ms intervals
-                               wait( 10, 200, function() {
-                                       // Hit it 5 times in 1 sec intervals
-                                       wait( 5, 1000 );
-                               });
-                       });
-               }
-       }
-
-       // Register the command
-       editor.addCommand( 'wpAutoResize', resize );
-
-       // On/off
-       editor.addCommand( 'wpAutoResizeOn', on );
-       editor.addCommand( 'wpAutoResizeOff', off );
-});
</del></span></pre>
</div>
</div>

</body>
</html>