Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1921,18 +1921,24 @@ |
1922 | 1922 | }); |
1923 | 1923 | } |
1924 | 1924 | var dialog = $j(this).closest( '.ui-dialog' ); |
1925 | | - $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
1926 | | - if ( ( e.keyCode || e.which ) == 13 ) { |
1927 | | - var button = dialog.data( 'dialogaction' ) || dialog.find( 'button:first' ); |
1928 | | - button.click(); |
1929 | | - e.preventDefault(); |
1930 | | - } |
1931 | | - }); |
| 1925 | + var that = this; |
| 1926 | + $j( $j(this).data( 'context' ).$iframe[0].contentWindow.document ) |
| 1927 | + .bind( 'keypress.srdialog', function( e ) { |
| 1928 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1929 | + // Enter |
| 1930 | + var button = dialog.data( 'dialogaction' ) || dialog.find( 'button:first' ); |
| 1931 | + button.click(); |
| 1932 | + e.preventDefault(); |
| 1933 | + } else if ( ( e.keyCode || e.which ) == 27 ) { |
| 1934 | + // Escape |
| 1935 | + $j(that).dialog( 'close' ); |
| 1936 | + } |
| 1937 | + }); |
1932 | 1938 | }, |
1933 | 1939 | close: function() { |
1934 | | - $j(this).data( 'context' ).$textarea |
1935 | | - .unbind( 'keypress.srdialog' ) |
1936 | | - .focus(); |
| 1940 | + $j( $j(this).data( 'context' ).$iframe[0].contentWindow.document ) |
| 1941 | + .unbind( 'keypress.srdialog' ); |
| 1942 | + $j(this).data( 'context' ).$iframe[0].contentWindow.focus(); |
1937 | 1943 | $j(this).closest( '.ui-dialog' ).data( 'dialogaction', false ); |
1938 | 1944 | } |
1939 | 1945 | } |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -169,5 +169,5 @@ |
170 | 170 | s=s.substr(index+match[i].length);var start=index+offset;var end=start+match[i].length;var newEnd=start+replaceStr.length;$textarea.textSelection('setSelection',{'start':start,'end':end}).textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});offset=newEnd;} |
171 | 171 | $j('#wikieditor-toolbar-replace-success').text(gM('wikieditor-toolbar-tool-replace-success',match.length)).show();$j(this).data('offset',0);}else{var start=match.index+offset;var end=start+match[0].length;var newEnd=start+replaceStr.length;$textarea.textSelection('setSelection',{'start':start,'end':end});if(mode=='replace'){$textarea.textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});} |
172 | 172 | $textarea.textSelection('scrollToCaretPosition');$j(this).data('offset',mode=='replace'?newEnd:end);}});},dialog:{width:500,buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();if(!($j(this).data('onetimeonlystuff'))){$j(this).data('onetimeonlystuff',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});} |
173 | | -var dialog=$j(this).closest('.ui-dialog');$j(this).data('context').$textarea.bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}});},close:function(){$j(this).data('context').$textarea.unbind('keypress.srdialog').focus();$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});mw.loadDone('wikiEditor.config.toolbar');mw.addMessages({"wikieditor-template-editor-preference":"Enable form-based editing of wiki templates"});mw.ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;} |
| 173 | +var dialog=$j(this).closest('.ui-dialog');var that=this;$j($j(this).data('context').$iframe[0].contentWindow.document).bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}else if((e.keyCode||e.which)==27){$j(that).dialog('close');}});},close:function(){$j($j(this).data('context').$iframe[0].contentWindow.document).unbind('keypress.srdialog');$j(this).data('context').$iframe[0].contentWindow.focus();$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});mw.loadDone('wikiEditor.config.toolbar');mw.addMessages({"wikieditor-template-editor-preference":"Enable form-based editing of wiki templates"});mw.ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;} |
174 | 174 | if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}});mw.loadDone('wikiEditor.config.templateEditor'); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -1840,18 +1840,24 @@ |
1841 | 1841 | }); |
1842 | 1842 | } |
1843 | 1843 | var dialog = $j(this).closest( '.ui-dialog' ); |
1844 | | - $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
1845 | | - if ( ( e.keyCode || e.which ) == 13 ) { |
1846 | | - var button = dialog.data( 'dialogaction' ) || dialog.find( 'button:first' ); |
1847 | | - button.click(); |
1848 | | - e.preventDefault(); |
1849 | | - } |
1850 | | - }); |
| 1844 | + var that = this; |
| 1845 | + $j( $j(this).data( 'context' ).$iframe[0].contentWindow.document ) |
| 1846 | + .bind( 'keypress.srdialog', function( e ) { |
| 1847 | + if ( ( e.keyCode || e.which ) == 13 ) { |
| 1848 | + // Enter |
| 1849 | + var button = dialog.data( 'dialogaction' ) || dialog.find( 'button:first' ); |
| 1850 | + button.click(); |
| 1851 | + e.preventDefault(); |
| 1852 | + } else if ( ( e.keyCode || e.which ) == 27 ) { |
| 1853 | + // Escape |
| 1854 | + $j(that).dialog( 'close' ); |
| 1855 | + } |
| 1856 | + }); |
1851 | 1857 | }, |
1852 | 1858 | close: function() { |
1853 | | - $j(this).data( 'context' ).$textarea |
1854 | | - .unbind( 'keypress.srdialog' ) |
1855 | | - .focus(); |
| 1859 | + $j( $j(this).data( 'context' ).$iframe[0].contentWindow.document ) |
| 1860 | + .unbind( 'keypress.srdialog' ); |
| 1861 | + $j(this).data( 'context' ).$iframe[0].contentWindow.focus(); |
1856 | 1862 | $j(this).closest( '.ui-dialog' ).data( 'dialogaction', false ); |
1857 | 1863 | } |
1858 | 1864 | } |