r101510 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101509‎ | r101510 | r101511 >
Date:18:42, 1 November 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
next attempt at fixing timing issues when initializing wikieditor
Modified paths:
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_wikieditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php
@@ -64,7 +64,14 @@
6565 }
6666
6767 $jstext = <<<JAVASCRIPT
68 -mediaWiki.loader.using( 'ext.semanticforms.wikieditor', function(){ jQuery('#$input_id').SemanticForms_registerInputInit( ext.wikieditor.init, null ); });
 68+if ( window.mediaWiki ) {
 69+ mediaWiki.loader.using(
 70+ [ 'ext.semanticforms.wikieditor', 'jquery.wikiEditor.toolbar.config' ],
 71+ function(){
 72+ jQuery('#$input_id').SemanticForms_registerInputInit( ext.wikieditor.init, null );
 73+ }
 74+ );
 75+}
6976 JAVASCRIPT;
7077
7178 // write JS code directly to the page's code
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php
@@ -53,7 +53,12 @@
5454
5555 $jstext = <<<JAVASCRIPT
5656 if ( window.mediaWiki ) {
57 - mediaWiki.loader.using( 'ext.semanticforms.wikieditor', function(){ jQuery('#$input_id').SemanticForms_registerInputInit( ext.wikieditor.init, null ); });
 57+ mediaWiki.loader.using(
 58+ [ 'ext.semanticforms.wikieditor', 'jquery.wikiEditor.toolbar.config' ],
 59+ function(){
 60+ jQuery('#$input_id').SemanticForms_registerInputInit( ext.wikieditor.init, null );
 61+ }
 62+ );
5863 }
5964 JAVASCRIPT;
6065
Index: trunk/extensions/SemanticForms/libs/SF_wikieditor.js
@@ -5,29 +5,34 @@
66
77 window.ext.wikieditor = new function(){
88
9 - var config;
10 - var isSetUp = false;
11 -
12 - // common setup for all editor instances
13 - function setup () {
14 - config = jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig();
15 - config.toolbar.advanced.groups.insert.tools.table.filters = ['textarea:not(#wpTextbox1):not(.toolbar-dialogs)'];
16 - }
 9+// var config;
 10+// var isSetUp = false;
 11+//
 12+// // common setup for all editor instances
 13+// function setup () {
 14+// config = jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig();
 15+// config.toolbar.advanced.groups.insert.tools.table.filters = ['textarea:not(#wpTextbox1):not(.toolbar-dialogs)'];
 16+// }
1717
1818 // initialize the wikieditor on the specified element
1919 function init ( input_id, params ) {
2020
21 - if ( !isSetUp ) {
22 - isSetUp = true;
23 - setup();
24 - }
 21+// if ( !isSetUp ) {
 22+// isSetUp = true;
 23+// setup();
 24+// }
2525
26 - var input = jQuery( '#' + input_id );
27 - input.wikiEditor( 'addModule', config );
 26+// jQuery( document ).ready( function() {
 27+ if ( !jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toolbar ) ) {
 28+ return;
 29+ }
 30+ var input = jQuery( '#' + input_id );
 31+ input.wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() );
 32+// });
2833 }
2934
3035 // export public funcitons
31 - this.setup = setup;
 36+// this.setup = setup;
3237 this.init = init;
3338
3439 };

Follow-up revisions

RevisionCommit summaryAuthorDate
r101525followup r101510: next attempt at fixing timing issues when initializing wiki...foxtrott20:52, 1 November 2011