Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,8 +72,8 @@ |
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' => 73 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 24 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 74 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 25 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 45 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 74 ), |
— | — | @@ -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' => 185 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 186 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 185 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 186 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -450,7 +450,8 @@ |
451 | 451 | } |
452 | 452 | // TODO: Will this still work with syntax highlighting? |
453 | 453 | // When the selection ends at the end of a line, it'll have endContainer == body |
454 | | - if ( range.endContainer != body ) { |
| 454 | + // and endOffset != 0 |
| 455 | + if ( range.endContainer != body || range.endOffset == 0 ) { |
455 | 456 | post += "\n"; |
456 | 457 | } |
457 | 458 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -174,8 +174,9 @@ |
175 | 175 | startNode = startNode.splitText( s.offset ); |
176 | 176 | } |
177 | 177 | // Don't wrap leading BRs, produces undesirable results |
178 | | - while ( startNode.nodeName == 'BR' && start + 1 in offsets ) { |
| 178 | + while ( startNode.nodeName == 'BR' ) { |
179 | 179 | start++; |
| 180 | + s = context.fn.getOffset( start ); |
180 | 181 | startNode = s.node; |
181 | 182 | startDepth = s.depth; |
182 | 183 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6874,7 +6874,8 @@ |
6875 | 6875 | } |
6876 | 6876 | // TODO: Will this still work with syntax highlighting? |
6877 | 6877 | // When the selection ends at the end of a line, it'll have endContainer == body |
6878 | | - if ( range.endContainer != body ) { |
| 6878 | + // and endOffset != 0 |
| 6879 | + if ( range.endContainer != body || range.endOffset == 0 ) { |
6879 | 6880 | post += "\n"; |
6880 | 6881 | } |
6881 | 6882 | } |
— | — | @@ -7736,8 +7737,9 @@ |
7737 | 7738 | startNode = startNode.splitText( s.offset ); |
7738 | 7739 | } |
7739 | 7740 | // Don't wrap leading BRs, produces undesirable results |
7740 | | - while ( startNode.nodeName == 'BR' && start + 1 in offsets ) { |
| 7741 | + while ( startNode.nodeName == 'BR' ) { |
7741 | 7742 | start++; |
| 7743 | + s = context.fn.getOffset( start ); |
7742 | 7744 | startNode = s.node; |
7743 | 7745 | startDepth = s.depth; |
7744 | 7746 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -455,7 +455,7 @@ |
456 | 456 | 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+=' ';} |
457 | 457 | if(options.splitlines){selTextArr=selText.split(/\n/);} |
458 | 458 | if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){var body=context.$content.get(0);if(range.startOffset!=0&&range.startContainer!=body){pre="\n"+options.pre;} |
459 | | -if(range.endContainer!=body){post+="\n";}} |
| 459 | +if(range.endContainer!=body||range.endOffset==0){post+="\n";}} |
460 | 460 | var insertText="";if(options.splitlines){for(var i=0;i<selTextArr.length;i++){insertText=insertText+pre+selTextArr[i]+post;if(i!=selTextArr.length-1)insertText+="\n";}}else{insertText=pre+selText+post;} |
461 | 461 | var insertLines=insertText.split("\n");range.extractContents();var lastNode;for(var i=insertLines.length-1;i>=0;i--){range.insertNode(context.$iframe[0].contentWindow.document.createTextNode(insertLines[i]));if(i>0){lastNode=range.insertNode(context.$iframe[0].contentWindow.document.createElement('br'));}} |
462 | 462 | if(lastNode){context.fn.scrollToTop(lastNode);}}else if(context.$iframe[0].contentWindow.document.selection){context.$iframe[0].contentWindow.focus();var range=context.$iframe[0].contentWindow.document.selection.createRange();if(options.ownline&&range.moveStart){var range2=context.$iframe[0].contentWindow.document.selection.createRange();range2.collapse();range2.moveStart('character',-1);if(range2.text!="\r"&&range2.text!="\n"&&range2.text!=""){pre="\n"+pre;} |
— | — | @@ -510,7 +510,7 @@ |
511 | 511 | tokenArray.push(new Token(match.index+oldOffset+markOffset,label,tokenStart,match));oldOffset+=match.index+match[0].length;newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}} |
512 | 512 | tokenArray.sort(function(a,b){return a.offset-b.offset||a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},mark:function(context,division,tokens){var markers=context.modules.highlight.markers=[];context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});for(var i=0;i<markers.length;i++){var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
513 | 513 | var startNode=s.node;var startDepth=s.depth;if(s.offset>0){startNode=startNode.splitText(s.offset);} |
514 | | -while(startNode.nodeName=='BR'&&start+1 in offsets){start++;startNode=s.node;startDepth=s.depth;} |
| 514 | +while(startNode.nodeName=='BR'){start++;s=context.fn.getOffset(start);startNode=s.node;startDepth=s.depth;} |
515 | 515 | var end=markers[i].end;var e=context.fn.getOffset(end);if(!e){continue;} |
516 | 516 | var endNode=e.node;var endDepth=e.depth;if(e.offset<e.length-1){endNode.splitText(e.offset+1);} |
517 | 517 | if(endNode.nodeName=='BR'){endNode=e.lastTextNode;endDepth=e.lastTextNodeDepth;} |