Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -78,14 +78,14 @@ |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 21 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), |
82 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 60 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 61 ), |
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' => 340 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 341 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 340 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 341 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -128,44 +128,55 @@ |
129 | 129 | }, //mark |
130 | 130 | |
131 | 131 | keydown: function( context, event ) { |
132 | | - // reset our ignoreKeypress variable if it's set to true |
133 | | - if( context.$iframe.data( 'ignoreKeypress' ) ) context.$iframe.data( 'ignoreKeypress', false ); |
| 132 | + // Reset our ignoreKeypress variable if it's set to true |
| 133 | + if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
| 134 | + context.$iframe.data( 'ignoreKeypress', false ); |
| 135 | + } |
134 | 136 | var $evtElem = event.jQueryNode; |
135 | | - if( $evtElem.hasClass( 'wikiEditor-template-label' ) ) { |
136 | | - // allow anything if the command or control key are depressed |
| 137 | + if ( $evtElem.hasClass( 'wikiEditor-template-label' ) ) { |
| 138 | + // Allow anything if the command or control key are depressed |
137 | 139 | if ( event.ctrlKey || event.metaKey ) return true; |
138 | 140 | switch ( event.which ) { |
139 | | - case 37://left |
140 | | - case 38://up |
141 | | - case 39://right |
142 | | - case 40: return true;//down |
| 141 | + case 13: // Enter |
| 142 | + $evtElem.click(); |
| 143 | + return false; |
| 144 | + case 32: // Space |
| 145 | + $evtElem.parent().siblings( '.wikiEditor-template-expand' ).click(); |
| 146 | + return false; |
| 147 | + case 37:// Left |
| 148 | + case 38:// Up |
| 149 | + case 39:// Right |
| 150 | + case 40: //Down |
| 151 | + return true; |
143 | 152 | default: |
144 | | - // set the ignroreKeypress variable so we don't allow typing if the key is held |
| 153 | + // Set the ignroreKeypress variable so we don't allow typing if the key is held |
145 | 154 | context.$iframe.data( 'ignoreKeypress', true ); |
146 | | - //can't type in a template name |
| 155 | + // Can't type in a template name |
147 | 156 | return false; |
148 | 157 | } |
149 | 158 | } else if ( $evtElem.hasClass( 'wikiEditor-template-text' ) ) { |
150 | 159 | switch ( event.which ) { |
151 | | - case 13: //enter |
| 160 | + case 13: // Enter |
152 | 161 | // Ensure that the user can't break this by holding in the enter key |
153 | 162 | context.$iframe.data( 'ignoreKeypress', true ); |
154 | | - //FIXME: may be a more elegant way to do this, but this works too |
155 | | - context.fn.encapsulateSelection( { 'pre':'\n', 'peri':'', 'post':'' } ); |
| 163 | + // FIXME: May be a more elegant way to do this, but this works too |
| 164 | + context.fn.encapsulateSelection( { 'pre': '\n', 'peri': '', 'post': '' } ); |
156 | 165 | return false; |
157 | 166 | default: return true; |
158 | 167 | } |
159 | | - }//classes |
160 | | - }, //keydown |
| 168 | + } |
| 169 | + }, |
161 | 170 | keyup: function( context, event ) { |
162 | | - // rest our ignoreKeypress variable if it's set to true |
163 | | - if( context.$iframe.data( 'ignoreKeypress' ) ) context.$iframe.data( 'ignoreKeypress', false ); |
| 171 | + // Rest our ignoreKeypress variable if it's set to true |
| 172 | + if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
| 173 | + context.$iframe.data( 'ignoreKeypress', false ); |
| 174 | + } |
164 | 175 | return true; |
165 | | - }, //keyup |
| 176 | + }, |
166 | 177 | keypress: function( context, event ) { |
167 | | - // if this event is from a keydown event which we want to block, ignore it |
| 178 | + // If this event is from a keydown event which we want to block, ignore it |
168 | 179 | return ( context.$iframe.data( 'ignoreKeypress' ) ? false : true ); |
169 | | - } //keypress |
| 180 | + } |
170 | 181 | }, |
171 | 182 | /** |
172 | 183 | * Regular expressions that produce tokens |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -9373,44 +9373,55 @@ |
9374 | 9374 | }, //mark |
9375 | 9375 | |
9376 | 9376 | keydown: function( context, event ) { |
9377 | | - // reset our ignoreKeypress variable if it's set to true |
9378 | | - if( context.$iframe.data( 'ignoreKeypress' ) ) context.$iframe.data( 'ignoreKeypress', false ); |
| 9377 | + // Reset our ignoreKeypress variable if it's set to true |
| 9378 | + if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
| 9379 | + context.$iframe.data( 'ignoreKeypress', false ); |
| 9380 | + } |
9379 | 9381 | var $evtElem = event.jQueryNode; |
9380 | | - if( $evtElem.hasClass( 'wikiEditor-template-label' ) ) { |
9381 | | - // allow anything if the command or control key are depressed |
| 9382 | + if ( $evtElem.hasClass( 'wikiEditor-template-label' ) ) { |
| 9383 | + // Allow anything if the command or control key are depressed |
9382 | 9384 | if ( event.ctrlKey || event.metaKey ) return true; |
9383 | 9385 | switch ( event.which ) { |
9384 | | - case 37://left |
9385 | | - case 38://up |
9386 | | - case 39://right |
9387 | | - case 40: return true;//down |
| 9386 | + case 13: // Enter |
| 9387 | + $evtElem.click(); |
| 9388 | + return false; |
| 9389 | + case 32: // Space |
| 9390 | + $evtElem.parent().siblings( '.wikiEditor-template-expand' ).click(); |
| 9391 | + return false; |
| 9392 | + case 37:// Left |
| 9393 | + case 38:// Up |
| 9394 | + case 39:// Right |
| 9395 | + case 40: //Down |
| 9396 | + return true; |
9388 | 9397 | default: |
9389 | | - // set the ignroreKeypress variable so we don't allow typing if the key is held |
| 9398 | + // Set the ignroreKeypress variable so we don't allow typing if the key is held |
9390 | 9399 | context.$iframe.data( 'ignoreKeypress', true ); |
9391 | | - //can't type in a template name |
| 9400 | + // Can't type in a template name |
9392 | 9401 | return false; |
9393 | 9402 | } |
9394 | 9403 | } else if ( $evtElem.hasClass( 'wikiEditor-template-text' ) ) { |
9395 | 9404 | switch ( event.which ) { |
9396 | | - case 13: //enter |
| 9405 | + case 13: // Enter |
9397 | 9406 | // Ensure that the user can't break this by holding in the enter key |
9398 | 9407 | context.$iframe.data( 'ignoreKeypress', true ); |
9399 | | - //FIXME: may be a more elegant way to do this, but this works too |
9400 | | - context.fn.encapsulateSelection( { 'pre':'\n', 'peri':'', 'post':'' } ); |
| 9408 | + // FIXME: May be a more elegant way to do this, but this works too |
| 9409 | + context.fn.encapsulateSelection( { 'pre': '\n', 'peri': '', 'post': '' } ); |
9401 | 9410 | return false; |
9402 | 9411 | default: return true; |
9403 | 9412 | } |
9404 | | - }//classes |
9405 | | - }, //keydown |
| 9413 | + } |
| 9414 | + }, |
9406 | 9415 | keyup: function( context, event ) { |
9407 | | - // rest our ignoreKeypress variable if it's set to true |
9408 | | - if( context.$iframe.data( 'ignoreKeypress' ) ) context.$iframe.data( 'ignoreKeypress', false ); |
| 9416 | + // Rest our ignoreKeypress variable if it's set to true |
| 9417 | + if ( context.$iframe.data( 'ignoreKeypress' ) ) { |
| 9418 | + context.$iframe.data( 'ignoreKeypress', false ); |
| 9419 | + } |
9409 | 9420 | return true; |
9410 | | - }, //keyup |
| 9421 | + }, |
9411 | 9422 | keypress: function( context, event ) { |
9412 | | - // if this event is from a keydown event which we want to block, ignore it |
| 9423 | + // If this event is from a keydown event which we want to block, ignore it |
9413 | 9424 | return ( context.$iframe.data( 'ignoreKeypress' ) ? false : true ); |
9414 | | - } //keypress |
| 9425 | + } |
9415 | 9426 | }, |
9416 | 9427 | /** |
9417 | 9428 | * Regular expressions that produce tokens |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -646,7 +646,9 @@ |
647 | 647 | 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;}}} |
648 | 648 | 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;} |
649 | 649 | 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);}} |
650 | | -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});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}},keydown:function(context,event){if(context.$iframe.data('ignoreKeypress'))context.$iframe.data('ignoreKeypress',false);var $evtElem=event.jQueryNode;if($evtElem.hasClass('wikiEditor-template-label')){if(event.ctrlKey||event.metaKey)return true;switch(event.which){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);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">'+ |
| 650 | +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});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}},keydown:function(context,event){if(context.$iframe.data('ignoreKeypress')){context.$iframe.data('ignoreKeypress',false);} |
| 651 | +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);} |
| 652 | +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">'+ |
651 | 653 | $.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').find('.wikiEditor-template-text').toggleClass('wikiEditor-nodisplay');},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':'\ |
652 | 654 | <fieldset>\ |
653 | 655 | <div class="wikiEditor-template-dialog-title" />\ |