diff --git a/LibertyTemplate.php b/LibertyTemplate.php index 4cdbf432..b48f98f0 100644 --- a/LibertyTemplate.php +++ b/LibertyTemplate.php @@ -488,23 +488,24 @@ protected function contentsToolbox() { if ( $action != 'edit' ) { $editIcon = $editable ? ' ' : ' '; $editLabel = 'edit'; + $editLink = 'edit'; // If VE is enabled, the regular button becomes the "edit source" button // @todo FIXME: for a bunch of other skins, this happens automatically. // For Liberty I had to manually do this and add the VE edit button (below). // But why? if ( $hasVisualEditor ) { - $editLabel = 'visualeditor-ca-editsource'; + $editLink = 've-edit'; } echo $linkRenderer->makeKnownLink( $title, new HtmlArmor( $editIcon . $skin->msg( $editLabel )->plain() ), [ 'class' => 'btn btn-secondary tools-btn', - 'id' => 'ca-edit', - 'title' => Linker::titleAttrib( 'ca-edit', 'withaccess' ), - 'accesskey' => Linker::accesskey( 'ca-edit' ) + 'id' => 'ca-' . $editLink, + 'title' => Linker::titleAttrib( 'ca-' . $editLink, 'withaccess' ), + 'accesskey' => Linker::accesskey( 'ca-' . $editLink ) ], - $revid ? [ 'action' => 'edit', 'oldid' => $revid ] : [ 'action' => 'edit' ] + $revid ? [ 'action' => $editLink, 'oldid' => $revid ] : [ 'action' => $editLink ] ); } if ( $action == 'edit' || $action == 'history' ) { @@ -517,27 +518,6 @@ protected function contentsToolbox() { 'accesskey' => Linker::accesskey( 'ca-nstab-main' ) ] ); - } - // If VisualEditor is installed, it needs an "edit" button in order - // to correctly set up its JS - // The JS will transform the edit button *above* into the VE-ful one, - // whereas _this_ one will become the "edit source" button - if ( $hasVisualEditor ) { - if ( $action !== 'edit' ) { - $editIcon = $editable ? ' ' : ' '; - $editMsg = $editable ? 'edit' : 'viewsource'; - echo $linkRenderer->makeKnownLink( - $title, - new HtmlArmor( $editIcon . $skin->msg( $editMsg )->plain() ), - [ - 'class' => 'btn btn-secondary tools-btn', - 'id' => 'ca-ve-edit', - 'title' => Linker::titleAttrib( 'ca-ve-edit', 'withaccess' ), - 'accesskey' => Linker::accesskey( 'ca-ve-edit' ) - ], - $revid ? [ 'action' => 'veedit', 'oldid' => $revid ] : [ 'action' => 'veedit' ] - ); - } } if ( $companionTitle && $action != 'edit' ) { if ( $title->isTalkPage() && $action != 'history' ) { @@ -590,6 +570,26 @@ protected function contentsToolbox() { ?>