Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | array( |
155 | 155 | 'src' => 'js/plugins/jquery.wikiEditor.js', |
156 | 156 | 'class' => 'j.wikiEditor', |
157 | | - 'version' => 51 |
| 157 | + 'version' => 52 |
158 | 158 | ), |
159 | 159 | array( |
160 | 160 | 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', |
— | — | @@ -191,10 +191,10 @@ |
192 | 192 | 'version' => 1 ), |
193 | 193 | ), |
194 | 194 | 'combined' => array( |
195 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 152 ), |
| 195 | + array( 'src' => 'js/plugins.combined.js', 'version' => 153 ), |
196 | 196 | ), |
197 | 197 | 'minified' => array( |
198 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 152 ), |
| 198 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 153 ), |
199 | 199 | ), |
200 | 200 | ), |
201 | 201 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -451,9 +451,9 @@ |
452 | 452 | // in reverse order |
453 | 453 | var lastNode; |
454 | 454 | for ( var i = insertLines.length - 1; i >= 0; i-- ) { |
455 | | - range.insertNode( document.createTextNode( insertLines[i] ) ); |
| 455 | + range.insertNode( context.$iframe[0].contentWindow.document.createTextNode( insertLines[i] ) ); |
456 | 456 | if ( i > 0 ) { |
457 | | - lastNode = range.insertNode( document.createElement( 'br' ) ); |
| 457 | + lastNode = range.insertNode( context.$iframe[0].contentWindow.document.createElement( 'br' ) ); |
458 | 458 | } |
459 | 459 | } |
460 | 460 | if ( lastNode ) { |
— | — | @@ -466,7 +466,7 @@ |
467 | 467 | if ( options.ownline && range.moveStart ) { |
468 | 468 | // Check if we're at the start of a line |
469 | 469 | // If not, prepend a newline |
470 | | - var range2 = document.selection.createRange(); |
| 470 | + var range2 = context.$iframe[0].contentWindow.document.selection.createRange(); |
471 | 471 | range2.collapse(); |
472 | 472 | range2.moveStart( 'character', -1 ); |
473 | 473 | // FIXME: Which check is correct? |
— | — | @@ -476,7 +476,7 @@ |
477 | 477 | |
478 | 478 | // Check if we're at the end of a line |
479 | 479 | // If not, append a newline |
480 | | - var range3 = document.selection.createRange(); |
| 480 | + var range3 = context.$iframe[0].contentWindow.document.selection.createRange(); |
481 | 481 | range3.collapse( false ); |
482 | 482 | range3.moveEnd( 'character', 1 ); |
483 | 483 | if ( range3.text != "\r" && range3.text != "\n" && range3.text != "" ) { |
— | — | @@ -526,6 +526,7 @@ |
527 | 527 | ec = ec.firstChild; |
528 | 528 | } |
529 | 529 | var range = context.$iframe[0].contentWindow.document.createRange(); |
| 530 | + console.dir( [ range, sc, options.start ] ); |
530 | 531 | range.setStart( sc, options.start ); |
531 | 532 | range.setEnd( ec, options.end ); |
532 | 533 | sel.removeAllRanges(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6932,9 +6932,9 @@ |
6933 | 6933 | // in reverse order |
6934 | 6934 | var lastNode; |
6935 | 6935 | for ( var i = insertLines.length - 1; i >= 0; i-- ) { |
6936 | | - range.insertNode( document.createTextNode( insertLines[i] ) ); |
| 6936 | + range.insertNode( context.$iframe[0].contentWindow.document.createTextNode( insertLines[i] ) ); |
6937 | 6937 | if ( i > 0 ) { |
6938 | | - lastNode = range.insertNode( document.createElement( 'br' ) ); |
| 6938 | + lastNode = range.insertNode( context.$iframe[0].contentWindow.document.createElement( 'br' ) ); |
6939 | 6939 | } |
6940 | 6940 | } |
6941 | 6941 | if ( lastNode ) { |
— | — | @@ -6947,7 +6947,7 @@ |
6948 | 6948 | if ( options.ownline && range.moveStart ) { |
6949 | 6949 | // Check if we're at the start of a line |
6950 | 6950 | // If not, prepend a newline |
6951 | | - var range2 = document.selection.createRange(); |
| 6951 | + var range2 = context.$iframe[0].contentWindow.document.selection.createRange(); |
6952 | 6952 | range2.collapse(); |
6953 | 6953 | range2.moveStart( 'character', -1 ); |
6954 | 6954 | // FIXME: Which check is correct? |
— | — | @@ -6957,7 +6957,7 @@ |
6958 | 6958 | |
6959 | 6959 | // Check if we're at the end of a line |
6960 | 6960 | // If not, append a newline |
6961 | | - var range3 = document.selection.createRange(); |
| 6961 | + var range3 = context.$iframe[0].contentWindow.document.selection.createRange(); |
6962 | 6962 | range3.collapse( false ); |
6963 | 6963 | range3.moveEnd( 'character', 1 ); |
6964 | 6964 | if ( range3.text != "\r" && range3.text != "\n" && range3.text != "" ) { |
— | — | @@ -7007,6 +7007,7 @@ |
7008 | 7008 | ec = ec.firstChild; |
7009 | 7009 | } |
7010 | 7010 | var range = context.$iframe[0].contentWindow.document.createRange(); |
| 7011 | + console.dir( [ range, sc, options.start ] ); |
7011 | 7012 | range.setStart( sc, options.start ); |
7012 | 7013 | range.setEnd( ec, options.end ); |
7013 | 7014 | sel.removeAllRanges(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -454,13 +454,13 @@ |
455 | 455 | return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');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+=' ';} |
456 | 456 | if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0){pre="\n"+options.pre;} |
457 | 457 | if(range.endContainer==range.commonAncestorContainer){post+="\n";}} |
458 | | -var insertText=pre+selText+post;var insertLines=insertText.split("\n");range.extractContents();var lastNode;for(var i=insertLines.length-1;i>=0;i--){range.insertNode(document.createTextNode(insertLines[i]));if(i>0){lastNode=range.insertNode(document.createElement('br'));}} |
459 | | -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=document.selection.createRange();range2.collapse();range2.moveStart('character',-1);if(range2.text!="\r"&&range2.text!="\n"&&range2.text!=""){pre="\n"+pre;} |
460 | | -var range3=document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!=""){post+="\n";}} |
| 458 | +var insertText=pre+selText+post;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'));}} |
| 459 | +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;} |
| 460 | +var range3=context.$iframe[0].contentWindow.document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!=""){post+="\n";}} |
461 | 461 | range.pasteHTML((pre+selText+post).replace(/\</g,'<').replace(/>/g,'>').replace(/\r?\n/g,'<br />'));} |
462 | 462 | context.$content.trigger('encapsulateSelection',[pre,options.peri,post,options.ownline,options.replace]);return context.$textarea;},'getCaretPosition':function(options){},'setSelection':function(options){var sc=options.startContainer,ec=options.endContainer;sc=sc.jquery?sc[0]:sc;ec=ec.jquery?ec[0]:ec;if(context.$iframe[0].contentWindow.getSelection){var sel=context.$iframe[0].contentWindow.getSelection();while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;} |
463 | 463 | while(ec.firstChild&&ec.nodeName!='#text'){ec=ec.firstChild;} |
464 | | -var range=context.$iframe[0].contentWindow.document.createRange();range.setStart(sc,options.start);range.setEnd(ec,options.end);sel.removeAllRanges();sel.addRange(range);context.$iframe[0].contentWindow.focus();}else if(context.$iframe[0].contentWindow.document.body.createTextRange){var range=context.$iframe[0].contentWindow.document.body.createTextRange();range.moveToElementText(sc);range.moveStart('character',options.start);var range2=context.$iframe[0].contentWindow.document.body.createTextRange();range2.moveToElementText(ec);range2.collapse();range2.moveEnd('character',options.end);range.setEndPoint('EndToEnd',range2);range.select();}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body'),parent=$('html');var y=$element.offset().top-context.$content.offset().top;y=parent.scrollTop()>0?y+html.scrollTop()-parent.scrollTop():y;if(force||y<html.scrollTop()||y>html.scrollTop()+context.$iframe.height()){html.scrollTop(y);} |
| 464 | +var range=context.$iframe[0].contentWindow.document.createRange();console.dir([range,sc,options.start]);range.setStart(sc,options.start);range.setEnd(ec,options.end);sel.removeAllRanges();sel.addRange(range);context.$iframe[0].contentWindow.focus();}else if(context.$iframe[0].contentWindow.document.body.createTextRange){var range=context.$iframe[0].contentWindow.document.body.createTextRange();range.moveToElementText(sc);range.moveStart('character',options.start);var range2=context.$iframe[0].contentWindow.document.body.createTextRange();range2.moveToElementText(ec);range2.collapse();range2.moveEnd('character',options.end);range.setEndPoint('EndToEnd',range2);range.select();}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body'),parent=$('html');var y=$element.offset().top-context.$content.offset().top;y=parent.scrollTop()>0?y+html.scrollTop()-parent.scrollTop():y;if(force||y<html.scrollTop()||y>html.scrollTop()+context.$iframe.height()){html.scrollTop(y);} |
465 | 465 | $element.trigger('scrollToTop');},'beforeSelection':function(selector,strict){if(typeof selector=='undefined'){selector='*';} |
466 | 466 | var e;if(context.$iframe[0].contentWindow.getSelection){var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);e=range.startContainer;}else if(context.$iframe[0].contentWindow.document.selection){return $([]);} |
467 | 467 | if(e.nodeName!='#text'){var newE=e.firstChild;for(var i=0;i<range.startOffset-1&&newE;i++){newE=newE.nextSibling;} |