https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115011
Revision: 115011
Author: tstarling
Date: 2012-04-23 11:40:43 +0000 (Mon, 23 Apr 2012)
Log Message:
-----------
Fixed a couple of minor issues in r115010:
* Scroll up a few lines so that the user can see the error context
* Defer processing of the fragment until the load event, otherwise the code
editor is not fully initialised and does not properly respond to the
navigateTo() call.
Modified Paths:
--------------
trunk/extensions/CodeEditor/modules/ext.codeEditor.js
trunk/extensions/CodeEditor/modules/jquery.codeEditor.js
Modified: trunk/extensions/CodeEditor/modules/ext.codeEditor.js
===================================================================
--- trunk/extensions/CodeEditor/modules/ext.codeEditor.js 2012-04-23
04:09:47 UTC (rev 115010)
+++ trunk/extensions/CodeEditor/modules/ext.codeEditor.js 2012-04-23
11:40:43 UTC (rev 115011)
@@ -40,7 +40,9 @@
$( document ).ready( function() {
// Add code editor module
$( '#wpTextbox1' ).wikiEditor( 'addModule', 'codeEditor' );
-
+} );
+$( window ).load( function() {
// If there is a fragment giving a line number, scroll to the relevant
location
+ // Wait for the load event since it doesn't scroll properly on ready
$( '#wpTextbox1'
).data('wikiEditor-context').fn.codeEditorMonitorFragment();
} );
Modified: trunk/extensions/CodeEditor/modules/jquery.codeEditor.js
===================================================================
--- trunk/extensions/CodeEditor/modules/jquery.codeEditor.js 2012-04-23
04:09:47 UTC (rev 115010)
+++ trunk/extensions/CodeEditor/modules/jquery.codeEditor.js 2012-04-23
11:40:43 UTC (rev 115011)
@@ -228,6 +228,8 @@
// Line numbers in CodeEditor are zero-based
var line = parseInt( result[1] );
context.codeEditor.navigateTo( line - 1, 0 );
+ // Scroll up a bit to give some context
+ context.codeEditor.scrollToRow( line - 4 );
}
onHashChange();
$( window ).bind( 'hashchange', onHashChange );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs