Skip to content

Commit

Permalink
Merge branch 'MDL-78176_400' of https://github.com/AnupamaSarjoshi/mo…
Browse files Browse the repository at this point in the history
…odle into MOODLE_400_STABLE
  • Loading branch information
sarjona committed May 23, 2023
2 parents 41692c0 + dc2d6f8 commit 9749d70
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion question/type/ddimageortext/amd/build/form.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion question/type/ddimageortext/amd/build/form.min.js.map

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions question/type/ddimageortext/amd/src/form.js
Expand Up @@ -55,20 +55,24 @@ define(['jquery', 'core/dragdrop'], function($, dragDrop) {
*/
init: function() {
dragDropToImageForm.fp = dragDropToImageForm.filePickers();
dragDropToImageForm.updateVisibilityOfFilePickers();
dragDropToImageForm.setOptionsForDragItemSelectors();
dragDropToImageForm.setupEventHandlers();
dragDropToImageForm.waitForFilePickerToInitialise();
},

/**
* Add html for the preview area.
*/
setupPreviewArea: function() {
$('#id_previewareaheader').append(
'<div class="ddarea que ddimageortext">' +
' <div class="droparea">' +
' <div id="id_droparea" class="droparea">' +
' <img class="dropbackground" />' +
' <div class="dropzones"></div>' +
' </div>' +
' <div class="dragitems"></div>' +
'</div>');

dragDropToImageForm.updateVisibilityOfFilePickers();
dragDropToImageForm.setOptionsForDragItemSelectors();
dragDropToImageForm.setupEventHandlers();
dragDropToImageForm.waitForFilePickerToInitialise();
},

/**
Expand All @@ -90,8 +94,13 @@ define(['jquery', 'core/dragdrop'], function($, dragDrop) {
M.util.js_pending('dragDropToImageForm');
dragDropToImageForm.loadPreviewImage();
});

dragDropToImageForm.loadPreviewImage();
if ($('#id_droparea').length) {
dragDropToImageForm.loadPreviewImage();
} else {
// Setup preview area when the background image is uploaded the first time.
dragDropToImageForm.setupPreviewArea();
dragDropToImageForm.loadPreviewImage();
}
},

/**
Expand Down
2 changes: 1 addition & 1 deletion question/type/ddmarker/amd/build/form.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion question/type/ddmarker/amd/build/form.min.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions question/type/ddmarker/amd/src/form.js
Expand Up @@ -374,7 +374,6 @@ define(['jquery', 'core/dragdrop', 'qtype_ddmarker/shapes'], function($, dragDro
init: function() {
dragDropForm.fp = dragDropForm.filePickers();
dragDropForm.noDropZones = dragDropForm.form.getFormValue('nodropzone', []);
dragDropForm.setupPreviewArea();
dragDropForm.setOptionsForDragItemSelectors();
dragDropForm.createShapes();
dragDropForm.setupEventHandlers();
Expand Down Expand Up @@ -555,7 +554,13 @@ define(['jquery', 'core/dragdrop', 'qtype_ddmarker/shapes'], function($, dragDro
// after filepicker's javascript has finished.
$('form.mform[data-qtype="ddmarker"]').on('change', '#id_bgimage', dragDropForm.loadPreviewImage);

dragDropForm.loadPreviewImage();
if ($('#ddm-droparea').length) {
dragDropForm.loadPreviewImage();
} else {
// Setup preview area when the background image is uploaded the first time.
dragDropForm.setupPreviewArea();
dragDropForm.loadPreviewImage();
}
},

/**
Expand Down
4 changes: 0 additions & 4 deletions question/type/ddmarker/styles.css
Expand Up @@ -227,7 +227,3 @@ body#page-question-type-ddmarker div[id^=fitem_id_][id*=hintclearwrong_] {
body#page-question-type-ddmarker #fitem_id_penalty {
margin-bottom: 2em;
}

body#page-question-type-ddmarker .ddarea.que.ddmarker {
overflow-y: scroll;
}

0 comments on commit 9749d70

Please sign in to comment.