MDL-82832 ddimageortext: center the dd item using js.

This commit is contained in:
hieuvu 2024-08-21 09:30:22 +07:00
parent 6cd55074c7
commit c25554b93c
4 changed files with 13 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -248,7 +248,11 @@ define([
// Set each drag home to that size.
dragHomes.each(function(i, drag) {
$(drag).width(maxWidth).height(maxHeight).css('lineHeight', maxHeight + 'px');
const top = Math.floor((maxHeight - drag.offsetHeight) / 2);
// Set top padding so the item is centred.
$(drag).width(maxWidth).height(maxHeight).css({
'padding-top': top + 'px',
});
});
// Create the drops and make them the right size.

View File

@ -85,7 +85,12 @@ form.mform fieldset#id_previewareaheader .droppreview {
display: none;
}
.que.ddimageortext .MathJax_Display {
/**
* The position of mathjax element in ddimageortext is calculated by javascript in question.js line 254.
* So we remove the default margin of Mathjax.
*/
.que.ddimageortext .MathJax_Display,
.que.ddimageortext .MathJax_SVG_Display {
margin: 0;
}