Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -232,13 +232,8 @@ |
233 | 233 | 'dependencies' => array( 'jquery' ), |
234 | 234 | ), |
235 | 235 | 'ext.semanticforms.wikieditor' => $sfgResourceTemplate + array( |
236 | | - 'scripts' => 'libs/SF_wikieditor.js', |
237 | | - 'styles' => 'skins/SF_wikieditor.css', |
238 | | - 'dependencies' => array( |
239 | | - 'jquery.wikiEditor.toolbar', |
240 | | - 'jquery.wikiEditor.toolbar.config', |
241 | | - |
242 | | - ), |
| 236 | + 'scripts' => 'libs/SF_wikieditor.js', |
| 237 | + 'styles' => 'skins/SF_wikieditor.css', |
243 | 238 | ), |
244 | 239 | ); |
245 | 240 | } |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaWithAutocompleteInput.php |
— | — | @@ -50,14 +50,15 @@ |
51 | 51 | |
52 | 52 | if ( array_key_exists( 'editor', $other_args ) && |
53 | 53 | $other_args['editor'] == 'wikieditor' && |
54 | | - |
| 54 | + |
55 | 55 | method_exists( $wgOut, 'getResourceLoader' ) && |
56 | 56 | in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) && |
| 57 | + |
| 58 | + class_exists( 'WikiEditorHooks' ) ) { |
57 | 59 | |
58 | | - class_exists( 'WikiEditorHooks' ) && |
59 | | - WikiEditorHooks::isEnabled( 'toolbar' ) ) { |
| 60 | + // load modules for all enabled features |
| 61 | + WikiEditorHooks::editPageShowEditFormInitial( $this ); |
60 | 62 | |
61 | | - |
62 | 63 | $wgOut->addModules( 'ext.semanticforms.wikieditor' ); |
63 | 64 | |
64 | 65 | $jstext = <<<JAVASCRIPT |
Index: trunk/extensions/SemanticForms/includes/forminputs/SF_TextAreaInput.php |
— | — | @@ -19,15 +19,15 @@ |
20 | 20 | } |
21 | 21 | |
22 | 22 | public static function getDefaultPropTypes() { |
23 | | - return array( '_txt' => array(), '_cod' => array() ); |
| 23 | + return array('_txt' => array(), '_cod' => array()); |
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function getOtherPropTypesHandled() { |
27 | | - return array( '_wpg', '_str' ); |
| 27 | + return array('_wpg', '_str'); |
28 | 28 | } |
29 | 29 | |
30 | 30 | public static function getOtherPropTypeListsHandled() { |
31 | | - return array( '_wpg', '_str' ); |
| 31 | + return array('_wpg', '_str'); |
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { |
— | — | @@ -40,14 +40,15 @@ |
41 | 41 | |
42 | 42 | if ( array_key_exists( 'editor', $other_args ) && |
43 | 43 | $other_args['editor'] == 'wikieditor' && |
44 | | - |
| 44 | + |
45 | 45 | method_exists( $wgOut, 'getResourceLoader' ) && |
46 | 46 | in_array( 'jquery.wikiEditor', $wgOut->getResourceLoader()->getModuleNames() ) && |
| 47 | + |
| 48 | + class_exists( 'WikiEditorHooks' ) ) { |
47 | 49 | |
48 | | - class_exists( 'WikiEditorHooks' ) && |
49 | | - WikiEditorHooks::isEnabled( 'toolbar' ) ) { |
| 50 | + // load modules for all enabled features |
| 51 | + WikiEditorHooks::editPageShowEditFormInitial( $this ); |
50 | 52 | |
51 | | - |
52 | 53 | $wgOut->addModules( 'ext.semanticforms.wikieditor' ); |
53 | 54 | |
54 | 55 | $jstext = <<<JAVASCRIPT |
— | — | @@ -127,7 +128,7 @@ |
128 | 129 | if ( $is_mandatory ) { |
129 | 130 | $spanClass .= ' mandatoryFieldSpan'; |
130 | 131 | } |
131 | | - $text = Xml::tags( 'span', array( 'class' => $spanClass ), $text ); |
| 132 | + $text = Xml::tags( 'span', array('class' => $spanClass), $text ); |
132 | 133 | |
133 | 134 | return $text; |
134 | 135 | } |
— | — | @@ -171,15 +172,10 @@ |
172 | 173 | * Returns the HTML code to be included in the output page for this input. |
173 | 174 | */ |
174 | 175 | public function getHtmlText() { |
175 | | - |
| 176 | + |
176 | 177 | return self::getHTML( |
177 | | - $this->mCurrentValue, |
178 | | - $this->mInputName, |
179 | | - $this->mIsMandatory, |
180 | | - $this->mIsDisabled, |
181 | | - $this->mOtherArgs |
| 178 | + $this->mCurrentValue, $this->mInputName, $this->mIsMandatory, $this->mIsDisabled, $this->mOtherArgs |
182 | 179 | ); |
183 | | - |
184 | 180 | } |
185 | 181 | |
186 | 182 | } |
Index: trunk/extensions/SemanticForms/libs/SF_wikieditor.js |
— | — | @@ -5,41 +5,55 @@ |
6 | 6 | |
7 | 7 | window.ext.wikieditor = new function(){ |
8 | 8 | |
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 | | - // } |
17 | | - |
18 | 9 | // initialize the wikieditor on the specified element |
19 | 10 | this.init = function init ( input_id, params ) { |
20 | 11 | |
21 | | - // if ( !isSetUp ) { |
22 | | - // isSetUp = true; |
23 | | - // setup(); |
24 | | - // } |
25 | | - |
26 | 12 | if ( window.mediaWiki ) { |
27 | 13 | mediaWiki.loader.using( 'ext.semanticforms.wikieditor', function(){ |
| 14 | + |
| 15 | + var input = jQuery( '#' + input_id ); |
| 16 | + |
| 17 | + // load toolbar |
| 18 | + mediaWiki.loader.using( ['jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config'] , function(){ |
28 | 19 | if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toolbar ) ) { |
29 | | - |
30 | | - if (jQuery.wikiEditor.modules.toolbar.config !== undefined ) { |
31 | | - jQuery( '#' + input_id ).wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() ); |
32 | | - } else { |
33 | | - |
34 | | - // TODO: this is nasty. Take it out if at all possible. |
35 | | - var timeout = setTimeout(function () { |
36 | | - if (jQuery.wikiEditor.modules.toolbar.config !== undefined ) { |
37 | | - jQuery( '#' + input_id ).wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() ); |
38 | | - clearTimeout(timeout); |
39 | | - } |
40 | | - }, 1000); |
| 20 | + |
| 21 | + input.wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() ); |
| 22 | + |
| 23 | + // hide sig if required |
| 24 | + if ( wgWikiEditorEnabledModules && wgWikiEditorEnabledModules['hidesig'] == true ) { |
| 25 | + input.wikiEditor( 'removeFromToolbar', { |
| 26 | + 'section': 'main', |
| 27 | + 'group': 'insert', |
| 28 | + 'tool': 'signature' |
| 29 | + } ); |
41 | 30 | } |
| 31 | + |
42 | 32 | } |
43 | | - } ) |
| 33 | + }); |
| 34 | + |
| 35 | + // load dialogs |
| 36 | + mediaWiki.loader.using( ['jquery.wikiEditor.dialogs', 'jquery.wikiEditor.dialogs.config'] , function(){ |
| 37 | + if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.dialogs ) ) { |
| 38 | + |
| 39 | + jQuery.wikiEditor.modules.dialogs.config.replaceIcons( input ); |
| 40 | + input.wikiEditor( 'addModule', $.wikiEditor.modules.dialogs.config.getDefaultConfig() ); |
| 41 | + |
| 42 | + } |
| 43 | + }); |
| 44 | + |
| 45 | + // load toc |
| 46 | + // TODO: Can this be enabled? Should it? |
| 47 | +// mediaWiki.loader.using( ['jquery.wikiEditor.toc' ] , function(){ |
| 48 | +// if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toc ) ) { |
| 49 | +// |
| 50 | +// input.wikiEditor( 'addModule', 'toc' ); |
| 51 | +// |
| 52 | +// } |
| 53 | +// }); |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + } ); |
44 | 58 | } |
45 | 59 | } |
46 | 60 | |