r59808 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59807‎ | r59808 | r59809 >
Date:23:35, 7 December 2009
Author:tparscal
Status:ok
Tags:
Comment:
Added event handling for change events.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -216,28 +216,32 @@
217217 /* Event Handlers */
218218 context.evt = {
219219 'change': function( event ) {
220 - // BTW: context is in event.data.context
221 -
222220 switch ( event.type ) {
223221 case 'keypress':
224 - if ( /* something interesting was deleted */ false ) {
225 - //console.log( 'MAJOR CHANGE' );
 222+ if ( /* TODO: test if something interesting was deleted */ true ) {
 223+ event.data.scope = 'division';
226224 } else {
227 - //console.log( 'MINOR CHANGE' );
 225+ event.data.scope = 'character';
228226 }
229227 break;
230228 case 'mousedown': // FIXME: mouseup?
231 - if ( /* text was dragged and dropped */ false ) {
232 - //console.log( 'MAJOR CHANGE' );
 229+ if ( /* TODO: test if text was dragged and dropped */ true ) {
 230+ event.data.scope = 'division';
233231 } else {
234 - //console.log( 'MINOR CHANGE' );
 232+ event.data.scope = 'none';
235233 }
236234 break;
237235 default:
238 - //console.log( 'MAJOR CHANGE' );
 236+ event.data.scope = 'division';
239237 break;
240238 }
241 -
 239+ if ( event.data.scope !== 'none' ) {
 240+ for ( module in $.wikiEditor.modules ) {
 241+ if ( 'evt' in $.wikiEditor.modules[module] && 'change' in $.wikiEditor.modules[module].evt ) {
 242+ $.wikiEditor.modules[module].evt.change( context, event );
 243+ }
 244+ }
 245+ }
242246 }
243247 };
244248

Status & tagging log