r62891 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62890‎ | r62891 | r62892 >
Date:21:05, 23 February 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixed stripping of text pasted from a copy of part of a line.
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' => 145 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 146 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 34 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 50 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 18 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 277 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 278 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 277 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 278 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -435,7 +435,7 @@
436436 } else if ( $currentElement.is( 'span' ) && text.length == 0 ) {
437437 // Markers!
438438 $currentElement.remove();
439 - } else {
 439+ } else if ( $currentElement.is( 'p' ) || $currentElement.is( 'div' ) ) {
440440 $newElement = $( '<p></p>' )
441441 .addClass( 'wikiEditor' )
442442 .insertAfter( $currentElement );
@@ -445,6 +445,12 @@
446446 $newElement.append( $( '<br>' ).addClass( 'wikiEditor' ) );
447447 }
448448 $currentElement.remove();
 449+ } else {
 450+ $( '<span></span>' )
 451+ .addClass( 'wikiEditor' )
 452+ .text( $currentElement.text() )
 453+ .insertAfter( $currentElement );
 454+ $currentElement.remove();
449455 }
450456 $selection = context.$content.find( ':not(.wikiEditor)' );
451457 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6868,7 +6868,7 @@
68696869 } else if ( $currentElement.is( 'span' ) && text.length == 0 ) {
68706870 // Markers!
68716871 $currentElement.remove();
6872 - } else {
 6872+ } else if ( $currentElement.is( 'p' ) || $currentElement.is( 'div' ) ) {
68736873 $newElement = $( '<p></p>' )
68746874 .addClass( 'wikiEditor' )
68756875 .insertAfter( $currentElement );
@@ -6878,6 +6878,12 @@
68796879 $newElement.append( $( '<br>' ).addClass( 'wikiEditor' ) );
68806880 }
68816881 $currentElement.remove();
 6882+ } else {
 6883+ $( '<span></span>' )
 6884+ .addClass( 'wikiEditor' )
 6885+ .text( $currentElement.text() )
 6886+ .insertAfter( $currentElement );
 6887+ $currentElement.remove();
68826888 }
68836889 $selection = context.$content.find( ':not(.wikiEditor)' );
68846890 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -458,8 +458,8 @@
459459 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';}
460460 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');}
461461 setTimeout(function(){context.$content.find('link, style, meta').remove();context.$content.find('p:not(.wikiEditor) p:not(.wikiEditor)').each(function(){var outerParent=$(this).parent();outerParent.replaceWith(outerParent.childNodes());});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();}
462 -$currentElement.find('*').each(function(){if($(this).children()==0&&this.childNodes.length>0){$(this).text($(this).text());}});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'));}
463 -$currentElement.remove();}
 462+$currentElement.find('*').each(function(){if($(this).children()==0&&this.childNodes.length>0){$(this).text($(this).text());}});var text=$currentElement.text();if($currentElement.is('br')){$currentElement.addClass('wikiEditor');}else if($currentElement.is('span')&&text.length==0){$currentElement.remove();}else if($currentElement.is('p')||$currentElement.is('div')){$newElement=$('<p></p>').addClass('wikiEditor').insertAfter($currentElement);if(text.length){$newElement.text(text);}else{$newElement.append($('<br>').addClass('wikiEditor'));}
 463+$currentElement.remove();}else{$('<span></span>').addClass('wikiEditor').text($currentElement.text()).insertAfter($currentElement);$currentElement.remove();}
464464 $selection=context.$content.find(':not(.wikiEditor)');}
465465 context.$content.find('.wikiEditor').removeClass('wikiEditor');var t=context.fn.traverser(context.$content);while(t){if(t.node.nodeName=='#text'){if(t.node.nodeValue==='\n'){$('<p><br></p>').insertAfter($(t.node));var oldNode=t.node;t=t.next();$(oldNode).remove();continue;}
466466 else if(t.node.nodeValue.search(/\S+/)==-1){var oldNode=t.node;t=t.next();$(oldNode).remove();continue;}

Status & tagging log