Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nouislider: fixed rendering in higher angular version #319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/nouislider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import noUiSlider from "nouislider";

function init(Survey) {
export function init(Survey) {
const iconId = "icon-nouislider";
Survey.SvgRegistry && Survey.SvgRegistry.registerIconFromSvg(iconId, require('svg-inline-loader?classPrefix!./images/nouislider.svg'), "");
var widget = {
Expand Down Expand Up @@ -123,8 +123,6 @@ function init(Survey) {
});
question.updateSliderProperties = function () {
const elems = document.getElementsByClassName("noUi-pips");
if (elems.length > 0) elems[elems.length - 1].style.display = "none";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove this (and below) line?

if (elems.length > 1) elems[elems.length - 2].style.display = "none";
var getStart = function(currentStart) {
return question.rangeMin + Math.round((currentStart - question.rangeMin) / question.step) * question.step;
}
Expand Down Expand Up @@ -226,10 +224,4 @@ function init(Survey) {
},
};
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, "customtype");
}

if (typeof Survey !== "undefined") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove this call, custom widget will not be registered in non-modular applications

init(Survey);
}

export default init;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "default" export cause problems with higher Angular versions?

}