Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -78,14 +78,14 @@ |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 23 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 98 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), |
82 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 75 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 76 ), |
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' => 380 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 381 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 380 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 381 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | 'browsers': { |
17 | 17 | // Left-to-right languages |
18 | 18 | 'ltr': { |
19 | | - 'msie': false, |
| 19 | + 'msie': [['>=', 8]], |
20 | 20 | 'firefox': [['>=', 3]], |
21 | 21 | 'opera': [['>=', 10]], |
22 | 22 | 'safari': [['>=', 4]] |
— | — | @@ -146,9 +146,11 @@ |
147 | 147 | switch ( event.which ) { |
148 | 148 | case 13: // Enter |
149 | 149 | $evtElem.click(); |
| 150 | + event.preventDefault(); |
150 | 151 | return false; |
151 | 152 | case 32: // Space |
152 | 153 | $evtElem.parent().siblings( '.wikiEditor-template-expand' ).click(); |
| 154 | + event.preventDefault(); |
153 | 155 | return false; |
154 | 156 | case 37:// Left |
155 | 157 | case 38:// Up |
— | — | @@ -159,6 +161,7 @@ |
160 | 162 | // Set the ignroreKeypress variable so we don't allow typing if the key is held |
161 | 163 | context.$iframe.data( 'ignoreKeypress', true ); |
162 | 164 | // Can't type in a template name |
| 165 | + event.preventDefault(); |
163 | 166 | return false; |
164 | 167 | } |
165 | 168 | } else if ( $evtElem.hasClass( 'wikiEditor-template-text' ) ) { |
— | — | @@ -168,6 +171,7 @@ |
169 | 172 | context.$iframe.data( 'ignoreKeypress', true ); |
170 | 173 | // FIXME: May be a more elegant way to do this, but this works too |
171 | 174 | context.fn.encapsulateSelection( { 'pre': '\n', 'peri': '', 'post': '' } ); |
| 175 | + event.preventDefault(); |
172 | 176 | return false; |
173 | 177 | default: return true; |
174 | 178 | } |
— | — | @@ -244,12 +248,25 @@ |
245 | 249 | */ |
246 | 250 | bindTemplateEvents: function( $wrapper ) { |
247 | 251 | var $template = $wrapper.parent( '.wikiEditor-template' ); |
| 252 | + |
| 253 | + $template.parent().attr('contentEditable', 'false'); |
| 254 | + |
| 255 | + $template.click( function(event) {event.preventDefault(); return false;} ) |
| 256 | + |
248 | 257 | $template.find( '.wikiEditor-template-name' ) |
249 | | - .click( function() { $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); return false; } ) |
250 | | - .mousedown( function() { return false; } ); |
| 258 | + .click( function( event ) { |
| 259 | + $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); |
| 260 | + event.stopPropagation(); |
| 261 | + return false; |
| 262 | + } ) |
| 263 | + .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
251 | 264 | $template.find( '.wikiEditor-template-expand' ) |
252 | | - .click( function() { $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); return false; } ) |
253 | | - .mousedown( function() { return false; } ); |
| 265 | + .click( function( event ) { |
| 266 | + $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); |
| 267 | + event.stopPropagation(); |
| 268 | + return false; |
| 269 | + } ) |
| 270 | + .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
254 | 271 | }, |
255 | 272 | /** |
256 | 273 | * Toggle the visisbilty of the wikitext for a given template |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6803,7 +6803,7 @@ |
6804 | 6804 | // where we left off |
6805 | 6805 | var context = $(this).data( 'wikiEditor-context' ); |
6806 | 6806 | // On first call, we need to set things up, but on all following calls we can skip right to the API handling |
6807 | | -if ( typeof context == 'undefined' ) { |
| 6807 | +if ( !context || typeof context == 'undefined' ) { |
6808 | 6808 | |
6809 | 6809 | // Star filling the context with useful data - any jQuery selections, as usual should be named with a preceding $ |
6810 | 6810 | context = { |
— | — | @@ -9371,7 +9371,7 @@ |
9372 | 9372 | 'browsers': { |
9373 | 9373 | // Left-to-right languages |
9374 | 9374 | 'ltr': { |
9375 | | - 'msie': false, |
| 9375 | + 'msie': [['>=', 8]], |
9376 | 9376 | 'firefox': [['>=', 3]], |
9377 | 9377 | 'opera': [['>=', 10]], |
9378 | 9378 | 'safari': [['>=', 4]] |
— | — | @@ -9502,9 +9502,11 @@ |
9503 | 9503 | switch ( event.which ) { |
9504 | 9504 | case 13: // Enter |
9505 | 9505 | $evtElem.click(); |
| 9506 | + event.preventDefault(); |
9506 | 9507 | return false; |
9507 | 9508 | case 32: // Space |
9508 | 9509 | $evtElem.parent().siblings( '.wikiEditor-template-expand' ).click(); |
| 9510 | + event.preventDefault(); |
9509 | 9511 | return false; |
9510 | 9512 | case 37:// Left |
9511 | 9513 | case 38:// Up |
— | — | @@ -9515,6 +9517,7 @@ |
9516 | 9518 | // Set the ignroreKeypress variable so we don't allow typing if the key is held |
9517 | 9519 | context.$iframe.data( 'ignoreKeypress', true ); |
9518 | 9520 | // Can't type in a template name |
| 9521 | + event.preventDefault(); |
9519 | 9522 | return false; |
9520 | 9523 | } |
9521 | 9524 | } else if ( $evtElem.hasClass( 'wikiEditor-template-text' ) ) { |
— | — | @@ -9524,6 +9527,7 @@ |
9525 | 9528 | context.$iframe.data( 'ignoreKeypress', true ); |
9526 | 9529 | // FIXME: May be a more elegant way to do this, but this works too |
9527 | 9530 | context.fn.encapsulateSelection( { 'pre': '\n', 'peri': '', 'post': '' } ); |
| 9531 | + event.preventDefault(); |
9528 | 9532 | return false; |
9529 | 9533 | default: return true; |
9530 | 9534 | } |
— | — | @@ -9600,12 +9604,25 @@ |
9601 | 9605 | */ |
9602 | 9606 | bindTemplateEvents: function( $wrapper ) { |
9603 | 9607 | var $template = $wrapper.parent( '.wikiEditor-template' ); |
| 9608 | + |
| 9609 | + $template.parent().attr('contentEditable', 'false'); |
| 9610 | + |
| 9611 | + $template.click( function(event) {event.preventDefault(); return false;} ) |
| 9612 | + |
9604 | 9613 | $template.find( '.wikiEditor-template-name' ) |
9605 | | - .click( function() { $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); return false; } ) |
9606 | | - .mousedown( function() { return false; } ); |
| 9614 | + .click( function( event ) { |
| 9615 | + $.wikiEditor.modules.templateEditor.fn.createDialog( $wrapper ); |
| 9616 | + event.stopPropagation(); |
| 9617 | + return false; |
| 9618 | + } ) |
| 9619 | + .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
9607 | 9620 | $template.find( '.wikiEditor-template-expand' ) |
9608 | | - .click( function() { $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); return false; } ) |
9609 | | - .mousedown( function() { return false; } ); |
| 9621 | + .click( function( event ) { |
| 9622 | + $.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor( $wrapper ); |
| 9623 | + event.stopPropagation(); |
| 9624 | + return false; |
| 9625 | + } ) |
| 9626 | + .mousedown( function( event ) { event.stopPropagation(); return false; } ); |
9610 | 9627 | }, |
9611 | 9628 | /** |
9612 | 9629 | * Toggle the visisbilty of the wikitext for a given template |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -454,7 +454,7 @@ |
455 | 455 | return false;},'autoMsg':function(object,property){if(typeof property=='object'){for(var i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
456 | 456 | if(property in object){return object[property];}else if(property+'Msg'in object){if(typeof object[property+'Msg']=='object'){return mw.usability.getMsg.apply(mw.usability,object[property+'Msg']);}else{return mw.usability.getMsg(object[property+'Msg']);}}else{return'';}},'autoLang':function(object,lang){return object[lang||wgUserLanguage]||object['default']||object;},'autoIcon':function(icon,path,lang){var src=$.wikiEditor.autoLang(icon,lang);path=path||$.wikiEditor.imgPath;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/'){src=path+src;} |
457 | 457 | return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);} |
458 | | -var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'oldDelayedSel':null,'savedSelection':null,'history':[],'historyPosition':-1,'oldDelayedHistoryPosition':-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} |
| 458 | +var context=$(this).data('wikiEditor-context');if(!context||typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'oldDelayedSel':null,'savedSelection':null,'history':[],'historyPosition':-1,'oldDelayedHistoryPosition':-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;} |
459 | 459 | for(var module in modules){if(typeof module=='string'&&$.wikiEditor.isSupported($.wikiEditor.modules[module])){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}} |
460 | 460 | 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={'keydown':function(event){switch(event.which){case 90:case 89:if(event.which==89&&!$.browser.msie){return true;}else if((event.ctrlKey||event.metaKey)&&context.history.length){var newPosition;if(event.shiftKey||event.which==89){newPosition=context.historyPosition+1;}else{newPosition=context.historyPosition-1;} |
461 | 461 | if(newPosition>=(context.history.length*-1)&&newPosition<0){context.fn.updateHistory(context.oldDelayedHTML!=context.$content.html());context.oldDelayedHistoryPosition=context.historyPosition;context.historyPosition=newPosition;context.$content.html(context.history[context.history.length+context.historyPosition].html);context.fn.purgeOffsets();if(context.history[context.history.length+context.historyPosition].sel){context.fn.setSelection({start:context.history[context.history.length+context.historyPosition].sel[0],end:context.history[context.history.length+context.historyPosition].sel[1]});}} |
— | — | @@ -652,15 +652,16 @@ |
653 | 653 | $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
654 | 654 | $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
655 | 655 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
656 | | -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'nameMappings':{"infobox skyscraper":"building_name","infobox settlement":"official_name"},'browsers':{'ltr':{'msie':false,'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':false,'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){if(context.modules.highlight.currentScope=='realchange'){return;} |
| 656 | +$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'nameMappings':{"infobox skyscraper":"building_name","infobox settlement":"official_name"},'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':false,'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){if(context.modules.highlight.currentScope=='realchange'){return;} |
657 | 657 | var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;} |
658 | 658 | if(tokenIndex<tokenArray.length){var beginIndex=tokenIndex;var endIndex=-1;var openTemplates=1;var templatesMatched=false;while(tokenIndex<tokenArray.length-1&&endIndex==-1){tokenIndex++;if(tokenArray[tokenIndex].label=='TEMPLATE_BEGIN'){openTemplates++;}else if(tokenArray[tokenIndex].label=='TEMPLATE_END'){openTemplates--;if(openTemplates==0){endIndex=tokenIndex;}}} |
659 | 659 | if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',afterWrap:function(node){var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if(model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}else{$(node).addClass('wikiEditor-template-text');}},beforeUnwrap:function(node){if($(node).parent().hasClass('wikiEditor-template')){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}},onSkip:function(node){if($(node).html()==$(node).data('oldHTML')){return;} |
660 | 660 | var model=$.wikiEditor.modules.templateEditor.fn.updateModel($(node));if($(node).parent().hasClass('wikiEditor-template')){var $label=$(node).parent().find('.wikiEditor-template-label');var displayName=$.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(model);if($label.text()!=displayName){$label.text(displayName);}} |
661 | 661 | if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));$.wikiEditor.modules.templateEditor.fn.bindTemplateEvents($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context,skipDivision:'realchange'});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}},keydown:function(context,event){if(context.$iframe.data('ignoreKeypress')){context.$iframe.data('ignoreKeypress',false);} |
662 | | -var $evtElem=event.jQueryNode;if($evtElem.hasClass('wikiEditor-template-label')){if(event.ctrlKey||event.metaKey)return true;switch(event.which){case 13:$evtElem.click();return false;case 32:$evtElem.parent().siblings('.wikiEditor-template-expand').click();return false;case 37:case 38:case 39:case 40:return true;default:context.$iframe.data('ignoreKeypress',true);return false;}}else if($evtElem.hasClass('wikiEditor-template-text')){switch(event.which){case 13:context.$iframe.data('ignoreKeypress',true);context.fn.encapsulateSelection({'pre':'\n','peri':'','post':''});return false;default:return true;}}},keyup:function(context,event){if(context.$iframe.data('ignoreKeypress')){context.$iframe.data('ignoreKeypress',false);} |
| 662 | +var $evtElem=event.jQueryNode;if($evtElem.hasClass('wikiEditor-template-label')){if(event.ctrlKey||event.metaKey)return true;switch(event.which){case 13:$evtElem.click();event.preventDefault();return false;case 32:$evtElem.parent().siblings('.wikiEditor-template-expand').click();event.preventDefault();return false;case 37:case 38:case 39:case 40:return true;default:context.$iframe.data('ignoreKeypress',true);event.preventDefault();return false;}}else if($evtElem.hasClass('wikiEditor-template-text')){switch(event.which){case 13:context.$iframe.data('ignoreKeypress',true);context.fn.encapsulateSelection({'pre':'\n','peri':'','post':''});event.preventDefault();return false;default:return true;}}},keyup:function(context,event){if(context.$iframe.data('ignoreKeypress')){context.$iframe.data('ignoreKeypress',false);} |
663 | 663 | return true;},keypress:function(context,event){return(context.$iframe.data('ignoreKeypress')?false:true);}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed').prepend('<span class="wikiEditor-template-expand wikiEditor-noinclude"></span>'+'<span class="wikiEditor-template-name wikiEditor-noinclude">'+'<span class="wikiEditor-template-label wikiEditor-noinclude">'+ |
664 | | -$.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(model)+'</span>'+'<span class="wikiEditor-template-dialog wikiEditor-noinclude"></span>'+'</span>');},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},bindTemplateEvents:function($wrapper){var $template=$wrapper.parent('.wikiEditor-template');$template.find('.wikiEditor-template-name').click(function(){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);return false;}).mousedown(function(){return false;});$template.find('.wikiEditor-template-expand').click(function(){$.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor($wrapper);return false;}).mousedown(function(){return false;});},toggleWikiTextEditor:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');context.fn.purgeOffsets();$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed');var $templateText=$template.find('.wikiEditor-template-text');$templateText.toggleClass('wikiEditor-nodisplay');if($templateText.hasClass('wikiEditor-nodisplay')){if($templateText.html()!=$templateText.data('oldHTML')){var templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);var $tLabel=$template.find('.wikiEditor-template-label');$tLabel.text($.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(templateModel));}}},createDialog:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\ |
| 664 | +$.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(model)+'</span>'+'<span class="wikiEditor-template-dialog wikiEditor-noinclude"></span>'+'</span>');},unwrapTemplate:function($wrapper){$wrapper.parent().replaceWith($wrapper);},bindTemplateEvents:function($wrapper){var $template=$wrapper.parent('.wikiEditor-template');$template.parent().attr('contentEditable','false');$template.click(function(event){event.preventDefault();return false;}) |
| 665 | +$template.find('.wikiEditor-template-name').click(function(event){$.wikiEditor.modules.templateEditor.fn.createDialog($wrapper);event.stopPropagation();return false;}).mousedown(function(event){event.stopPropagation();return false;});$template.find('.wikiEditor-template-expand').click(function(event){$.wikiEditor.modules.templateEditor.fn.toggleWikiTextEditor($wrapper);event.stopPropagation();return false;}).mousedown(function(event){event.stopPropagation();return false;});},toggleWikiTextEditor:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');context.fn.purgeOffsets();$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed');var $templateText=$template.find('.wikiEditor-template-text');$templateText.toggleClass('wikiEditor-nodisplay');if($templateText.hasClass('wikiEditor-nodisplay')){if($templateText.html()!=$templateText.data('oldHTML')){var templateModel=$.wikiEditor.modules.templateEditor.fn.updateModel($templateText);var $tLabel=$template.find('.wikiEditor-template-label');$tLabel.text($.wikiEditor.modules.templateEditor.fn.getTemplateDisplayName(templateModel));}}},createDialog:function($wrapper){var context=$wrapper.data('marker').context;var $template=$wrapper.parent('.wikiEditor-template');var dialog={'titleMsg':'wikieditor-template-editor-dialog-title','id':'wikiEditor-template-dialog','html':'\ |
665 | 666 | <fieldset>\ |
666 | 667 | <div class="wikiEditor-template-dialog-title" />\ |
667 | 668 | <div class="wikiEditor-template-dialog-fields" />\ |