r61617 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61616‎ | r61617 | r61618 >
Date:00:31, 28 January 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: Fix bug where placing the cursor on an empty line confuses TOC highlighting (for real this time). Also comment out handling of <div>s for Webkit: doesn't fix Webkit properly and breaks all others
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' => 26 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 78 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 79 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 25 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 45 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ),
@@ -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' => 191 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 192 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 191 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 192 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -369,8 +369,8 @@
370370 .replace( /&nbsp;/g, " " ) // We inserted these to prevent IE from collapsing spaces
371371 .replace( /\<p[^\>]*\>/gi, "\n" ) // IE uses </p><p> for user-inserted line breaks
372372 .replace( /\<\/p[^\>]*\>/gi, "" )
373 - .replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </div><div> for user-inserted line breaks
374 - .replace( /\<\/div[^\>]*\>/gi, "" )
 373+ //.replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </div><div> for user-inserted line breaks
 374+ //.replace( /\<\/div[^\>]*\>/gi, "" )
375375 + '</pre>' );
376376 // Get rid of the noincludes when getting text
377377 $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } );
@@ -652,7 +652,7 @@
653653 // Start at the selection's start and traverse the DOM backwards
654654 // This is done by traversing an element's children first, then the element itself, then its parent
655655 e = selection.getRangeAt( 0 ).startContainer;
656 - offset = selection.startOffset;
 656+ offset = selection.getRangeAt( 0 ).startOffset;
657657 } else {
658658 return $( [] );
659659 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6793,8 +6793,8 @@
67946794 .replace( /&nbsp;/g, " " ) // We inserted these to prevent IE from collapsing spaces
67956795 .replace( /\<p[^\>]*\>/gi, "\n" ) // IE uses </p><p> for user-inserted line breaks
67966796 .replace( /\<\/p[^\>]*\>/gi, "" )
6797 - .replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </div><div> for user-inserted line breaks
6798 - .replace( /\<\/div[^\>]*\>/gi, "" )
 6797+ //.replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </div><div> for user-inserted line breaks
 6798+ //.replace( /\<\/div[^\>]*\>/gi, "" )
67996799 + '</pre>' );
68006800 // Get rid of the noincludes when getting text
68016801 $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } );
@@ -7076,7 +7076,7 @@
70777077 // Start at the selection's start and traverse the DOM backwards
70787078 // This is done by traversing an element's children first, then the element itself, then its parent
70797079 e = selection.getRangeAt( 0 ).startContainer;
7080 - offset = selection.startOffset;
 7080+ offset = selection.getRangeAt( 0 ).startOffset;
70817081 } else {
70827082 return $( [] );
70837083 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -449,7 +449,7 @@
450450 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
451451 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
452452 addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){var $pre=$('<pre>'+
453 -html.replace(/\r?\n/g,"").replace(/\<br[^\>]*\>/gi,"\n").replace(/&nbsp;/g," ").replace(/\<p[^\>]*\>/gi,"\n").replace(/\<\/p[^\>]*\>/gi,"").replace(/\<div[^\>]*\>/gi,"\n").replace(/\<\/div[^\>]*\>/gi,"")
 453+html.replace(/\r?\n/g,"").replace(/\<br[^\>]*\>/gi,"\n").replace(/&nbsp;/g," ").replace(/\<p[^\>]*\>/gi,"\n").replace(/\<\/p[^\>]*\>/gi,"")
454454 +'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t")});return $pre.text();},'getContents':function(){return context.fn.htmlToText(context.$content.html());},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
455455 if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(retval.toString){retval=retval.toString();}
456456 return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}
@@ -472,7 +472,7 @@
473473 return context.$textarea;},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body'),parentHtml=$('html'),parentBody=$('body');var y=$element.offset().top;if(!$.browser.msie&&!$element.is('body')){y=parentHtml.scrollTop()>0?y+html.scrollTop()-parentHtml.scrollTop():y;y=parentBody.scrollTop()>0?y+body.scrollTop()-parentBody.scrollTop():y;}
474474 var topBound=html.scrollTop()>body.scrollTop()?html.scrollTop():body.scrollTop(),bottomBound=topBound+context.$iframe.height();if(force||y<topBound||y>bottomBound){html.scrollTop(y);body.scrollTop(y);}
475475 $element.trigger('scrollToTop');},'beforeSelection':function(selector,strict){if(typeof selector=='undefined'){selector='*';}
476 -var e,offset;if(context.$iframe[0].contentWindow.getSelection){var selection=context.$iframe[0].contentWindow.getSelection();if(selection.baseNode!==null){e=selection.getRangeAt(0).startContainer;offset=selection.startOffset;}else{return $([]);}}else if(context.$iframe[0].contentWindow.document.selection){var range=context.$iframe[0].contentWindow.document.selection.createRange();var range2=context.$iframe[0].contentWindow.document.body.createTextRange();try{range2.setEndPoint('EndToStart',range);}catch(e){return $([]);}
 476+var e,offset;if(context.$iframe[0].contentWindow.getSelection){var selection=context.$iframe[0].contentWindow.getSelection();if(selection.baseNode!==null){e=selection.getRangeAt(0).startContainer;offset=selection.getRangeAt(0).startOffset;}else{return $([]);}}else if(context.$iframe[0].contentWindow.document.selection){var range=context.$iframe[0].contentWindow.document.selection.createRange();var range2=context.$iframe[0].contentWindow.document.body.createTextRange();try{range2.setEndPoint('EndToStart',range);}catch(e){return $([]);}
477477 var seekPos=context.fn.htmlToText(range2.htmlText).length;var offset=context.fn.getOffset(seekPos);e=offset?offset.node:null;offset=offset?offset.offset:null;if(!e){return $([]);}}
478478 if(e.nodeName!='#text'){var newE=e.firstChild;for(var i=0;i<offset-1&&newE;i++){newE=newE.nextSibling;}
479479 while(newE&&newE.lastChild){newE=newE.lastChild;}

Status & tagging log