r58309 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58308‎ | r58309 | r58310 >
Date:11:10, 29 October 2009
Author:catrope
Status:deferred
Tags:
Comment:
* EditToolbar: Fix bug 21216 properly this time
* (bug 21291) Resizing bug in table dialog
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php (modified) (history)
  • /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.dialogs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -71,14 +71,14 @@
7272 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 16 ),
7373 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 17 ),
75 - array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 6 ),
 75+ array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 7 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 22 ),
7777 ),
7878 'combined' => array(
79 - array( 'src' => 'js/plugins.combined.js', 'version' => 52 ),
 79+ array( 'src' => 'js/plugins.combined.js', 'version' => 53 ),
8080 ),
8181 'minified' => array(
82 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 52 ),
 82+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 53 ),
8383 ),
8484 ),
8585 );
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -1019,10 +1019,15 @@
10201020 var whitespace = $j( '#edittoolbar-link-dialog' ).data( 'whitespace' );
10211021 var target = $j( '#edittoolbar-link-int-target' ).val();
10221022 var text = $j( '#edittoolbar-link-int-text' ).val();
1023 - if ( text == '' ) {
 1023+ if ( target == '' ) {
10241024 alert( gM( 'edittoolbar-tool-link-empty' ) );
10251025 return;
10261026 }
 1027+ if ( $j.trim( text ) == '' ) {
 1028+ // [[Foo| ]] creates an invisible link
 1029+ // Instead, generate [[Foo|]]
 1030+ text = '';
 1031+ }
10271032 if ( $j( '#edittoolbar-link-type-int' ).is( ':checked' ) ) {
10281033 // FIXME: Exactly how fragile is this?
10291034 if ( $j( '#edittoolbar-link-int-target-status-invalid' ).is( ':visible' ) ) {
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.min.js
@@ -47,7 +47,8 @@
4848 request.abort();}});},dialog:{width:500,buttons:{'edittoolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');}
4949 function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/]/g,'%5D');}
5050 function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');}
51 -var insertText='';var whitespace=$j('#edittoolbar-link-dialog').data('whitespace');var target=$j('#edittoolbar-link-int-target').val();var text=$j('#edittoolbar-link-int-text').val();if(text==''){alert(gM('edittoolbar-tool-link-empty'));return;}
 51+var insertText='';var whitespace=$j('#edittoolbar-link-dialog').data('whitespace');var target=$j('#edittoolbar-link-int-target').val();var text=$j('#edittoolbar-link-int-text').val();if(target==''){alert(gM('edittoolbar-tool-link-empty'));return;}
 52+if($j.trim(text)==''){text='';}
