r62589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62588‎ | r62589 | r62590 >
Date:19:49, 16 February 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixed line breaks being lost on text copied from Webkit browsers (which encapsulate the paste with a span with class "Apple-style-span". Should resolve bug #22428
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 134 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 135 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 31 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 49 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 15 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 256 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 257 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 256 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 257 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -389,6 +389,10 @@
390390 context.$content.addClass( 'pasting' );
391391 }
392392 setTimeout( function() {
 393+ // Unwrap the span found in webkit copies
 394+ context.$content.find( 'span.Apple-style-span' ).each( function() {
 395+ $( this.childNodes ).insertBefore( this );
 396+ } ).remove();
393397 var $selection = context.$content.find( ':not(.wikiEditor)' );
394398 while ( $selection.length && $selection.length > 0 ) {
395399 var $currentElement = $selection.eq( 0 );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6822,6 +6822,10 @@
68236823 context.$content.addClass( 'pasting' );
68246824 }
68256825 setTimeout( function() {
 6826+ // Unwrap the span found in webkit copies
 6827+ context.$content.find( 'span.Apple-style-span' ).each( function() {
 6828+ $( this.childNodes ).insertBefore( this );
 6829+ } ).remove();
68266830 var $selection = context.$content.find( ':not(.wikiEditor)' );
68276831 while ( $selection.length && $selection.length > 0 ) {
68286832 var $currentElement = $selection.eq( 0 );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -456,7 +456,7 @@
457457 switch(event.which){case 8:break;}
458458 return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';}
459459 context.fn.updateHistory(event.data.scope=='realchange');return true;},'paste':function(event){context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');}
460 -setTimeout(function(){var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();}
 460+setTimeout(function(){context.$content.find('span.Apple-style-span').each(function(){$(this.childNodes).insertBefore(this);}).remove();var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();}
461461 var text=$currentElement.text();if($currentElement.is('br')){$currentElement.addClass('wikiEditor');}else if($currentElement.is('span')&&text.length==0){$currentElement.remove();}else{$newElement=$('<p></p>').addClass('wikiEditor').insertAfter($currentElement);if(text.length){$newElement.text(text);}else{$newElement.append($('<br>').addClass('wikiEditor'));}
462462 $currentElement.remove();}
463463 $selection=context.$content.find(':not(.wikiEditor)');}

Status & tagging log