r101533 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101532‎ | r101533 | r101534 >
Date:21:37, 1 November 2011
Author:foxtrott
Status:deferred (Comments)
Tags:
Comment:
followup r101525: next attempt at fixing timing issues when initializing wikieditor
Modified paths:
  • /trunk/extensions/SemanticForms/SemanticForms.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_wikieditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/SemanticForms.php
@@ -234,7 +234,12 @@
235235 'ext.semanticforms.wikieditor' => $sfgResourceTemplate + array(
236236 'scripts' => 'libs/SF_wikieditor.js',
237237 'styles' => 'skins/SF_wikieditor.css',
238 - 'dependencies' => array('jquery.wikiEditor'),
 238+ 'dependencies' => array(
 239+ 'jquery.wikiEditor',
 240+ 'jquery.wikiEditor.toolbar',
 241+ 'jquery.wikiEditor.toolbar.config',
 242+
 243+ ),
239244 ),
240245 );
241246 }
Index: trunk/extensions/SemanticForms/libs/SF_wikieditor.js
@@ -5,26 +5,38 @@
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 this.init = 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
2626 jQuery( document ).ready( function() {
2727 if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toolbar ) ) {
28 - jQuery( '#' + input_id ).wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() );
 28+
 29+ if (jQuery.wikiEditor.modules.toolbar.config !== undefined ) {
 30+ jQuery( '#' + input_id ).wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() );
 31+ } else {
 32+
 33+ // TODO: this is nasty. Take it out if at all possible.
 34+ var timeout = setTimeout(function () {
 35+ if (jQuery.wikiEditor.modules.toolbar.config !== undefined ) {
 36+ jQuery( '#' + input_id ).wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() );
 37+ clearTimeout(timeout);
 38+ }
 39+ }, 1000);
 40+ }
2941 }
3042 });
3143 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r101702followup r101533: next attempt at fixing timing issues when initializing wiki...foxtrott21:28, 2 November 2011

Past revisions this follows-up on

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

Comments

#Comment by Nikerabbit (talk | contribs)   08:33, 2 November 2011

Hmm the indentation for whole module in SemanticForms.php is off.

Have you asked help from WikiEditor devs to solve this problem?