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' => 154 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 155 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 34 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 290 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 291 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 290 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 291 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/images/wikiEditor/templateEditor/dialog-collapsed.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -1188,12 +1188,19 @@ |
1189 | 1189 | 'encapsulateSelection': function( options ) { |
1190 | 1190 | var selText = $(this).textSelection( 'getSelection' ); |
1191 | 1191 | var selTextArr; |
| 1192 | + var collapseToEnd = false; |
1192 | 1193 | var selectAfter = false; |
1193 | 1194 | var setSelectionTo = null; |
1194 | 1195 | var pre = options.pre, post = options.post; |
1195 | 1196 | if ( !selText ) { |
1196 | 1197 | selText = options.peri; |
1197 | 1198 | selectAfter = true; |
| 1199 | + } else if ( $.wikiEditor.autoMsg( options, 'peri' ) == selText.replace( /\s\s*$/, '' ) ) { |
| 1200 | + // Probably a successive button press |
| 1201 | + // strip any extra white space from selText and set variables we'll need for later |
| 1202 | + selText = selText.replace( /\s\s*$/, '' ); |
| 1203 | + collapseToEnd = true; |
| 1204 | + selectAfter = true; |
1198 | 1205 | } else if ( options.replace ) { |
1199 | 1206 | selText = options.peri; |
1200 | 1207 | } else if ( selText.charAt( selText.length - 1 ) == ' ' ) { |
— | — | @@ -1209,6 +1216,13 @@ |
1210 | 1217 | if ( context.$iframe[0].contentWindow.getSelection ) { |
1211 | 1218 | // Firefox and Opera |
1212 | 1219 | var range = context.$iframe[0].contentWindow.getSelection().getRangeAt( 0 ); |
| 1220 | + if ( collapseToEnd ) { |
| 1221 | + // Make sure we're not collapsing ourselves into a BR tag |
| 1222 | + if ( range.endContainer.nodeName == 'BR' ) { |
| 1223 | + range.setEndBefore( range.endContainer ); |
| 1224 | + } |
| 1225 | + range.collapse( false ); |
| 1226 | + } |
1213 | 1227 | if ( options.ownline ) { |
1214 | 1228 | // We need to figure out if the cursor is at the start or end of a line |
1215 | 1229 | var atStart = false, atEnd = false; |
— | — | @@ -1236,7 +1250,6 @@ |
1237 | 1251 | // Apparently this happens when splitting text nodes |
1238 | 1252 | atEnd = true; |
1239 | 1253 | } |
1240 | | - |
1241 | 1254 | if ( !atStart ) { |
1242 | 1255 | pre = "\n" + options.pre; |
1243 | 1256 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -7625,12 +7625,19 @@ |
7626 | 7626 | 'encapsulateSelection': function( options ) { |
7627 | 7627 | var selText = $(this).textSelection( 'getSelection' ); |
7628 | 7628 | var selTextArr; |
| 7629 | + var collapseToEnd = false; |
7629 | 7630 | var selectAfter = false; |
7630 | 7631 | var setSelectionTo = null; |
7631 | 7632 | var pre = options.pre, post = options.post; |
7632 | 7633 | if ( !selText ) { |
7633 | 7634 | selText = options.peri; |
7634 | 7635 | selectAfter = true; |
| 7636 | + } else if ( $.wikiEditor.autoMsg( options, 'peri' ) == selText.replace( /\s\s*$/, '' ) ) { |
| 7637 | + // Probably a successive button press |
| 7638 | + // strip any extra white space from selText and set variables we'll need for later |
| 7639 | + selText = selText.replace( /\s\s*$/, '' ); |
| 7640 | + collapseToEnd = true; |
| 7641 | + selectAfter = true; |
7635 | 7642 | } else if ( options.replace ) { |
7636 | 7643 | selText = options.peri; |
7637 | 7644 | } else if ( selText.charAt( selText.length - 1 ) == ' ' ) { |
— | — | @@ -7646,6 +7653,13 @@ |
7647 | 7654 | if ( context.$iframe[0].contentWindow.getSelection ) { |
7648 | 7655 | // Firefox and Opera |
7649 | 7656 | var range = context.$iframe[0].contentWindow.getSelection().getRangeAt( 0 ); |
| 7657 | + if ( collapseToEnd ) { |
| 7658 | + // Make sure we're not collapsing ourselves into a BR tag |
| 7659 | + if ( range.endContainer.nodeName == 'BR' ) { |
| 7660 | + range.setEndBefore( range.endContainer ); |
| 7661 | + } |
| 7662 | + range.collapse( false ); |
| 7663 | + } |
7650 | 7664 | if ( options.ownline ) { |
7651 | 7665 | // We need to figure out if the cursor is at the start or end of a line |
7652 | 7666 | var atStart = false, atEnd = false; |
— | — | @@ -7673,7 +7687,6 @@ |
7674 | 7688 | // Apparently this happens when splitting text nodes |
7675 | 7689 | atEnd = true; |
7676 | 7690 | } |
7677 | | - |
7678 | 7691 | if ( !atStart ) { |
7679 | 7692 | pre = "\n" + options.pre; |
7680 | 7693 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -516,9 +516,11 @@ |
517 | 517 | context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');context.oldHTML=context.oldDelayedHTML=context.$content.html();$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('paste',function(event){return context.fn.trigger('paste',event);}).bind('cut',function(event){return context.fn.trigger('cut',event);}).bind('keyup paste mouseup cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup paste mouseup cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};},'getContents':function(){var html;if($.browser.msie){var $c=$(context.$content.get(0).cloneNode(true));$c.find('p').each(function(){if($(this).html()==''){$(this).replaceWith('<p></p>');}});html=$c.html();}else{html=context.$content.html();} |
518 | 518 | return context.fn.htmlToText(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();} |
519 | 519 | if(typeof retval.text!='undefined'){retval=context.fn.htmlToText(retval.htmlText);}else if(typeof retval.toString!='undefined'){retval=retval.toString();} |
520 | | -return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var selectAfter=false;var setSelectionTo=null;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+=' ';} |
| 520 | +return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selTextArr;var collapseToEnd=false;var selectAfter=false;var setSelectionTo=null;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if($.wikiEditor.autoMsg(options,'peri')==selText.replace(/\s\s*$/,'')){selText=selText.replace(/\s\s*$/,'');collapseToEnd=true;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';} |
521 | 521 | if(options.splitlines){selTextArr=selText.split(/\n/);} |
522 | | -if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){var atStart=false,atEnd=false;var body=context.$content.get(0);if(range.startOffset==0){atStart=true;}else if(range.startContainer==body){var n=body.firstChild;for(var i=0;i<range.startOffset-1&&n;i++){n=n.nextSibling;} |
| 522 | +if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(collapseToEnd){if(range.endContainer.nodeName=='BR'){range.setEndBefore(range.endContainer);} |
| 523 | +range.collapse(false);} |
| 524 | +if(options.ownline){var atStart=false,atEnd=false;var body=context.$content.get(0);if(range.startOffset==0){atStart=true;}else if(range.startContainer==body){var n=body.firstChild;for(var i=0;i<range.startOffset-1&&n;i++){n=n.nextSibling;} |
523 | 525 | if(n&&n.nodeName=='BR'){atStart=true;}else{atEnd=true;}}else if(range.startContainer.nodeName=='#text'&&range.startOffset==range.startContainer.nodeValue.length){atEnd=true;} |
524 | 526 | if(!atStart){pre="\n"+options.pre;} |
525 | 527 | if(!atEnd){post+="\n";}} |