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

@@ -73,7 +73,7 @@ class AnnotationHandler extends CodeContentHandler {
return;
}
$output->setText( self::buildSvg($metadata) );
$output->setText( '<div id="svg-wrapper" style="position: relative;">' . self::buildSvg($metadata) . '</div>' );
}
/**
@@ -124,8 +124,8 @@ class AnnotationHandler extends CodeContentHandler {
'xmlns' => 'http://www.w3.org/2000/svg',
'width' => $baseWidth,
'height' => $baseHeight,
'style' => 'width: 100%; height: auto;'
'style' => 'width: 100%; height: auto;',
'mwScale' => $fixScale
);
$elCompass = '';
$useCompass = '';

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