Eranroz has uploaded a new change for review. https://gerrit.wikimedia.org/r/237891
Change subject: Avoid flicks in talk pages ...................................................................... Avoid flicks in talk pages If VE is enabled for consistency edit section links become edit source (instead of edit) in all NS. This patch fix it to be done in backend side for namespaces where VE is not unabled on the backend side instead of user side, noticeable flicks if done in user side on page load. Change-Id: Iba090bfc1b2ff4886fb0cf2b37db7870b6be792d Task: T112366 --- M VisualEditor.hooks.php M modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css 2 files changed, 21 insertions(+), 27 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/91/237891/1 diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index ab6ffb9..3a8ee60 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -261,9 +261,10 @@ $availableNamespaces = ConfigFactory::getDefaultInstance() ->makeConfig( 'visualeditor' )->get( 'VisualEditorAvailableNamespaces' ); + $addVeEditSectionLinks = false; // Exit if we're not in a VE-enabled namespace - if ( !$title->inNamespaces( array_keys( array_filter( $availableNamespaces ) ) ) ) { - return true; + if ( $title->inNamespaces( array_keys( array_filter( $availableNamespaces ) ) ) ) { + $addVeEditSectionLinks = true; } // Exit if we're on a foreign file description page @@ -277,30 +278,30 @@ $config = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' ); $tabMessages = $config->get( 'VisualEditorTabMessages' ); - $veEditSection = $tabMessages['editsection'] !== null ? - $tabMessages['editsection'] : 'editsection'; $sourceEditSection = $tabMessages['editsectionsource'] !== null ? $tabMessages['editsectionsource'] : 'editsection'; $result['editsection']['text'] = $skin->msg( $sourceEditSection )->inLanguage( $lang )->text(); + if ( $addVeEditSectionLinks ) { + $veEditSection = $tabMessages['editsection'] !== null ? + $tabMessages['editsection'] : 'editsection'; + $veLink = array( + 'text' => $skin->msg( $veEditSection )->inLanguage( $lang )->text(), + 'targetTitle' => $title, + 'attribs' => $result['editsection']['attribs'] + array( + 'class' => 'mw-editsection-visualeditor' + ), + 'query' => array( 'veaction' => 'edit', 'vesection' => $section ), + 'options' => array( 'noclasses', 'known' ) + ); - $veLink = array( - 'text' => $skin->msg( $veEditSection )->inLanguage( $lang )->text(), - 'targetTitle' => $title, - 'attribs' => $result['editsection']['attribs'] + array( - 'class' => 'mw-editsection-visualeditor' - ), - 'query' => array( 'veaction' => 'edit', 'vesection' => $section ), - 'options' => array( 'noclasses', 'known' ) - ); - - $result['veeditsection'] = $veLink; - if ( $config->get( 'VisualEditorTabPosition' ) === 'before' ) { - krsort( $result ); - // TODO: This will probably cause weird ordering if any other extensions added something already. - // ... wfArrayInsertBefore? + $result['veeditsection'] = $veLink; + if ( $config->get( 'VisualEditorTabPosition' ) === 'before' ) { + krsort( $result ); + // TODO: This will probably cause weird ordering if any other extensions added something already. + // ... wfArrayInsertBefore? + } } - return true; } diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css index dcd0ac4..273283d 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.noscript.css @@ -33,10 +33,3 @@ margin-left: 0.25em; color: #555; } - -/* Must have the same, or higher, specificity (4x class/pseudo-class) as the rule above */ -.client-js.ve-not-available .mw-content-ltr .mw-editsection-bracket, -.client-js.ve-not-available .mw-content-rtl .mw-editsection-bracket { - margin-left: 0; - margin-right: 0; -} -- To view, visit https://gerrit.wikimedia.org/r/237891 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iba090bfc1b2ff4886fb0cf2b37db7870b6be792d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Eranroz <eranro...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits