Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 9 ), |
75 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 28 ), |
| 75 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 29 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 179 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 52 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 54 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 370 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 371 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 370 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 371 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js |
— | — | @@ -312,7 +312,9 @@ |
313 | 313 | * cover that case, we'll force it to act by moving one |
314 | 314 | * character back and forth. |
315 | 315 | */ |
316 | | - var range = document.selection.createRange(); |
| 316 | + var range = document.body.createTextRange(); |
| 317 | + // store the current selection so we can reselect it later |
| 318 | + var savedRange = document.selection.createRange(); |
317 | 319 | var pos = $(this).textSelection( 'getCaretPosition' ); |
318 | 320 | var oldScrollTop = this.scrollTop; |
319 | 321 | range.moveToElementText( this ); |
— | — | @@ -326,6 +328,7 @@ |
327 | 329 | range.select(); |
328 | 330 | } |
329 | 331 | } |
| 332 | + savedRange.select(); |
330 | 333 | $(this).trigger( 'scrollToPosition' ); |
331 | 334 | } ); |
332 | 335 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6479,7 +6479,9 @@ |
6480 | 6480 | * cover that case, we'll force it to act by moving one |
6481 | 6481 | * character back and forth. |
6482 | 6482 | */ |
6483 | | - var range = document.selection.createRange(); |
| 6483 | + var range = document.body.createTextRange(); |
| 6484 | + // store the current selection so we can reselect it later |
| 6485 | + var savedRange = document.selection.createRange(); |
6484 | 6486 | var pos = $(this).textSelection( 'getCaretPosition' ); |
6485 | 6487 | var oldScrollTop = this.scrollTop; |
6486 | 6488 | range.moveToElementText( this ); |
— | — | @@ -6493,6 +6495,7 @@ |
6494 | 6496 | range.select(); |
6495 | 6497 | } |
6496 | 6498 | } |
| 6499 | + savedRange.select(); |
6497 | 6500 | $(this).trigger( 'scrollToPosition' ); |
6498 | 6501 | } ); |
6499 | 6502 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -437,9 +437,9 @@ |
438 | 438 | if(nextSpace>lineLength&&caret<=lineLength){charInLine=caret-lastSpaceInLine;row++;} |
439 | 439 | return($.os.name=='mac'?13:($.os.name=='linux'?15:16))*row;} |
440 | 440 | return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){var scroll=getCaretScrollPosition(this);if(options.force||scroll<$(this).scrollTop()||scroll>$(this).scrollTop()+$(this).height()) |
441 | | -$(this).scrollTop(scroll);}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();var pos=$(this).textSelection('getCaretPosition');var oldScrollTop=this.scrollTop;range.moveToElementText(this);range.collapse();range.move('character',pos+1);range.select();if(this.scrollTop!=oldScrollTop) |
| 441 | +$(this).scrollTop(scroll);}else if(document.selection&&document.selection.createRange){var range=document.body.createTextRange();var savedRange=document.selection.createRange();var pos=$(this).textSelection('getCaretPosition');var oldScrollTop=this.scrollTop;range.moveToElementText(this);range.collapse();range.move('character',pos+1);range.select();if(this.scrollTop!=oldScrollTop) |
442 | 442 | this.scrollTop+=range.offsetTop;else if(options.force){range.move('character',-1);range.select();}} |
443 | | -$(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined) |
| 443 | +savedRange.select();$(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined,'startContainer':undefined,'endContainer':undefined},options);if(options.end===undefined) |
444 | 444 | options.end=options.start;if(options.endContainer==undefined) |
445 | 445 | options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;} |
446 | 446 | var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;} |