From 456e4b16648e71cdccd28bd3d6256deb65c0b8c6 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Mon, 15 Jul 2024 17:51:05 +0300 Subject: [PATCH 1/3] Work for #8433 - fixed render callback --- src/entries/ui.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/entries/ui.ts b/src/entries/ui.ts index 736762170e..52c79c4e10 100644 --- a/src/entries/ui.ts +++ b/src/entries/ui.ts @@ -36,6 +36,13 @@ if (!!jQuery) { } SurveyModel.platform = "ui"; +SurveyModel.prototype["render"] = function (element: any = null) { + if (this.renderCallback) { + this.renderCallback(); + } else { + renderSurvey(this, element); + } +}; export const preact: any = React; From baf3977f41de57ba50ab85f899ae0cc7f252bb97 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Mon, 15 Jul 2024 17:54:02 +0300 Subject: [PATCH 2/3] Use survey render func --- examples/survey-ui/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/survey-ui/index.js b/examples/survey-ui/index.js index eff43bd3ef..686f417d22 100644 --- a/examples/survey-ui/index.js +++ b/examples/survey-ui/index.js @@ -976,7 +976,8 @@ function init() { "result: " + JSON.stringify(result.data); }); - SurveyUI.renderSurvey(survey, document.getElementById("surveyElement")); + // SurveyUI.renderSurvey(survey, document.getElementById("surveyElement")); + survey.render(document.getElementById("surveyElement")); } if (!window["%hammerhead%"]) { From 74fe97c70c4fd69b7fe8ec81c63484a115045b63 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Mon, 15 Jul 2024 17:56:44 +0300 Subject: [PATCH 3/3] Patch render func in jquery-ui --- src/entries/jquery-ui.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/entries/jquery-ui.ts b/src/entries/jquery-ui.ts index 78c5542138..724cfa06bf 100644 --- a/src/entries/jquery-ui.ts +++ b/src/entries/jquery-ui.ts @@ -26,6 +26,14 @@ function doPopupSurvey(props: any): void { } SurveyModel.platform = "jquery"; +SurveyModel.prototype["render"] = function (element: any = null) { + if (this.renderCallback) { + this.renderCallback(); + } else { + const survey = React.createElement(Survey, { model: this }); + ReactDOM.render(survey, element); + } +}; export const preact: any = React;