Add download image button
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -65,7 +65,8 @@ class GlModelHooks {
|
||||
* @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 ) {
|
||||
$file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($editor->getTitle());
|
||||
$title = $editor->getTitle();
|
||||
$file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($title);
|
||||
if (!$file || $file->getMimeType() !== 'model/gltf-binary') {
|
||||
return true;
|
||||
}
|
||||
@@ -91,10 +92,16 @@ class GlModelHooks {
|
||||
'onclick' => 'readyDelHotspot()'
|
||||
);
|
||||
|
||||
$dldButtonAttr = array(
|
||||
'class' => 'preview-button MakeImage',
|
||||
'onclick' => 'downloadImage("' . $title . '")'
|
||||
);
|
||||
|
||||
$addHsButton = array(
|
||||
Html::rawElement('button',$addButtonAttr,'Add a new hotspot'),
|
||||
Html::rawElement('button',$readButtonAttr,'Update hotspots'),
|
||||
Html::rawElement('button',$delButtonAttr,'Delete hotspot')
|
||||
Html::rawElement('button',$delButtonAttr,'Delete hotspot'),
|
||||
Html::rawElement('button',$dldButtonAttr,'Download image')
|
||||
);
|
||||
|
||||
$previewHTML = Html::rawElement('div',NULL,$previewViewer.implode($addHsButton));
|
||||
|
||||
Reference in New Issue
Block a user