Index: trunk/extensions/CodeEditor/modules/jquery.codeEditor.js |
— | — | @@ -232,8 +232,10 @@ |
233 | 233 | base[name] = function() { |
234 | 234 | if (context.codeEditorActive) { |
235 | 235 | return func.apply(this, arguments); |
236 | | - } else { |
| 236 | + } else if (orig) { |
237 | 237 | return orig.apply(this, arguments); |
| 238 | + } else { |
| 239 | + throw new Error('CodeEditor: no original function to call for ' + name); |
238 | 240 | } |
239 | 241 | } |
240 | 242 | } else { |
— | — | @@ -244,34 +246,18 @@ |
245 | 247 | |
246 | 248 | saveAndExtend( context.fn, { |
247 | 249 | '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; |
254 | 252 | }, |
255 | 253 | '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; |
262 | 256 | }, |
263 | 257 | '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'); |
269 | 259 | }, |
270 | 260 | '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'); |
276 | 262 | }, |
277 | 263 | |
278 | 264 | /* Needed for search/replace */ |