r63518 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63517‎ | r63518 | r63519 >
Date:22:13, 9 March 2010
Author:pdhanda
Status:ok
Tags:
Comment:
New combined js files for changes to wikiEditor.js
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)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.delayedBind.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' => 161 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 162 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 37 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
@@ -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' => 311 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 312 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 311 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 312 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6922,18 +6922,17 @@
69236923 if ( context.oldDelayedHTML != newHTML ) {
69246924 context.oldDelayedHTML = newHTML;
69256925 event.data.scope = 'realchange';
6926 - }
6927 -
6928 - //surround by <p> if it does not already have it
6929 - var t = context.fn.getOffset();
6930 - if ( t.node.parentNode.nodeName.toLowerCase() == 'body' ) {
6931 - var cursorPos = context.fn.getCaretPosition()[0];
6932 - $( t.node ).wrap( "<p></p>" );
6933 - context.fn.refreshOffsets();
6934 - context.fn.setSelection( { start: cursorPos, end: cursorPos } );
6935 - }
6936 -
6937 -
 6926+
 6927+ //surround by <p> if it does not already have it
 6928+ var cursorPos = context.fn.getCaretPosition();
 6929+ var t = context.fn.getOffset(cursorPos[0]);
 6930+ if ( t.node.parentNode.nodeName.toLowerCase() == 'body' ) {
 6931+ $( t.node ).wrap( "<p></p>" );
 6932+ context.fn.purgeOffsets();
 6933+ context.fn.setSelection( { start: cursorPos[0], end: cursorPos[1] } );
 6934+ }
 6935+ }
 6936+
69386937 context.fn.updateHistory( event.data.scope == 'realchange' );
69396938 return true;
69406939 },
@@ -7032,7 +7031,7 @@
70337032
70347033 // Restore cursor position
70357034 context.fn.purgeOffsets();
7036 - var restoreTo = cursorPos[0] + context.fn.getContents().length - oldLength;
 7035+ var restoreTo = cursorPos[1] + context.fn.getContents().length - oldLength;
70377036 context.fn.setSelection( { start: restoreTo, end: restoreTo } );
70387037 }, 0 );
70397038 return true;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -460,8 +460,7 @@
461461 break;case 86:if(event.ctrlKey){context.evt.paste(event);}
462462 break;}
463463 return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';}
464 -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';}
465 -var t=context.fn.getOffset();if(t.node.parentNode.nodeName.toLowerCase()=='body'){var cursorPos=context.fn.getCaretPosition()[0];$(t.node).wrap("<p></p>");context.fn.refreshOffsets();context.fn.setSelection({start:cursorPos,end:cursorPos});}
 464+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';var cursorPos=context.fn.getCaretPosition();var t=context.fn.getOffset(cursorPos[0]);if(t.node.parentNode.nodeName.toLowerCase()=='body'){$(t.node).wrap("<p></p>");context.fn.purgeOffsets();context.fn.setSelection({start:cursorPos[0],end:cursorPos[1]});}}
466465 context.fn.updateHistory(event.data.scope=='realchange');return true;},'cut':function(event){setTimeout(function(){context.$content.find('br').each(function(){if($(this).parent().is('body')){$(this).wrap($('<p></p>'));}});},100);return true;},'paste':function(event){var cursorPos=context.fn.getCaretPosition();var oldLength=context.fn.getContents().length;context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');}
467466 setTimeout(function(){context.$content.find('script,style,img,input,select,textarea,hr,button,link,meta').remove();context.$content.find('*').each(function(){if($(this).children().length==0&&this.childNodes.length>0){$(this).text($(this).text());}});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;}
468467 else if((t.node.nodeValue.indexOf('\n')!=1||t.node.nodeValue.indexOf('\r')!=-1)){t.node.nodeValue=t.node.nodeValue.replace(/\r|\n/g,' ');}}
@@ -471,7 +470,7 @@
472471 $currentElement.remove();}else{$newElement=$('<span></span>').html(html).insertAfter($currentElement);$newElement.replaceWith($newElement[0].childNodes);$currentElement.remove();}
473472 $selection=context.$content.find(':not(.wikiEditor)');}
474473 context.$content.find('.wikiEditor').removeClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.removeClass('pasting');}
475 -context.fn.purgeOffsets();var restoreTo=cursorPos[0]+context.fn.getContents().length-oldLength;context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
 474+context.fn.purgeOffsets();var restoreTo=cursorPos[1]+context.fn.getContents().length-oldLength;context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
476475 if(typeof event.data=='undefined'){event.data={};}
477476 if(name in context.evt){if(!context.evt[name](event)){return false;}}
478477 for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}

Status & tagging log