Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 119 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 120 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 48 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 239 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 240 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 239 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 240 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -1262,6 +1262,26 @@ |
1263 | 1263 | context.view = 'wikitext'; |
1264 | 1264 | // Trigger the "resize" event anytime the window is resized |
1265 | 1265 | $( window ).resize( function( event ) { context.fn.trigger( 'resize', event ); } ); |
| 1266 | + // Create a dummy iframe for copy/paste filtering |
| 1267 | + context.$bucket = $( '<iframe></iframe>' ) |
| 1268 | + .attr( { |
| 1269 | + 'frameBorder': 0, |
| 1270 | + 'border': 0, |
| 1271 | + 'src': wgScriptPath + '/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?' + |
| 1272 | + 'instance=' + context.instance + '&ts=' + ( new Date() ).getTime() + '&is=bucket', |
| 1273 | + 'id': 'wikiEditor-bucket-' + context.instance |
| 1274 | + } ) |
| 1275 | + .css( { |
| 1276 | + 'height': '1px', |
| 1277 | + 'width': '1px', |
| 1278 | + 'position': 'absolute' |
| 1279 | + } ) |
| 1280 | + .insertAfter( context.$textarea ) |
| 1281 | + .load( function() { |
| 1282 | + // Allthough IE will do this twice (designMode will dump the body and reload), we aren't binding anything, |
| 1283 | + // so it's ok - if that changes, see the technique used in the $iframe load |
| 1284 | + context.$iframe[0].contentWindow.document.designMode = 'on'; |
| 1285 | + } ); |
1266 | 1286 | // Create an iframe in place of the text area |
1267 | 1287 | context.$iframe = $( '<iframe></iframe>' ) |
1268 | 1288 | .attr( { |
— | — | @@ -1269,7 +1289,7 @@ |
1270 | 1290 | 'border': 0, |
1271 | 1291 | 'tabindex': 1, |
1272 | 1292 | 'src': wgScriptPath + '/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?' + |
1273 | | - 'instance=' + context.instance + '&ts=' + ( new Date() ).getTime(), |
| 1293 | + 'instance=' + context.instance + '&ts=' + ( new Date() ).getTime() + '&is=content', |
1274 | 1294 | 'id': 'wikiEditor-iframe-' + context.instance |
1275 | 1295 | } ) |
1276 | 1296 | .css( { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -7695,6 +7695,26 @@ |
7696 | 7696 | context.view = 'wikitext'; |
7697 | 7697 | // Trigger the "resize" event anytime the window is resized |
7698 | 7698 | $( window ).resize( function( event ) { context.fn.trigger( 'resize', event ); } ); |
| 7699 | + // Create a dummy iframe for copy/paste filtering |
| 7700 | + context.$bucket = $( '<iframe></iframe>' ) |
| 7701 | + .attr( { |
| 7702 | + 'frameBorder': 0, |
| 7703 | + 'border': 0, |
| 7704 | + 'src': wgScriptPath + '/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?' + |
| 7705 | + 'instance=' + context.instance + '&ts=' + ( new Date() ).getTime() + '&is=bucket', |
| 7706 | + 'id': 'wikiEditor-bucket-' + context.instance |
| 7707 | + } ) |
| 7708 | + .css( { |
| 7709 | + 'height': '1px', |
| 7710 | + 'width': '1px', |
| 7711 | + 'position': 'absolute' |
| 7712 | + } ) |
| 7713 | + .insertAfter( context.$textarea ) |
| 7714 | + .load( function() { |
| 7715 | + // Allthough IE will do this twice (designMode will dump the body and reload), we aren't binding anything, |
| 7716 | + // so it's ok - if that changes, see the technique used in the $iframe load |
| 7717 | + context.$iframe[0].contentWindow.document.designMode = 'on'; |
| 7718 | + } ); |
7699 | 7719 | // Create an iframe in place of the text area |
7700 | 7720 | context.$iframe = $( '<iframe></iframe>' ) |
7701 | 7721 | .attr( { |
— | — | @@ -7702,7 +7722,7 @@ |
7703 | 7723 | 'border': 0, |
7704 | 7724 | 'tabindex': 1, |
7705 | 7725 | 'src': wgScriptPath + '/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?' + |
7706 | | - 'instance=' + context.instance + '&ts=' + ( new Date() ).getTime(), |
| 7726 | + 'instance=' + context.instance + '&ts=' + ( new Date() ).getTime() + '&is=content', |
7707 | 7727 | 'id': 'wikiEditor-iframe-' + context.instance |
7708 | 7728 | } ) |
7709 | 7729 | .css( { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -534,7 +534,7 @@ |
535 | 535 | pos=nextPos+(leavingP?1:0);if(t.node.nodeName=='#text'){lastTextNode=t.node;lastTextNodeDepth=t.depth;} |
536 | 536 | t=nextT;}},'saveSelection':function(){if(!$.browser.msie){return;} |
537 | 537 | context.$iframe[0].contentWindow.focus();context.savedSelection=context.$iframe[0].contentWindow.document.selection.createRange();},'restoreSelection':function(){if(!$.browser.msie||context.savedSelection===null){return;} |
538 | | -context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};var $loader=$('<div></div>').addClass('wikiEditor-ui-loading').append($('<span>'+mw.usability.getMsg('wikieditor-loading')+'</span>').css('marginTop',context.$textarea.height()/2));context.$textarea.after($loader).add($loader).wrapAll($('<div></div>').addClass('wikiEditor-ui')).wrapAll($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrapAll($('<div></div>').addClass('wikiEditor-ui-left')).wrapAll($('<div></div>').addClass('wikiEditor-ui-bottom')).wrapAll($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'tabindex':1,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}} |
| 538 | +context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};var $loader=$('<div></div>').addClass('wikiEditor-ui-loading').append($('<span>'+mw.usability.getMsg('wikieditor-loading')+'</span>').css('marginTop',context.$textarea.height()/2));context.$textarea.after($loader).add($loader).wrapAll($('<div></div>').addClass('wikiEditor-ui')).wrapAll($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrapAll($('<div></div>').addClass('wikiEditor-ui-left')).wrapAll($('<div></div>').addClass('wikiEditor-ui-bottom')).wrapAll($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$bucket=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime()+'&is=bucket','id':'wikiEditor-bucket-'+context.instance}).css({'height':'1px','width':'1px','position':'absolute'}).insertAfter(context.$textarea).load(function(){context.$iframe[0].contentWindow.document.designMode='on';});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'tabindex':1,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime()+'&is=content','id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}} |
539 | 539 | context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/&esc;/g,'&esc;esc;').replace(/\<p\>/g,'&esc;<p>').replace(/\<\/p\>/g,'&esc;</p>').replace(/\<span class="wikiEditor-tab"\>\<\/span\>/g,'&esc;<span class="wikiEditor-tab"></span>').replace(/ /g,'&esc;&nbsp;');if($.browser.msie){html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');if($.browser.versionNumber<=7){html=html.replace(/ /g," ");}else{html=html.replace(/(^|\n) /g,"$1 ");}} |
540 | 540 | html=$('<div />').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&nbsp;/g,' ').replace(/<p>/g,'<p>').replace(/<\/p>/g,'</p>').replace(/<p><\/p>/g,'<p><br></p>').replace(/&esc;&amp;nbsp;/g,'&nbsp;').replace(/&esc;&lt;p&gt;/g,'<p>').replace(/&esc;&lt;\/p&gt;/g,'</p>').replace(/&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g,'<span class="wikiEditor-tab"><\/span>').replace(/&esc;esc;/g,'&esc;');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
541 | 541 | context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$('.wikiEditor-ui-loading').fadeOut('fast',function(){$(this).remove();});$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('paste',function(event){return context.fn.trigger('paste',event);}).bind('keyup paste mouseup cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup paste mouseup cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};} |