Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov committed Nov 16, 2023
1 parent f90277a commit 59e4d08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/dragdrop/choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export class DragDropChoices extends DragDropCore<QuestionSelectBase> {
const imageContainerNode: any = itemValueNode.querySelector(".sd-imagepicker__image-container");
let imageNode: any = itemValueNode.querySelector(item.imageLink ? "img" : ".sd-imagepicker__no-image").cloneNode(true);

this.imagepickerControlsNode.style.display = "none";
if (!!this.imagepickerControlsNode) {
this.imagepickerControlsNode.style.display = "none";
}
imageContainerNode.style.width = imageNode.width + "px";
imageContainerNode.style.height = imageNode.height + "px";

Expand Down Expand Up @@ -214,8 +216,10 @@ export class DragDropChoices extends DragDropCore<QuestionSelectBase> {
if(!!this.parentElement) {
this.updateVisibleChoices(this.parentElement);
}
this.imagepickerControlsNode.style.display = "flex";
this.imagepickerControlsNode = null;
if (!!this.imagepickerControlsNode) {
this.imagepickerControlsNode.style.display = "flex";
this.imagepickerControlsNode = null;
}
super.clear();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/dragdrophelpertests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ QUnit.test("createImagePickerShortcut", function (assert) {
let ddHelper = new DragDropChoices();
let item = new ImageItemValue("a");

const createImagePickerShortcut = ddHelper["createImagePickerShortcut"];
const createImagePickerShortcut = ddHelper["createImagePickerShortcut"].bind(ddHelper);
const element = document.createElement("div");
const testElement = document.body.appendChild(element);
testElement.innerHTML = "<div data-sv-drop-target-item-value=\"camel\"><div class=\"sd-imagepicker__image-container\"><div class=\"sd-imagepicker__no-image\"></div><div class=\"svc-image-item-value-controls\"></div>";
Expand Down

0 comments on commit 59e4d08

Please sign in to comment.