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' => 103 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 104 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 47 ), |
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' => 220 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 221 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 220 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 221 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -443,16 +443,17 @@ |
444 | 444 | // IE does overzealous whitespace collapsing for $( '<pre />' ).html( html ); |
445 | 445 | // We also do <br> and easy cases for <p> conversion here, complicated cases are handled later |
446 | 446 | html = html |
447 | | - .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
448 | | - .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
449 | | - .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p> |
450 | | - .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion |
451 | | - .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
452 | | - .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" ); |
453 | | - // TODO: Why do we do this? Trevor knows, please explain here |
| 447 | + .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
| 448 | + .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
| 449 | + .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p> |
| 450 | + // Firefox ends up with one too many empty paragraphs, so this reduced consective strings of them by 1 |
454 | 451 | if ( $.browser.firefox ) { |
455 | 452 | html = html.replace( /\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi, '$1' ); |
456 | 453 | } |
| 454 | + html = html |
| 455 | + .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion |
| 456 | + .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
| 457 | + .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" ); |
457 | 458 | // Save leading and trailing whitespace now and restore it later. IE eats it all, and even Firefox |
458 | 459 | // won't leave everything alone |
459 | 460 | var leading = html.match( /^\s*/ )[0]; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6876,16 +6876,17 @@ |
6877 | 6877 | // IE does overzealous whitespace collapsing for $( '<pre />' ).html( html ); |
6878 | 6878 | // We also do <br> and easy cases for <p> conversion here, complicated cases are handled later |
6879 | 6879 | html = html |
6880 | | - .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
6881 | | - .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
6882 | | - .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p> |
6883 | | - .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion |
6884 | | - .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
6885 | | - .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" ); |
6886 | | - // TODO: Why do we do this? Trevor knows, please explain here |
| 6880 | + .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
| 6881 | + .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
| 6882 | + .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p> |
| 6883 | + // Firefox ends up with one too many empty paragraphs, so this reduced consective strings of them by 1 |
6887 | 6884 | if ( $.browser.firefox ) { |
6888 | 6885 | html = html.replace( /\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi, '$1' ); |
6889 | 6886 | } |
| 6887 | + html = html |
| 6888 | + .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion |
| 6889 | + .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
| 6890 | + .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" ); |
6890 | 6891 | // Save leading and trailing whitespace now and restore it later. IE eats it all, and even Firefox |
6891 | 6892 | // won't leave everything alone |
6892 | 6893 | var leading = html.match( /^\s*/ )[0]; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -460,8 +460,9 @@ |
461 | 461 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
462 | 462 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
463 | 463 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];} |
464 | | -var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/ /g," ").replace(/\<br[^\>]*\>\<\/p\>/gi,'</p>').replace(/\<\/p\>\s*\<p[^\>]*\>/gi,"\n").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>(\n*)\<p[^\>]*\>/gi,"$1\n");if($.browser.firefox){html=html.replace(/\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi,'$1');} |
465 | | -var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</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(){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,0,this,$pre.get(0)).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();} |
| 464 | +var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/ /g," ").replace(/\<br[^\>]*\>\<\/p\>/gi,'</p>') |
| 465 | +if($.browser.firefox){html=html.replace(/\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi,'$1');} |
| 466 | +html=html.replace(/\<\/p\>\s*\<p[^\>]*\>/gi,"\n").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>(\n*)\<p[^\>]*\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</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(){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,0,this,$pre.get(0)).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();} |
466 | 467 | if(t){text="\n"+text;} |
467 | 468 | t=new context.fn.rawTraverser(this.lastChild,0,this,$pre.get(0)).next();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();} |
468 | 469 | if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue.charAt(0)!='\n'&&t.node.nodeValue.charAt(0)!='\r'){text+="\n";} |