Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ), |
75 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 34 ), |
| 75 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 35 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 39 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ), |
— | — | @@ -81,10 +81,10 @@ |
82 | 82 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ), |
83 | 83 | ), |
84 | 84 | 'combined' => array( |
85 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 108 ), |
| 85 | + array( 'src' => 'js/plugins.combined.js', 'version' => 109 ), |
86 | 86 | ), |
87 | 87 | 'minified' => array( |
88 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 108 ), |
| 88 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 109 ), |
89 | 89 | ), |
90 | 90 | ), |
91 | 91 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -531,10 +531,10 @@ |
532 | 532 | * @param force If true, scroll the element even if it's already visible |
533 | 533 | */ |
534 | 534 | 'scrollToTop': function( $element, force ) { |
535 | | - var body = context.$content.closest( 'body' ); |
| 535 | + var html = context.$content.closest( 'html' ); |
536 | 536 | var y = $element.offset().top - context.$content.offset().top; |
537 | | - if ( force || y < body.scrollTop() || y > body.scrollTop() + body.height() ) |
538 | | - body.scrollTop( y ); |
| 537 | + if ( force || y < html.scrollTop() || y > html.scrollTop() + context.$iframe.height() ) |
| 538 | + html.scrollTop( y ); |
539 | 539 | $element.trigger( 'scrollToTop' ); |
540 | 540 | }, |
541 | 541 | /** |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1570,7 +1570,7 @@ |
1571 | 1571 | switch ( event.type ) { |
1572 | 1572 | case 'keypress': |
1573 | 1573 | if ( /* TODO: test if something interesting was deleted */ true ) { |
1574 | | - event.data.scope = 'division'; |
| 1574 | + event.data.scope = 'keydown'; |
1575 | 1575 | } else { |
1576 | 1576 | event.data.scope = 'character'; |
1577 | 1577 | } |
— | — | @@ -1696,7 +1696,13 @@ |
1697 | 1697 | } |
1698 | 1698 | // We use .html() instead of .text() so HTML entities are handled right |
1699 | 1699 | // Setting the HTML of the textarea doesn't work on all browsers, use a dummy <div> instead |
1700 | | - return $( '<div />' ).html( context.$content.html().replace( /\<br\>/g, "\n" ) ).text(); |
| 1700 | + |
| 1701 | + |
| 1702 | + //get rid of the noincludes when getting text |
| 1703 | + var $dummyDiv = $( '<div />' ).html( context.$content.html().replace( /\<br\>/g, "\n" ) ); |
| 1704 | + $dummyDiv.find( ".wiki-editor-noinclude" ).each( function() { $( this ).remove(); } ); |
| 1705 | + return $dummyDiv.text(); |
| 1706 | + |
1701 | 1707 | }, |
1702 | 1708 | /** |
1703 | 1709 | * Sets the complete contents of the iframe (in plain text, not HTML; HTML passed will be converted to entities) |
— | — | @@ -1835,10 +1841,10 @@ |
1836 | 1842 | * @param force If true, scroll the element even if it's already visible |
1837 | 1843 | */ |
1838 | 1844 | 'scrollToTop': function( $element, force ) { |
1839 | | - var body = context.$content.closest( 'body' ); |
| 1845 | + var html = context.$content.closest( 'html' ); |
1840 | 1846 | var y = $element.offset().top - context.$content.offset().top; |
1841 | | - if ( force || y < body.scrollTop() || y > body.scrollTop() + body.height() ) |
1842 | | - body.scrollTop( y ); |
| 1847 | + if ( force || y < html.scrollTop() || y > html.scrollTop() + context.$iframe.height() ) |
| 1848 | + html.scrollTop( y ); |
1843 | 1849 | $element.trigger( 'scrollToTop' ); |
1844 | 1850 | }, |
1845 | 1851 | /** |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} |
92 | 92 | var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} |
93 | 93 | for(module in modules){if(typeof module=='string'&&module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}} |
94 | | -if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='division';}else{event.data.scope='character';} |
| 94 | +if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='keydown';}else{event.data.scope='character';} |
95 | 95 | break;case'mousedown':if(true){event.data.scope='division';}else{return false;} |
96 | 96 | break;default:event.data.scope='division';break;} |
97 | 97 | return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
102 | 102 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
103 | 103 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'getContents':function(){if($.browser.name=='msie'){return context.$content.text();} |
104 | | -return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
| 104 | +var $dummyDiv=$('<div />').html(context.$content.html().replace(/\<br\>/g,"\n"));$dummyDiv.find(".wiki-editor-noinclude").each(function(){$(this).remove();});return $dummyDiv.text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
105 | 105 | if(retval.text){retval=retval.text;}else if(retval.toString){retval=retval.toString();} |
106 | 106 | 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+=' ';} |
107 | 107 | var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0){pre="\n"+options.pre;} |
— | — | @@ -109,8 +109,8 @@ |
110 | 110 | if(lastNode){context.fn.scrollToTop(lastNode);} |
111 | 111 | context.$content.trigger('encapsulateSelection',[pre,options.peri,post,options.ownline,options.replace]);return context.$textarea;},'getCaretPosition':function(options){},'setSelection':function(options){var sel=context.$iframe[0].contentWindow.getSelection();var sc=options.startContainer,ec=options.endContainer;sc=sc.jquery?sc[0]:sc;ec=ec.jquery?ec[0]:ec;while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;} |
112 | 112 | while(ec.firstChild&&ec.nodeName!='#text'){ec=ec.firstChild;} |
113 | | -sel.extend(sc,options.start);sel.collapseToStart();if(options.end!=options.start||sc!=ec){sel.extend(ec,options.end);}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var body=context.$content.closest('body');var y=$element.offset().top-context.$content.offset().top;if(force||y<body.scrollTop()||y>body.scrollTop()+body.height()) |
114 | | -body.scrollTop(y);$element.trigger('scrollToTop');},'beforeSelection':function(selector,getAll){if(typeof selector=='undefined') |
| 113 | +sel.extend(sc,options.start);sel.collapseToStart();if(options.end!=options.start||sc!=ec){sel.extend(ec,options.end);}},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html');var y=$element.offset().top-context.$content.offset().top;if(force||y<html.scrollTop()||y>html.scrollTop()+context.$iframe.height()) |
| 114 | +html.scrollTop(y);$element.trigger('scrollToTop');},'beforeSelection':function(selector,getAll){if(typeof selector=='undefined') |
115 | 115 | selector='*';var retval=[];var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);var e=range.startContainer;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event)});context.$iframe=$('<iframe></iframe>').attr({'frameborder':0,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append(context.$textarea.val().replace(/</g,'<').replace(/>/g,'>'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
116 | 116 | context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});} |
117 | 117 | arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,typeof arguments[0]=='undefined'?{}:arguments[0]);}} |