5253 if($j('#edittoolbar-link-type-int').is(':checked')){if($j('#edittoolbar-link-int-target-status-invalid').is(':visible')){alert(gM('edittoolbar-tool-link-int-invalid'));return;}
5354 if(target==text)
5455 insertText='[['+target+']]';else
@@ -125,12 +126,12 @@
126127 <div id="edittoolbar-replace-emptysearch" rel="edittoolbar-tool-replace-emptysearch"></div>\
127128 <div id="edittoolbar-replace-invalidregex"></div>\
128129 </div>\
129 - <fieldset><table><tr>\
 130+ <fieldset><table style="width: 100%;"><tr>\
130131 <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\
131 - <td><input type="text" id="edittoolbar-replace-search" /></td>\
 132+ <td><input type="text" id="edittoolbar-replace-search" style="width: 100%;" /></td>\
132133 </tr><tr>\
133134 <td><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label></td>\
134 - <td><input type="text" id="edittoolbar-replace-replace" /></td>\
 135+ <td><input type="text" id="edittoolbar-replace-replace" style="width: 100%;" /></td>\
135136 </tr></table><table><tr>\
136137 <td><input type="checkbox" id="edittoolbar-replace-case" /></td>\
137138 <td><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label></td>\
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -19,7 +19,7 @@
2020 /* Configuration */
2121
2222 // Bump the version number every time you change any of the .css/.js files
23 -$wgEditToolbarStyleVersion = 64;
 23+$wgEditToolbarStyleVersion = 65;
2424
2525 // Set this to true to simply override the stock toolbar for everyone
2626 $wgEditToolbarGlobalEnable = false;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js
@@ -123,8 +123,16 @@
124124 $(this).css( 'white-space', 'nowrap' );
125125
126126 if ( wrapper.width() <= $(this).get(0).scrollWidth ) {
127 - $(this).width( $(this).get(0).scrollWidth );
128 - wrapper.width( wrapper.get(0).scrollWidth );
 127+ var thisWidth = $(this).data( 'thisWidth' ) ? $(this).data( 'thisWidth' ) : 0;
 128+ thisWidth = Math.max( $(this).get(0).scrollWidth, thisWidth );
 129+ $(this).width( thisWidth );
 130+ $(this).data( 'thisWidth', thisWidth );
 131+
 132+ var wrapperWidth = $(this).data( 'wrapperWidth' ) ? $(this).data( 'wrapperWidth' ) : 0;
 133+ wrapperWidth = Math.max( wrapper.get(0).scrollWidth, wrapperWidth );
 134+ wrapper.width( wrapperWidth );
 135+ $(this).data( 'wrapperWidth', wrapperWidth );
 136+
129137 $(this).dialog( { 'width': wrapper.width() } );
130138 wrapper.css( 'left',
131139 parseInt( wrapper.css( 'left' ) ) -
@@ -135,6 +143,7 @@
136144 oldHidden.each( function() {
137145 $(this).attr( 'style', $(this).data( 'oldstyle' ) );
138146 });
 147+
139148 }
140149 },
141150 modules: {},
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1601,8 +1601,16 @@
16021602 $(this).css( 'white-space', 'nowrap' );
16031603
16041604 if ( wrapper.width() <= $(this).get(0).scrollWidth ) {
1605 - $(this).width( $(this).get(0).scrollWidth );
1606 - wrapper.width( wrapper.get(0).scrollWidth );
 1605+ var thisWidth = $(this).data( 'thisWidth' ) ? $(this).data( 'thisWidth' ) : 0;
 1606+ thisWidth = Math.max( $(this).get(0).scrollWidth, thisWidth );
 1607+ $(this).width( thisWidth );
 1608+ $(this).data( 'thisWidth', thisWidth );
 1609+
 1610+ var wrapperWidth = $(this).data( 'wrapperWidth' ) ? $(this).data( 'wrapperWidth' ) : 0;
 1611+ wrapperWidth = Math.max( wrapper.get(0).scrollWidth, wrapperWidth );
 1612+ wrapper.width( wrapperWidth );
 1613+ $(this).data( 'wrapperWidth', wrapperWidth );
 1614+
16071615 $(this).dialog( { 'width': wrapper.width() } );
16081616 wrapper.css( 'left',
16091617 parseInt( wrapper.css( 'left' ) ) -
@@ -1613,6 +1621,7 @@
16141622 oldHidden.each( function() {
16151623 $(this).attr( 'style', $(this).data( 'oldstyle' ) );
16161624 });
 1625+
16171626 }
16181627 },
16191628 modules: {},
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -91,7 +91,7 @@
9292 return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}},closeDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}
9393 mvJsLoader.doLoad(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons)
9494 configuration.newButtons[gM(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration).bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
95 -maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){$(this).width($(this).get(0).scrollWidth);wrapper.width(wrapper.get(0).scrollWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-
 95+maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-
9696 (wrapper.width()-oldWidth)/2);}
9797 $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;}
9898 $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));$section=$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r58198* EditToolbar: (bug 21269) Header dropdown cleverness, so selecting "== Foo =...catrope15:43, 27 October 2009

Status & tagging log