Add a legend at the top of the inline diff display, showing the meanings of the colours of the inserted and deleted highlighting. Also add the same text as tooltips on the highlighted elements. The legend is added as part of a new area above the diff table that can be modified via a new TextSlotDiffRendererTablePrefix hook, so that extensions can add other buttons etc. there as required. This is a follow-up to the previous attempt, which added the legend in DifferenceEngine::showDiff() and was called from too many places. This patch moves it to be called in DifferenceEngine::showDiffPage(). Bug: T324759 Change-Id: I2a3c67bcfa47313dee597e602a62073e4e298cd2 Follow-up: I6de30bf79eb5ac262285951792782b870d075e00
33 lines
934 B
PHP
33 lines
934 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Diff\Hook;
|
|
|
|
use IContextSource;
|
|
use TextSlotDiffRenderer;
|
|
|
|
/**
|
|
* This is a hook handler interface, see docs/Hooks.md.
|
|
* Use the hook name "TextSlotDiffRendererTablePrefix" to register handlers implementing this interface.
|
|
*
|
|
* @stable to implement
|
|
* @ingroup Hooks
|
|
*/
|
|
interface TextSlotDiffRendererTablePrefixHook {
|
|
|
|
/**
|
|
* Use this hook to change the HTML that is included in a prefix container directly before the diff table.
|
|
*
|
|
* @since 1.41
|
|
*
|
|
* @param TextSlotDiffRenderer $textSlotDiffRenderer
|
|
* @param IContextSource $context
|
|
* @param mixed[] &$parts HTML strings to add to a container above the diff table.
|
|
* Will be sorted by key before being output.
|
|
* @return bool|void True or no return value to continue or false to abort
|
|
*/
|
|
public function onTextSlotDiffRendererTablePrefix(
|
|
TextSlotDiffRenderer $textSlotDiffRenderer,
|
|
IContextSource $context,
|
|
array &$parts
|
|
);
|
|
}
|