r90243 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90242‎ | r90243 | r90244 >
Date:23:04, 16 June 2011
Author:brion
Status:deferred
Tags:
Comment:
Followup to r90240: clean up some stray code, check for an error condition
Modified paths:
  • /trunk/extensions/CodeEditor/modules/jquery.codeEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeEditor/modules/jquery.codeEditor.js
@@ -232,8 +232,10 @@
233233 base[name] = function() {
234234 if (context.codeEditorActive) {
235235 return func.apply(this, arguments);
236 - } else {
 236+ } else if (orig) {
237237 return orig.apply(this, arguments);
 238+ } else {
 239+ throw new Error('CodeEditor: no original function to call for ' + name);
238240 }
239241 }
240242 } else {
@@ -244,34 +246,18 @@
245247
246248 saveAndExtend( context.fn, {
247249 'saveCursorAndScrollTop': function() {
248 - if ( context.codeEditor ) {
249 - // Stub out textarea behavior
250 - return;
251 - } else {
252 - context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
253 - }
 250+ // Stub out textarea behavior
 251+ return;
254252 },
255253 'restoreCursorAndScrollTop': function() {
256 - if ( context.codeEditor ) {
257 - // Stub out textarea behavior
258 - return;
259 - } else {
260 - context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
261 - }
 254+ // Stub out textarea behavior
 255+ return;
262256 },
263257 'saveSelection': function() {
264 - if ( context.codeEditor ) {
265 - mw.log('codeEditor stub function saveSelection called');
266 - } else {
267 - context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
268 - }
 258+ mw.log('codeEditor stub function saveSelection called');
269259 },
270260 'restoreSelection': function() {
271 - if ( context.codeEditor ) {
272 - mw.log('codeEditor stub function restoreSelection called');
273 - } else {
274 - context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
275 - }
 261+ mw.log('codeEditor stub function restoreSelection called');
276262 },
277263
278264 /* Needed for search/replace */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90240CodeEditor ext: basic ability to toggle the syntax-highlighting editor on/off....brion22:30, 16 June 2011

Status & tagging log