r60055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60054‎ | r60055 | r60056 >
Date:00:44, 15 December 2009
Author:nimishg
Status:deferred (Comments)
Tags:
Comment:
get wiki-editor contents without items marked as noinclude (for non-IE)
Modified paths:
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -260,7 +260,7 @@
261261 switch ( event.type ) {
262262 case 'keypress':
263263 if ( /* TODO: test if something interesting was deleted */ true ) {
264 - event.data.scope = 'division';
 264+ event.data.scope = 'keydown';
265265 } else {
266266 event.data.scope = 'character';
267267 }
@@ -386,7 +386,13 @@
387387 }
388388 // We use .html() instead of .text() so HTML entities are handled right
389389 // Setting the HTML of the textarea doesn't work on all browsers, use a dummy <div> instead
390 - return $( '<div />' ).html( context.$content.html().replace( /\<br\>/g, "\n" ) ).text();
 390+
 391+
 392+ //get rid of the noincludes when getting text
 393+ var $dummyDiv = $( '<div />' ).html( context.$content.html().replace( /\<br\>/g, "\n" ) );
 394+ $dummyDiv.find( ".wiki-editor-noinclude" ).each( function() { $( this ).remove(); } );
 395+ return $dummyDiv.text();
 396+
391397 },
392398 /**
393399 * Sets the complete contents of the iframe (in plain text, not HTML; HTML passed will be converted to entities)

Comments

#Comment by Catrope (talk | contribs)   10:09, 15 December 2009
+			$dummyDiv.find( ".wiki-editor-noinclude" ).each( function() { $( this ).remove(); } );

I think we should rename this class to 'wikieditor-noinclude', for consistency (wikieditor vs. wiki-editor). Also, you should be able to use .remove() directly instead of using it inside .each() .

Status & tagging log