Add mouse coordinate view with click to copy

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2026-05-24 15:31:38 -07:00
parent f0d06bb931
commit d3d51a04d6
4 changed files with 56 additions and 18 deletions

View File

@@ -2,23 +2,26 @@
namespace MediaWiki\Extension\AnatImageViewer;
class AnnotationHooks {
public static function registrationCallback() {
define( 'CONTENT_MODEL_ANNOTATION', 'annotation' );
}
/**
* Set the content handler for annotations
*
* @param Title $title
* @param string &$model
* @return void
*/
public static function onContentHandlerDefaultModelFor( $title, &$model ) {
* MWHook: Display model when model file page edits are previewed
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/AlternateEditPreview
*
* @param EditPage $editor access to information about the edit page itself
* @param Content $content access to the current content of the editor
* @param string &$previewHTML by reference access to the resultant compiled preview html
* @param ?ParserOutput &$parserOutput
* @return bool|void True to continue default processing or false to abort for custom processing
*/
public static function onAlternateEditPreview( $editor, $content, string &$previewHTML, ?ParserOutput &$parserOutput ) {
$title = $editor->getTitle();
if ( $title->getNamespace() === NS_AV_ANNOT ) {
self::console_log('Found fucking thing!',true);
$model = CONTENT_MODEL_ANNOTATION;
}
}
$out = $editor->getContext()->getOutput();
$out->addModules('ext.annot.prev');
}
return true;
}
/**
* Small helper function to display information on the browser console