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' => 93 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 94 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 46 ), |
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' => 210 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 211 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 210 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 211 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -466,6 +466,17 @@ |
467 | 467 | if ( context.$iframe[0].contentWindow.getSelection ) { |
468 | 468 | // Firefox and Opera |
469 | 469 | retval = context.$iframe[0].contentWindow.getSelection(); |
| 470 | + if ( $.browser.opera ) { |
| 471 | + // Opera strips newlines in getSelection(), so we need something more sophisticated |
| 472 | + if ( retval.rangeCount > 0 ) { |
| 473 | + retval = context.fn.htmlToText( $( '<pre />' ) |
| 474 | + .append( retval.getRangeAt( 0 ).cloneContents() ) |
| 475 | + .html() |
| 476 | + ); |
| 477 | + } else { |
| 478 | + retval = ''; |
| 479 | + } |
| 480 | + } |
470 | 481 | } else if ( context.$iframe[0].contentWindow.document.selection ) { // should come last; Opera! |
471 | 482 | // IE |
472 | 483 | retval = context.$iframe[0].contentWindow.document.selection.createRange(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6890,6 +6890,17 @@ |
6891 | 6891 | if ( context.$iframe[0].contentWindow.getSelection ) { |
6892 | 6892 | // Firefox and Opera |
6893 | 6893 | retval = context.$iframe[0].contentWindow.getSelection(); |
| 6894 | + if ( $.browser.opera ) { |
| 6895 | + // Opera strips newlines in getSelection(), so we need something more sophisticated |
| 6896 | + if ( retval.rangeCount > 0 ) { |
| 6897 | + retval = context.fn.htmlToText( $( '<pre />' ) |
| 6898 | + .append( retval.getRangeAt( 0 ).cloneContents() ) |
| 6899 | + .html() |
| 6900 | + ); |
| 6901 | + } else { |
| 6902 | + retval = ''; |
| 6903 | + } |
| 6904 | + } |
6894 | 6905 | } else if ( context.$iframe[0].contentWindow.document.selection ) { // should come last; Opera! |
6895 | 6906 | // IE |
6896 | 6907 | retval = context.$iframe[0].contentWindow.document.selection.createRange(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -456,7 +456,7 @@ |
457 | 457 | 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();} |
458 | 458 | if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue.charAt(0)!='\n'&&t.node.nodeValue.charAt(0)!='\r'){text+="\n";} |
459 | 459 | $(this).text(text);}});var retval;if($.browser.msie){retval=$('<pre>'+$pre.html()+'</pre>').text().replace(/\r/g,'\n');}else{retval=$pre.text();} |
460 | | -return context.htmlToTextMap[origHTML]=leading+retval+trailing;},'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();} |
| 460 | +return context.htmlToTextMap[origHTML]=leading+retval+trailing;},'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();if($.browser.opera){if(retval.rangeCount>0){retval=context.fn.htmlToText($('<pre />').append(retval.getRangeAt(0).cloneContents()).html());}else{retval='';}}}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
461 | 461 | if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(retval.toString){retval=retval.toString();} |
462 | 462 | 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+=' ';} |
463 | 463 | if(options.splitlines){selTextArr=selText.split(/\n/);} |