Skip to content

Commit 8b87a28

Browse files
added ck-editor widget into webpack build;
fixed image-picker widget;
1 parent 2a6e283 commit 8b87a28

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/image-picker.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import $ from 'jquery';
2-
31
function init(Survey) {
42
var widget = {
53
name: "imagepicker",
64
title: "Image picker",
75
iconName: "icon-imagepicker",
8-
widgetIsLoaded: function() { return typeof ImagePicker !== undefined; },
6+
widgetIsLoaded: function() { return !!$.fn.imagepicker; },
97
isFit : function(question) { return question.getType() === 'imagepicker'; },
108
isDefaultRender: true,
119
activatedByChanged: function(activatedBy) {
@@ -17,8 +15,10 @@ function init(Survey) {
1715
afterRender: function(question, el) {
1816
var $el = $(el).is("select") ? $(el) : $(el).find("select");
1917
var options = $el.find('option');
20-
for (var i=1; i<options.length; i++) {
21-
$(options[i]).data("imgSrc", options[i].imageLink);
18+
var choices = question.choices;
19+
20+
for (var i=1; i < options.length && i-1 < choices.length; i++) {
21+
$(options[i]).data("imgSrc", choices[i-1].imageLink);
2222
options[i].selected = question.value == options[i].value;
2323
}
2424
$el.imagepicker({

0 commit comments

Comments
 (0)