Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 162 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 38 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 39 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ), |
— | — | @@ -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' => 317 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 318 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 317 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 318 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | //start same |
187 | 187 | oldStarts[markers[i].start+","+markers[i].type] = true; |
188 | 188 | if(division == 'realchange'){ |
189 | | - cBreak = true; |
| 189 | + cBreak = true; //already existed, offsets fine |
190 | 190 | } |
191 | 191 | } |
192 | 192 | else{ |
— | — | @@ -194,7 +194,7 @@ |
195 | 195 | context.modules.highlight.markersOldStarts = oldStarts; |
196 | 196 | purgeStarts = true; |
197 | 197 | if(division == 'realchange'){ |
198 | | - cBreak = true; |
| 198 | + cBreak = true; //user is currently typing in something whose begin exists |
199 | 199 | } |
200 | 200 | } |
201 | 201 | context.modules.highlight.markersOldStarts[markers[i].start+","+markers[i].type] = true; |
— | — | @@ -312,14 +312,12 @@ |
313 | 313 | var ca1 = startNode, ca2 = endNode; |
314 | 314 | if ( ca1 && ca2 && ca1.parentNode ) { |
315 | 315 | var anchor = markers[i].getAnchor( ca1, ca2 ); |
316 | | - if(cBreak){ |
317 | | - return; |
318 | | - } |
319 | | - if ( !anchor ) { |
| 316 | + if ( !anchor && !cBreak ) { //cBreak prevents a new span from being created which stops cursor jumps |
320 | 317 | var commonAncestor = ca1.parentNode; |
321 | | - if ( markers[i].anchor == 'wrap' ) { |
| 318 | + if ( markers[i].anchor == 'wrap') { |
322 | 319 | // We have to store things like .parentNode and .nextSibling because |
323 | 320 | // appendChild() changes these properties |
| 321 | + |
324 | 322 | var newNode = ca1.ownerDocument.createElement( 'span' ); |
325 | 323 | |
326 | 324 | var nextNode = ca2.nextSibling; |
— | — | @@ -331,6 +329,7 @@ |
332 | 330 | n = ns; |
333 | 331 | } |
334 | 332 | // Insert newNode in the right place |
| 333 | + |
335 | 334 | if ( nextNode ) { |
336 | 335 | commonAncestor.insertBefore( newNode, nextNode ); |
337 | 336 | } else { |
— | — | @@ -343,7 +342,6 @@ |
344 | 343 | } |
345 | 344 | $( anchor ).data( 'marker', markers[i] ) |
346 | 345 | .addClass( 'wikiEditor-highlight' ); |
347 | | - |
348 | 346 | // Allow the module adding this marker to manipulate it |
349 | 347 | markers[i].afterWrap( anchor, markers[i] ); |
350 | 348 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -8646,7 +8646,7 @@ |
8647 | 8647 | //start same |
8648 | 8648 | oldStarts[markers[i].start+","+markers[i].type] = true; |
8649 | 8649 | if(division == 'realchange'){ |
8650 | | - cBreak = true; |
| 8650 | + cBreak = true; //already existed, offsets fine |
8651 | 8651 | } |
8652 | 8652 | } |
8653 | 8653 | else{ |
— | — | @@ -8655,7 +8655,7 @@ |
8656 | 8656 | context.modules.highlight.markersOldStarts = oldStarts; |
8657 | 8657 | purgeStarts = true; |
8658 | 8658 | if(division == 'realchange'){ |
8659 | | - cBreak = true; |
| 8659 | + cBreak = true; //user is currently typing in something whose begin exists |
8660 | 8660 | } |
8661 | 8661 | } |
8662 | 8662 | context.modules.highlight.markersOldStarts[markers[i].start+","+markers[i].type] = true; |
— | — | @@ -8773,14 +8773,12 @@ |
8774 | 8774 | var ca1 = startNode, ca2 = endNode; |
8775 | 8775 | if ( ca1 && ca2 && ca1.parentNode ) { |
8776 | 8776 | var anchor = markers[i].getAnchor( ca1, ca2 ); |
8777 | | - if(cBreak){ |
8778 | | - return; |
8779 | | - } |
8780 | | - if ( !anchor ) { |
| 8777 | + if ( !anchor && !cBreak ) { //cBreak prevents a new span from being created which stops cursor jumps |
8781 | 8778 | var commonAncestor = ca1.parentNode; |
8782 | | - if ( markers[i].anchor == 'wrap' ) { |
| 8779 | + if ( markers[i].anchor == 'wrap') { |
8783 | 8780 | // We have to store things like .parentNode and .nextSibling because |
8784 | 8781 | // appendChild() changes these properties |
| 8782 | + |
8785 | 8783 | var newNode = ca1.ownerDocument.createElement( 'span' ); |
8786 | 8784 | |
8787 | 8785 | var nextNode = ca2.nextSibling; |
— | — | @@ -8792,6 +8790,7 @@ |
8793 | 8791 | n = ns; |
8794 | 8792 | } |
8795 | 8793 | // Insert newNode in the right place |
| 8794 | + |
8796 | 8795 | if ( nextNode ) { |
8797 | 8796 | commonAncestor.insertBefore( newNode, nextNode ); |
8798 | 8797 | } else { |
— | — | @@ -8804,7 +8803,6 @@ |
8805 | 8804 | } |
8806 | 8805 | $( anchor ).data( 'marker', markers[i] ) |
8807 | 8806 | .addClass( 'wikiEditor-highlight' ); |
8808 | | - |
8809 | 8807 | // Allow the module adding this marker to manipulate it |
8810 | 8808 | markers[i].afterWrap( anchor, markers[i] ); |
8811 | 8809 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -603,8 +603,7 @@ |
604 | 604 | oldParent.parentNode.removeChild(oldParent);} |
605 | 605 | lastP=t.inP;} |
606 | 606 | context.fn.purgeOffsets();} |
607 | | -var ca1=startNode,ca2=endNode;if(ca1&&ca2&&ca1.parentNode){var anchor=markers[i].getAnchor(ca1,ca2);if(cBreak){return;} |
608 | | -if(!anchor){var commonAncestor=ca1.parentNode;if(markers[i].anchor=='wrap'){var newNode=ca1.ownerDocument.createElement('span');var nextNode=ca2.nextSibling;var n=ca1;while(n!=nextNode){var ns=n.nextSibling;newNode.appendChild(n);n=ns;} |
| 607 | +var ca1=startNode,ca2=endNode;if(ca1&&ca2&&ca1.parentNode){var anchor=markers[i].getAnchor(ca1,ca2);if(!anchor&&!cBreak){var commonAncestor=ca1.parentNode;if(markers[i].anchor=='wrap'){var newNode=ca1.ownerDocument.createElement('span');var nextNode=ca2.nextSibling;var n=ca1;while(n!=nextNode){var ns=n.nextSibling;newNode.appendChild(n);n=ns;} |
609 | 608 | if(nextNode){commonAncestor.insertBefore(newNode,nextNode);}else{commonAncestor.appendChild(newNode);} |
610 | 609 | anchor=newNode;}else if(markers[i].anchor=='tag'){anchor=commonAncestor;} |
611 | 610 | $(anchor).data('marker',markers[i]).addClass('wikiEditor-highlight');markers[i].afterWrap(anchor,markers[i]);}else{$(anchor).data('marker',markers[i]);markers[i].onSkip(anchor);} |