Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -71,20 +71,20 @@ |
72 | 72 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ), |
75 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 35 ), |
| 75 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 36 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 2 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 40 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ), |
79 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 51 ), |
| 79 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 52 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 8 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 2 ), |
82 | 82 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ), |
83 | 83 | ), |
84 | 84 | 'combined' => array( |
85 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 111 ), |
| 85 | + array( 'src' => 'js/plugins.combined.js', 'version' => 112 ), |
86 | 86 | ), |
87 | 87 | 'minified' => array( |
88 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 111 ), |
| 88 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 112 ), |
89 | 89 | ), |
90 | 90 | ), |
91 | 91 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -414,6 +414,7 @@ |
415 | 415 | outline[h] = { 'text': match[2], 'wrapper': div, 'level': match[1].length, 'index': h + 1 }; |
416 | 416 | h++; |
417 | 417 | } |
| 418 | + context.$content.html( context.$content.html().replace( /[\r\n]+/g, "<br>" ) ); |
418 | 419 | context.$content.each( traverseTextNodes ); |
419 | 420 | |
420 | 421 | // Normalize heading levels for list creation |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -531,10 +531,15 @@ |
532 | 532 | * @param force If true, scroll the element even if it's already visible |
533 | 533 | */ |
534 | 534 | 'scrollToTop': function( $element, force ) { |
535 | | - var html = context.$content.closest( 'html' ); |
| 535 | + var html = context.$content.closest( 'html' ), |
| 536 | + body = context.$content.closest( 'body' ); |
536 | 537 | var y = $element.offset().top - context.$content.offset().top; |
537 | | - if ( force || y < html.scrollTop() || y > html.scrollTop() + context.$iframe.height() ) |
538 | | - html.scrollTop( y ); |
| 538 | + if ( force || y < html.scrollTop() || y < body.scrollTop() |
| 539 | + || y > html.scrollTop() + context.$iframe.height() |
| 540 | + || y > body.scrollTop() + context.$iframe.height() ) { |
| 541 | + html.scrollTop( y ); |
| 542 | + body.scrollTop( y ); |
| 543 | + } |
539 | 544 | $element.trigger( 'scrollToTop' ); |
540 | 545 | }, |
541 | 546 | /** |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1841,10 +1841,15 @@ |
1842 | 1842 | * @param force If true, scroll the element even if it's already visible |
1843 | 1843 | */ |
1844 | 1844 | 'scrollToTop': function( $element, force ) { |
1845 | | - var html = context.$content.closest( 'html' ); |
| 1845 | + var html = context.$content.closest( 'html' ), |
| 1846 | + body = context.$content.closest( 'body' ); |
1846 | 1847 | var y = $element.offset().top - context.$content.offset().top; |
1847 | | - if ( force || y < html.scrollTop() || y > html.scrollTop() + context.$iframe.height() ) |
1848 | | - html.scrollTop( y ); |
| 1848 | + if ( force || y < html.scrollTop() || y < body.scrollTop() |
| 1849 | + || y > html.scrollTop() + context.$iframe.height() |
| 1850 | + || y > body.scrollTop() + context.$iframe.height() ) { |
| 1851 | + html.scrollTop( y ); |
| 1852 | + body.scrollTop( y ); |
| 1853 | + } |
1849 | 1854 | $element.trigger( 'scrollToTop' ); |
1850 | 1855 | }, |
1851 | 1856 | /** |
— | — | @@ -3306,6 +3311,7 @@ |
3307 | 3312 | outline[h] = { 'text': match[2], 'wrapper': div, 'level': match[1].length, 'index': h + 1 }; |
3308 | 3313 | h++; |
3309 | 3314 | } |
| 3315 | + context.$content.html( context.$content.html().replace( /[\r\n]+/g, "<br>" ) ); |
3310 | 3316 | context.$content.each( traverseTextNodes ); |
3311 | 3317 | |
3312 | 3318 | // Normalize heading levels for list creation |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -109,8 +109,8 @@ |
110 | 110 | if(lastNode){context.fn.scrollToTop(lastNode);} |
111 | 111 | context.$content.trigger('encapsulateSelection',[pre,options.peri,post,options.ownline,options.replace]);return context.$textarea;},'getCaretPosition':function(options){},'setSelection':function(options){var sel=context.$iframe[0].contentWindow.getSelection();var sc=options.startContainer,ec=options.endContainer;sc=sc.jquery?sc[0]:sc;ec=ec.jquery?ec[0]:ec;while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;} |
112 | 112 | while(ec.firstChild&&ec.nodeName!='#text'){ec=ec.firstChild;} |
113 | | -sel.extend(sc,options.start);sel.collapseToStart();if(options.end!=options.start||sc!=ec){sel.extend(ec,options.end);}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html');var y=$element.offset().top-context.$content.offset().top;if(force||y<html.scrollTop()||y>html.scrollTop()+context.$iframe.height()) |
114 | | -html.scrollTop(y);$element.trigger('scrollToTop');},'beforeSelection':function(selector,getAll){if(typeof selector=='undefined') |
| 113 | +sel.extend(sc,options.start);sel.collapseToStart();if(options.end!=options.start||sc!=ec){sel.extend(ec,options.end);}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body');var y=$element.offset().top-context.$content.offset().top;if(force||y<html.scrollTop()||y<body.scrollTop()||y>html.scrollTop()+context.$iframe.height()||y>body.scrollTop()+context.$iframe.height()){html.scrollTop(y);body.scrollTop(y);} |
| 114 | +$element.trigger('scrollToTop');},'beforeSelection':function(selector,getAll){if(typeof selector=='undefined') |
115 | 115 | selector='*';var retval=[];var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);var e=range.startContainer;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<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,'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(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append(context.$textarea.val().replace(/</g,'<').replace(/>/g,'>'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
116 | 116 | context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});} |
117 | 117 | arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,typeof arguments[0]=='undefined'?{}:arguments[0]);}} |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | div=$(this).parent();else if($(this).parent().is('div')) |
212 | 212 | div=$(this).parent().addClass('wikiEditor-toc-header');else{div=$('<div />').text(text).css('display','inline').addClass('wikiEditor-toc-header');$(this).replaceWith(div);} |
213 | 213 | outline[h]={'text':match[2],'wrapper':div,'level':match[1].length,'index':h+1};h++;} |
214 | | -context.$content.each(traverseTextNodes);var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;} |
| 214 | +context.$content.html(context.$content.html().replace(/[\r\n]+/g,"<br>"));context.$content.each(traverseTextNodes);var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;} |
215 | 215 | else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);} |
216 | 216 | if(nLevel<=0){nLevel=1;} |
217 | 217 | outline[i].nLevel=nLevel;lastLevel=outline[i].level;} |