Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -73,19 +73,19 @@ |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 172 ), |
77 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 44 ), |
| 77 | + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 45 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ), |
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' => 61 ), |
| 82 | + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 62 ), |
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' => 342 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 343 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 342 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 343 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | * Event handlers |
38 | 38 | */ |
39 | 39 | evt: { |
| 40 | + |
40 | 41 | mark: function( context, event ) { |
41 | 42 | // Get references to the markers and tokens from the current context |
42 | 43 | var markers = context.modules.highlight.markers; |
— | — | @@ -117,7 +118,8 @@ |
118 | 119 | return $( ca1.parentNode ).is( 'span.wikiEditor-template-text' ) ? |
119 | 120 | ca1.parentNode : null; |
120 | 121 | }, |
121 | | - context: context |
| 122 | + context: context, |
| 123 | + skipDivision: "realchange" |
122 | 124 | } ); |
123 | 125 | } else { //else this was an unmatched opening |
124 | 126 | tokenArray[beginIndex].label = 'TEMPLATE_FALSE_BEGIN'; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js |
— | — | @@ -154,6 +154,7 @@ |
155 | 155 | |
156 | 156 | var markers = context.modules.highlight.markers = []; |
157 | 157 | // Get all markers |
| 158 | + |
158 | 159 | context.fn.trigger( 'mark' ); |
159 | 160 | markers.sort( function( a, b ) { return a.start - b.start || a.end - b.end; } ); |
160 | 161 | |
— | — | @@ -169,14 +170,14 @@ |
170 | 171 | } |
171 | 172 | context.modules.highlight.markersStr = markersStr; |
172 | 173 | |
173 | | - var oldStarts = []; |
174 | | - if(!context.modules.highlight.markersOldStarts){ |
175 | | - context.modules.highlight.markersOldStarts = []; |
176 | | - } |
177 | 174 | // Traverse the iframe DOM, inserting markers where they're needed. |
178 | 175 | // Store visited markers here so we know which markers should be removed |
179 | 176 | var visited = [], v = 0; |
180 | 177 | for ( var i = 0; i < markers.length; i++ ) { |
| 178 | + if(markers[i].skipDivision && (division == markers[i].skipDivision)){ |
| 179 | + continue; |
| 180 | + } |
| 181 | + |
181 | 182 | // We want to isolate each marker, so we may need to split textNodes |
182 | 183 | // if a marker starts or ends halfway one. |
183 | 184 | var start = markers[i].start; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -8688,6 +8688,7 @@ |
8689 | 8689 | |
8690 | 8690 | var markers = context.modules.highlight.markers = []; |
8691 | 8691 | // Get all markers |
| 8692 | + |
8692 | 8693 | context.fn.trigger( 'mark' ); |
8693 | 8694 | markers.sort( function( a, b ) { return a.start - b.start || a.end - b.end; } ); |
8694 | 8695 | |
— | — | @@ -8703,14 +8704,14 @@ |
8704 | 8705 | } |
8705 | 8706 | context.modules.highlight.markersStr = markersStr; |
8706 | 8707 | |
8707 | | - var oldStarts = []; |
8708 | | - if(!context.modules.highlight.markersOldStarts){ |
8709 | | - context.modules.highlight.markersOldStarts = []; |
8710 | | - } |
8711 | 8708 | // Traverse the iframe DOM, inserting markers where they're needed. |
8712 | 8709 | // Store visited markers here so we know which markers should be removed |
8713 | 8710 | var visited = [], v = 0; |
8714 | 8711 | for ( var i = 0; i < markers.length; i++ ) { |
| 8712 | + if(markers[i].skipDivision && (division == markers[i].skipDivision)){ |
| 8713 | + continue; |
| 8714 | + } |
| 8715 | + |
8715 | 8716 | // We want to isolate each marker, so we may need to split textNodes |
8716 | 8717 | // if a marker starts or ends halfway one. |
8717 | 8718 | var start = markers[i].start; |
— | — | @@ -9229,6 +9230,7 @@ |
9230 | 9231 | * Event handlers |
9231 | 9232 | */ |
9232 | 9233 | evt: { |
| 9234 | + |
9233 | 9235 | mark: function( context, event ) { |
9234 | 9236 | // Get references to the markers and tokens from the current context |
9235 | 9237 | var markers = context.modules.highlight.markers; |
— | — | @@ -9310,7 +9312,8 @@ |
9311 | 9313 | return $( ca1.parentNode ).is( 'span.wikiEditor-template-text' ) ? |
9312 | 9314 | ca1.parentNode : null; |
9313 | 9315 | }, |
9314 | | - context: context |
| 9316 | + context: context, |
| 9317 | + skipDivision: "realchange" |
9315 | 9318 | } ); |
9316 | 9319 | } else { //else this was an unmatched opening |
9317 | 9320 | tokenArray[beginIndex].label = 'TEMPLATE_FALSE_BEGIN'; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -590,8 +590,8 @@ |
591 | 591 | tokenArray.push(new Token(match.index+oldOffset+markOffset,label,tokenStart,match));oldOffset+=match.index+match[0].length;newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}} |
592 | 592 | tokenArray.sort(function(a,b){return a.offset-b.offset||a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},mark:function(context,division,tokens){var markers=context.modules.highlight.markers=[];context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';} |
593 | 593 | if(context.modules.highlight.markersStr==markersStr){return;} |
594 | | -context.modules.highlight.markersStr=markersStr;var oldStarts=[];if(!context.modules.highlight.markersOldStarts){context.modules.highlight.markersOldStarts=[];} |
595 | | -var visited=[],v=0;for(var i=0;i<markers.length;i++){var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
| 594 | +context.modules.highlight.markersStr=markersStr;var visited=[],v=0;for(var i=0;i<markers.length;i++){if(markers[i].skipDivision&&(division==markers[i].skipDivision)){continue;} |
| 595 | +var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} |
596 | 596 | var startNode=s.node;while(startNode.nodeName=='BR'||s.offset==startNode.nodeValue.length){start++;s=context.fn.getOffset(start);startNode=s.node;} |
597 | 597 | if(s.offset>0&&s.node.nodeName=='#text'){startNode=startNode.splitText(s.offset<s.node.nodeValue.length?s.offset:s.node.nodeValue.length-1);context.fn.purgeOffsets();} |
598 | 598 | var end=markers[i].end;var e=context.fn.getOffset(end-1);if(!e){continue;} |
— | — | @@ -644,7 +644,7 @@ |
645 | 645 | 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;}}} |
646 | 646 | 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;} |
647 | 647 | 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);}} |
648 | | -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);} |
| 648 | +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);} |
649 | 649 | 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);} |
650 | 650 | 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 | 651 | $.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':'\ |