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' => 26 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 88 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 89 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 26 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 45 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ), |
— | — | @@ -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' => 201 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 202 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 201 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 202 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -368,9 +368,10 @@ |
369 | 369 | html |
370 | 370 | .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
371 | 371 | .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
372 | | - .replace( /\<\/p\>\<p\>/gi, "\n" ) // Easy case for <p> conversion |
373 | 372 | // Don't convert <br>s at the very start or end to prevent newline collapsing |
374 | 373 | .replace( /(?!^)\<br[^\>]*\>(?!$)/gi, "\n" ) // Easy case for <br> conversion |
| 374 | + .replace( /\<\/p\>\<p\>/gi, "\n" ) // Easy case for <p> conversion |
| 375 | + .replace( /\<\/p\>(\n*)\<p\>/gi, "$1\n" ) |
375 | 376 | + '</pre>' ); |
376 | 377 | // TODO: Optimize this, maybe by converting <br>->\n when not at the beginning or end |
377 | 378 | $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } ); |
— | — | @@ -401,12 +402,18 @@ |
402 | 403 | while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) { |
403 | 404 | t = t.next(); |
404 | 405 | } |
405 | | - if ( t && !t.inP && t.node.nodeName != 'P' ) { |
| 406 | + if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue[0] != '\n' |
| 407 | + && t.node.nodeValue[0] != '\r' ) { |
406 | 408 | text += "\n"; |
407 | 409 | } |
408 | 410 | $( this ).text( text ); |
409 | 411 | } |
410 | 412 | } ); |
| 413 | + // IE aggressively collapses whitespace in .text() after having done DOM manipulation, |
| 414 | + // but for some crazy reason this does work |
| 415 | + if ( $.browser.msie ) { |
| 416 | + $pre = $( '<pre>' + $pre.html() + '</pre>' ); |
| 417 | + } |
411 | 418 | return $pre.text(); |
412 | 419 | }, |
413 | 420 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6792,9 +6792,10 @@ |
6793 | 6793 | html |
6794 | 6794 | .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
6795 | 6795 | .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
6796 | | - .replace( /\<\/p\>\<p\>/gi, "\n" ) // Easy case for <p> conversion |
6797 | 6796 | // Don't convert <br>s at the very start or end to prevent newline collapsing |
6798 | 6797 | .replace( /(?!^)\<br[^\>]*\>(?!$)/gi, "\n" ) // Easy case for <br> conversion |
| 6798 | + .replace( /\<\/p\>\<p\>/gi, "\n" ) // Easy case for <p> conversion |
| 6799 | + .replace( /\<\/p\>(\n*)\<p\>/gi, "$1\n" ) |
6799 | 6800 | + '</pre>' ); |
6800 | 6801 | // TODO: Optimize this, maybe by converting <br>->\n when not at the beginning or end |
6801 | 6802 | $pre.find( '.wikiEditor-noinclude' ).each( function() { $( this ).remove(); } ); |
— | — | @@ -6825,12 +6826,18 @@ |
6826 | 6827 | while ( t && t.node.nodeName != '#text' && t.node.nodeName != 'BR' && t.node.nodeName != 'P' ) { |
6827 | 6828 | t = t.next(); |
6828 | 6829 | } |
6829 | | - if ( t && !t.inP && t.node.nodeName != 'P' ) { |
| 6830 | + if ( t && !t.inP && t.node.nodeName == '#text' && t.node.nodeValue[0] != '\n' |
| 6831 | + && t.node.nodeValue[0] != '\r' ) { |
6830 | 6832 | text += "\n"; |
6831 | 6833 | } |
6832 | 6834 | $( this ).text( text ); |
6833 | 6835 | } |
6834 | 6836 | } ); |
| 6837 | + // IE aggressively collapses whitespace in .text() after having done DOM manipulation, |
| 6838 | + // but for some crazy reason this does work |
| 6839 | + if ( $.browser.msie ) { |
| 6840 | + $pre = $( '<pre>' + $pre.html() + '</pre>' ); |
| 6841 | + } |
6835 | 6842 | return $pre.text(); |
6836 | 6843 | }, |
6837 | 6844 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -449,12 +449,13 @@ |
450 | 450 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
451 | 451 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
452 | 452 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){var $pre=$('<pre>'+ |
453 | | -html.replace(/\r?\n/g,"").replace(/ /g," ").replace(/\<\/p\>\<p\>/gi,"\n").replace(/(?!^)\<br[^\>]*\>(?!$)/gi,"\n") |
| 453 | +html.replace(/\r?\n/g,"").replace(/ /g," ").replace(/(?!^)\<br[^\>]*\>(?!$)/gi,"\n").replace(/\<\/p\>\<p\>/gi,"\n").replace(/\<\/p\>(\n*)\<p\>/gi,"$1\n") |
454 | 454 | +'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t")});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){if(this.previousSibling||this.parentNode!=$pre.get(0)){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,-10,this).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();} |
455 | 455 | if(t){text="\n"+text;} |
456 | 456 | t=new context.fn.rawTraverser(this.lastChild,-10,this).next();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();} |
457 | | -if(t&&!t.inP&&t.node.nodeName!='P'){text+="\n";} |
458 | | -$(this).text(text);}});return $pre.text();},'getContents':function(){return context.fn.htmlToText(context.$content.html());},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
| 457 | +if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue[0]!='\n'&&t.node.nodeValue[0]!='\r'){text+="\n";} |
| 458 | +$(this).text(text);}});if($.browser.msie){$pre=$('<pre>'+$pre.html()+'</pre>');} |
| 459 | +return $pre.text();},'getContents':function(){return context.fn.htmlToText(context.$content.html());},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
459 | 460 | if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(retval.toString){retval=retval.toString();} |
460 | 461 | return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';} |
461 | 462 | if(options.splitlines){selTextArr=selText.split(/\n/);} |