diff --git a/WikiEditor.hooks.php b/WikiEditor.hooks.php index 819728ae..660f5e5a 100644 --- a/WikiEditor.hooks.php +++ b/WikiEditor.hooks.php @@ -29,6 +29,9 @@ class WikiEditorHooks { 'modules' => array( 'ext.wikiEditor.toolbar', ), + 'stylemodules' => array( + 'ext.wikiEditor.toolbar.styles', + ), ), 'dialogs' => array( 'preferences' => array( @@ -160,7 +163,13 @@ class WikiEditorHooks { // Add modules for enabled features foreach ( self::$features as $name => $feature ) { - if ( isset( $feature['modules'] ) && self::isEnabled( $name ) ) { + if ( !self::isEnabled( $name ) ) { + continue; + } + if ( isset( $feature['stylemodules'] ) ) { + $wgOut->addModuleStyles( $feature['stylemodules'] ); + } + if ( isset( $feature['modules'] ) ) { $wgOut->addModules( $feature['modules'] ); } } @@ -179,8 +188,7 @@ class WikiEditorHooks { if ( self::isEnabled( 'toolbar' ) ) { $toolbar = Html::rawElement( 'div', array( - 'class' => 'wikiEditor-oldToolbar', - 'style' => 'display:none;' + 'class' => 'wikiEditor-oldToolbar' ), $toolbar ); diff --git a/WikiEditor.php b/WikiEditor.php index 1c574563..884e3616 100644 --- a/WikiEditor.php +++ b/WikiEditor.php @@ -425,6 +425,9 @@ $wgResourceModules += array( 'jquery.wikiEditor.toolbar.config', ) ), + 'ext.wikiEditor.toolbar.styles' => $wikiEditorTpl + array( + 'styles' => 'ext.wikiEditor.toolbar.styles.css', + ), 'ext.wikiEditor.toolbar.hideSig' => $wikiEditorTpl + array( 'scripts' => 'ext.wikiEditor.toolbar.hideSig.js', ), diff --git a/modules/ext.wikiEditor.css b/modules/ext.wikiEditor.css index 60b5dced..6ea7e631 100644 --- a/modules/ext.wikiEditor.css +++ b/modules/ext.wikiEditor.css @@ -2,23 +2,6 @@ * CSS for WikiEditor */ -form#editform { - margin: 0; - padding: 0; -} - -#wpSummary, -#wpSummaryLabel { - margin-bottom: 1em; -} - -.wikiEditor-ui textarea#wpTextbox1 { - border: none; - padding: 0; - line-height: 1.5em; - resize: vertical; -} - /* Hide vanilla MediaWiki's "Editing help" link, as we provide it in the toolbar */ .editButtons .editHelp, .editButtons .mw-editButtons-pipe-separator { diff --git a/modules/ext.wikiEditor.toolbar.styles.css b/modules/ext.wikiEditor.toolbar.styles.css new file mode 100644 index 00000000..f6302267 --- /dev/null +++ b/modules/ext.wikiEditor.toolbar.styles.css @@ -0,0 +1,26 @@ +/** + * CSS for WikiEditor + */ + +form#editform { + margin: 0; + padding: 0; +} + +#wpSummary, +#wpSummaryLabel { + margin-bottom: 1em; +} + +#wpTextbox1 { + padding: 0; + line-height: 1.5em; + resize: vertical; +} + +/* Hide the old toolbar until the wikiEditor toolbar is deemed not supported, + * hide the WikiEditor toolbar until it's css has loaded */ +.wikiEditor-oldToolbar, +.wikiEditor-ui-toolbar { + display: none; +} diff --git a/modules/jquery.wikiEditor.toolbar.css b/modules/jquery.wikiEditor.toolbar.css index 97cabb83..b59a359d 100644 --- a/modules/jquery.wikiEditor.toolbar.css +++ b/modules/jquery.wikiEditor.toolbar.css @@ -4,6 +4,7 @@ .wikiEditor-ui-toolbar { position: relative; + display: block; } /* Expandable Sections */ .wikiEditor-ui-toolbar .sections {