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' => 133 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 134 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 31 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 49 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 15 ), |
— | — | @@ -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' => 255 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 256 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 255 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 256 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -380,7 +380,7 @@ |
381 | 381 | context.oldDelayedHTML = newHTML; |
382 | 382 | event.data.scope = 'realchange'; |
383 | 383 | } |
384 | | - context.fn.updateHistory(); |
| 384 | + context.fn.updateHistory( event.data.scope == 'realchange' ); |
385 | 385 | return true; |
386 | 386 | }, |
387 | 387 | 'paste': function( event ) { |
— | — | @@ -1372,11 +1372,17 @@ |
1373 | 1373 | context.savedSelection.select(); |
1374 | 1374 | context.savedSelection = null; |
1375 | 1375 | }, |
1376 | | - 'updateHistory': function() { |
| 1376 | + /** |
| 1377 | + * Update the history queue |
| 1378 | + * |
| 1379 | + * @param htmlChange pass true or false to inidicate if there was a text change that should potentially |
| 1380 | + * be given a new history state. |
| 1381 | + */ |
| 1382 | + 'updateHistory': function( htmlChange ) { |
1377 | 1383 | var newHTML = context.$content.html(); |
1378 | 1384 | var newSel = context.fn.getCaretPosition(); |
1379 | 1385 | // Was text changed? Was it because of a REDO or UNDO action? |
1380 | | - if ( context.history.length == 0 || ( context.oldDelayedHTML != newHTML && |
| 1386 | + if ( context.history.length == 0 || ( htmlChange && |
1381 | 1387 | newHTML != context.history[context.history.length + context.historyPosition].html ) ) { |
1382 | 1388 | context.fn.purgeOffsets(); |
1383 | 1389 | context.oldDelayedHTML = newHTML; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6813,7 +6813,7 @@ |
6814 | 6814 | context.oldDelayedHTML = newHTML; |
6815 | 6815 | event.data.scope = 'realchange'; |
6816 | 6816 | } |
6817 | | - context.fn.updateHistory(); |
| 6817 | + context.fn.updateHistory( event.data.scope == 'realchange' ); |
6818 | 6818 | return true; |
6819 | 6819 | }, |
6820 | 6820 | 'paste': function( event ) { |
— | — | @@ -7805,11 +7805,17 @@ |
7806 | 7806 | context.savedSelection.select(); |
7807 | 7807 | context.savedSelection = null; |
7808 | 7808 | }, |
7809 | | - 'updateHistory': function() { |
| 7809 | + /** |
| 7810 | + * Update the history queue |
| 7811 | + * |
| 7812 | + * @param htmlChange pass true or false to inidicate if there was a text change that should potentially |
| 7813 | + * be given a new history state. |
| 7814 | + */ |
| 7815 | + 'updateHistory': function( htmlChange ) { |
7810 | 7816 | var newHTML = context.$content.html(); |
7811 | 7817 | var newSel = context.fn.getCaretPosition(); |
7812 | 7818 | // Was text changed? Was it because of a REDO or UNDO action? |
7813 | | - if ( context.history.length == 0 || ( context.oldDelayedHTML != newHTML && |
| 7819 | + if ( context.history.length == 0 || ( htmlChange && |
7814 | 7820 | newHTML != context.history[context.history.length + context.historyPosition].html ) ) { |
7815 | 7821 | context.fn.purgeOffsets(); |
7816 | 7822 | context.oldDelayedHTML = newHTML; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -455,7 +455,7 @@ |
456 | 456 | 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';} |
457 | 457 | switch(event.which){case 8:break;} |
458 | 458 | 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';} |
459 | | -context.fn.updateHistory();return true;},'paste':function(event){context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');} |
| 459 | +context.fn.updateHistory(event.data.scope=='realchange');return true;},'paste':function(event){context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');} |
460 | 460 | setTimeout(function(){var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();} |
461 | 461 | var text=$currentElement.text();if($currentElement.is('br')){$currentElement.addClass('wikiEditor');}else if($currentElement.is('span')&&text.length==0){$currentElement.remove();}else{$newElement=$('<p></p>').addClass('wikiEditor').insertAfter($currentElement);if(text.length){$newElement.text(text);}else{$newElement.append($('<br>').addClass('wikiEditor'));} |
462 | 462 | $currentElement.remove();} |
— | — | @@ -553,7 +553,7 @@ |
554 | 554 | pos=nextPos+(leavingP?1:0);if(t.node.nodeName=='#text'){lastTextNode=t.node;lastTextNodeDepth=t.depth;} |
555 | 555 | t=nextT;}},'saveSelection':function(){if(!$.browser.msie){return;} |
556 | 556 | context.$iframe[0].contentWindow.focus();context.savedSelection=context.$iframe[0].contentWindow.document.selection.createRange();},'restoreSelection':function(){if(!$.browser.msie||context.savedSelection===null){return;} |
557 | | -context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;},'updateHistory':function(){var newHTML=context.$content.html();var newSel=context.fn.getCaretPosition();if(context.history.length==0||(context.oldDelayedHTML!=newHTML&&newHTML!=context.history[context.history.length+context.historyPosition].html)){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;context.oldDelayedSel=newSel;if(context.historyPosition<-1){context.history.splice(context.history.length+context.historyPosition);context.historyPosition=-1;} |
| 557 | +context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;},'updateHistory':function(htmlChange){var newHTML=context.$content.html();var newSel=context.fn.getCaretPosition();if(context.history.length==0||(htmlChange&&newHTML!=context.history[context.history.length+context.historyPosition].html)){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;context.oldDelayedSel=newSel;if(context.historyPosition<-1){context.history.splice(context.history.length+context.historyPosition);context.historyPosition=-1;} |
558 | 558 | context.history.push({'html':newHTML,'sel':newSel});while(context.history.length>10){context.history.shift();}}else if(context.oldDelayedSel!=newSel){context.oldDelayedSel=newSel;context.history[context.history.length+context.historyPosition].sel=newSel;}}};context.$textarea.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.fn.setupIframe=function(){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;}} |
559 | 559 | 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 ");}} |
560 | 560 | 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(/<span( | )class=("|")wikiEditor-tab("|")><\/span>/g,'<span class="wikiEditor-tab"></span>').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);if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |