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' => 135 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 136 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 31 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 49 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 15 ), |
— | — | @@ -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' => 257 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 258 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 257 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 258 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -747,27 +747,27 @@ |
748 | 748 | range.insertNode( firstNode ); |
749 | 749 | lastNode = lastNode || firstNode; |
750 | 750 | var newOffset = offset + insertLines[i].length; |
751 | | - if ( !selSC && pre.length < newOffset ) { |
| 751 | + if ( !selEC && post.length <= newOffset ) { |
| 752 | + selEC = firstNode; |
| 753 | + selEO = selEC.nodeValue.length - ( post.length - offset ); |
| 754 | + } |
| 755 | + if ( selEC && !selSC && pre.length >= insertText.length - newOffset ) { |
752 | 756 | selSC = firstNode; |
753 | | - selSO = pre.length - offset; |
| 757 | + selSO = pre.length - ( insertText.length - newOffset ); |
754 | 758 | } |
755 | | - if ( selSC && insertText.length - post.length < newOffset ) { |
756 | | - selEC = firstNode; |
757 | | - selEO = insertText.length - pre.length - offset; |
758 | | - } |
759 | 759 | offset = newOffset; |
760 | 760 | if ( i > 0 ) { |
761 | 761 | firstNode = context.$iframe[0].contentWindow.document.createElement( 'br' ); |
762 | 762 | range.insertNode( firstNode ); |
763 | 763 | newOffset = offset + 1; |
764 | | - if ( !selSC && pre.length < newOffset ) { |
| 764 | + if ( !selEC && post.length <= newOffset ) { |
| 765 | + selEC = firstNode; |
| 766 | + selEO = 1 - ( post.length - offset ); |
| 767 | + } |
| 768 | + if ( selEC && !selSC && pre.length >= insertText.length - newOffset ) { |
765 | 769 | selSC = firstNode; |
766 | | - selSO = pre.length - offset; |
| 770 | + selSO = pre.length - ( insertText.length - newOffset ); |
767 | 771 | } |
768 | | - if ( selSC && insertText.length - post.length < newOffset ) { |
769 | | - selEC = firstNode; |
770 | | - selEO = insertText.length - pre.length - offset; |
771 | | - } |
772 | 772 | offset = newOffset; |
773 | 773 | } |
774 | 774 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -7180,27 +7180,27 @@ |
7181 | 7181 | range.insertNode( firstNode ); |
7182 | 7182 | lastNode = lastNode || firstNode; |
7183 | 7183 | var newOffset = offset + insertLines[i].length; |
7184 | | - if ( !selSC && pre.length < newOffset ) { |
| 7184 | + if ( !selEC && post.length <= newOffset ) { |
| 7185 | + selEC = firstNode; |
| 7186 | + selEO = selEC.nodeValue.length - ( post.length - offset ); |
| 7187 | + } |
| 7188 | + if ( selEC && !selSC && pre.length >= insertText.length - newOffset ) { |
7185 | 7189 | selSC = firstNode; |
7186 | | - selSO = pre.length - offset; |
| 7190 | + selSO = pre.length - ( insertText.length - newOffset ); |
7187 | 7191 | } |
7188 | | - if ( selSC && insertText.length - post.length < newOffset ) { |
7189 | | - selEC = firstNode; |
7190 | | - selEO = insertText.length - pre.length - offset; |
7191 | | - } |
7192 | 7192 | offset = newOffset; |
7193 | 7193 | if ( i > 0 ) { |
7194 | 7194 | firstNode = context.$iframe[0].contentWindow.document.createElement( 'br' ); |
7195 | 7195 | range.insertNode( firstNode ); |
7196 | 7196 | newOffset = offset + 1; |
7197 | | - if ( !selSC && pre.length < newOffset ) { |
| 7197 | + if ( !selEC && post.length <= newOffset ) { |
| 7198 | + selEC = firstNode; |
| 7199 | + selEO = 1 - ( post.length - offset ); |
| 7200 | + } |
| 7201 | + if ( selEC && !selSC && pre.length >= insertText.length - newOffset ) { |
7198 | 7202 | selSC = firstNode; |
7199 | | - selSO = pre.length - offset; |
| 7203 | + selSO = pre.length - ( insertText.length - newOffset ); |
7200 | 7204 | } |
7201 | | - if ( selSC && insertText.length - post.length < newOffset ) { |
7202 | | - selEC = firstNode; |
7203 | | - selEO = insertText.length - pre.length - offset; |
7204 | | - } |
7205 | 7205 | offset = newOffset; |
7206 | 7206 | } |
7207 | 7207 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -485,10 +485,10 @@ |
486 | 486 | if(!atStart){pre="\n"+options.pre;} |
487 | 487 | if(!atEnd){post+="\n";}} |
488 | 488 | var insertText="";if(options.splitlines){for(var j=0;j<selTextArr.length;j++){insertText=insertText+pre+selTextArr[j]+post;if(j!=selTextArr.length-1){insertText+="\n";}}}else{insertText=pre+selText+post;} |
489 | | -var insertLines=insertText.split("\n");range.extractContents();var firstNode=null,lastNode=null;var selSC=null,selEC=null,selSO=null,selEO=null,offset=0;for(var i=insertLines.length-1;i>=0;i--){firstNode=context.$iframe[0].contentWindow.document.createTextNode(insertLines[i]);range.insertNode(firstNode);lastNode=lastNode||firstNode;var newOffset=offset+insertLines[i].length;if(!selSC&&pre.length<newOffset){selSC=firstNode;selSO=pre.length-offset;} |
490 | | -if(selSC&&insertText.length-post.length<newOffset){selEC=firstNode;selEO=insertText.length-pre.length-offset;} |
491 | | -offset=newOffset;if(i>0){firstNode=context.$iframe[0].contentWindow.document.createElement('br');range.insertNode(firstNode);newOffset=offset+1;if(!selSC&&pre.length<newOffset){selSC=firstNode;selSO=pre.length-offset;} |
492 | | -if(selSC&&insertText.length-post.length<newOffset){selEC=firstNode;selEO=insertText.length-pre.length-offset;} |
| 489 | +var insertLines=insertText.split("\n");range.extractContents();var firstNode=null,lastNode=null;var selSC=null,selEC=null,selSO=null,selEO=null,offset=0;for(var i=insertLines.length-1;i>=0;i--){firstNode=context.$iframe[0].contentWindow.document.createTextNode(insertLines[i]);range.insertNode(firstNode);lastNode=lastNode||firstNode;var newOffset=offset+insertLines[i].length;if(!selEC&&post.length<=newOffset){selEC=firstNode;selEO=selEC.nodeValue.length-(post.length-offset);} |
| 490 | +if(selEC&&!selSC&&pre.length>=insertText.length-newOffset){selSC=firstNode;selSO=pre.length-(insertText.length-newOffset);} |
| 491 | +offset=newOffset;if(i>0){firstNode=context.$iframe[0].contentWindow.document.createElement('br');range.insertNode(firstNode);newOffset=offset+1;if(!selEC&&post.length<=newOffset){selEC=firstNode;selEO=1-(post.length-offset);} |
| 492 | +if(selEC&&!selSC&&pre.length>=insertText.length-newOffset){selSC=firstNode;selSO=pre.length-(insertText.length-newOffset);} |
493 | 493 | offset=newOffset;}} |
494 | 494 | if(firstNode){context.fn.scrollToTop($(firstNode.parentNode));} |
495 | 495 | if(selectAfter){setSelectionTo={startContainer:selSC,endContainer:selEC,start:selSO,end:selEO};}else if(lastNode){setSelectionTo={startContainer:lastNode,endContainer:lastNode,start:lastNode.nodeValue.length,end:lastNode.nodeValue.length};}}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;} |