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

Fixed https://github.com/surveyjs/private-tasks/issues/431 - SurveyJS… #6422

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/survey-creator-core/src/components/page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Action, ActionContainer, classesToSelector, ComputedUpdater, DragOrClickHelper, DragTypeOverMeEnum, IAction, IElement, PageModel, property, QuestionRowModel, SurveyElement, settings as SurveySettings } from "survey-core";
import { SurveyCreatorModel } from "../creator-base";
import { IPortableMouseEvent } from "../utils/events";
import { SurveyElementAdornerBase } from "./action-container-view-model";
import { SurveyElementAdornerBase } from "./survey-element";
import { getLocString } from "../editorLocalization";
import { SurveyHelper } from "../survey-helper";
import { settings } from "../creator-settings";
Expand Down Expand Up @@ -129,10 +129,10 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
}
@property({
onSet(val, target: PageAdorner, prevVal) {
if(val != prevVal) {
if (val != prevVal) {
target.updateShowPlaceholder();
target.updateActionsProperties();
if(val && target.surveyElement) {
if (val && target.surveyElement) {
target.addGhostPageSubsribes(target.surveyElement);
}
}
Expand Down Expand Up @@ -326,7 +326,7 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
if (cssClasses.pageRow) return [].slice.call(this.rootElement?.querySelectorAll(`:scope .svc-page__footer, :scope ${classesToSelector(this.surveyElement.cssRoot)} > .svc-row`));
return null;
}
public onPageSelected() {}
public onPageSelected() { }
protected getAllowDragging(options: any): boolean {
return this.creator.allowDragPages && super.getAllowDragging(options);
}
Expand Down
25 changes: 16 additions & 9 deletions packages/survey-creator-core/src/components/question-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,25 @@ export class QuestionImageAdornerViewModel extends QuestionAdornerViewModel {
) {
super(creator, surveyElement, templateData);
this.isEmptyImageLink = !this.question.imageLink;
this.surveyElement.registerFunctionOnPropertyValueChanged("imageLink", this.imageLinkValueChangedHandler, "imageLinkValueChanged");
(this.surveyElement as QuestionImageModel).locImageLink.onStringChanged.add(this.imageLinkValueChangedHandler);
this.initFilePresentationModel();
}

protected detachElement(surveyElement: SurveyElement): void {
if (surveyElement) {
surveyElement.unRegisterFunctionOnPropertyValueChanged("imageLink", "imageLinkValueChanged");
(surveyElement as QuestionImageModel).locImageLink.onStringChanged.remove(this.imageLinkValueChangedHandler);
}
super.detachElement(this.element);
}
protected attachElement(surveyElement: SurveyElement): void {
super.attachElement(surveyElement);
if (surveyElement) {
surveyElement.registerFunctionOnPropertyValueChanged("imageLink", this.imageLinkValueChangedHandler, "imageLinkValueChanged");
(surveyElement as QuestionImageModel).locImageLink.onStringChanged.add(this.imageLinkValueChangedHandler);
}
}


@property({ defaultValue: false }) isUploading;
@property({ defaultValue: false }) isEmptyImageLink;

Expand Down Expand Up @@ -100,11 +114,4 @@ export class QuestionImageAdornerViewModel extends QuestionAdornerViewModel {
.append(super.css())
.append("svc-question__content--loading", this.isUploading).toString();
}
public dispose(): void {
if (this.surveyElement) {
this.surveyElement.unRegisterFunctionOnPropertyValueChanged("imageLink", "imageLinkValueChanged");
(this.surveyElement as QuestionImageModel).locImageLink.onStringChanged.remove(this.imageLinkValueChangedHandler);
}
super.dispose();
}
}
5 changes: 3 additions & 2 deletions packages/survey-creator-core/src/components/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ import {
isPropertyVisible,
propertyExists,
} from "../utils/creator-utils";
import { SurveyElementActionContainer, SurveyElementAdornerBase } from "./action-container-view-model";
import { SurveyElementActionContainer } from "./action-container-view-model";
require("./question.scss");
import { settings } from "../creator-settings";
import { StringEditorConnector, StringItemsNavigatorBase } from "./string-editor";
import { DragDropSurveyElements, isPanelDynamic } from "../survey-elements";
import { QuestionToolbox, QuestionToolboxItem } from "../toolbox";
import { isUndefined } from "lodash";
import { listComponentCss } from "./list-theme";
import { SurveyElementAdornerBase } from "./survey-element";

export interface QuestionBannerParams {
text: string;
Expand Down Expand Up @@ -680,7 +681,7 @@ export class QuestionAdornerViewModel extends SurveyElementAdornerBase {
cssClasses: listComponentCss,
});
newAction.popupModel.onVisibilityChanged.add((_: PopupModel, opt: { model: PopupModel, isVisible: boolean }) => {
if(opt.isVisible) {
if (opt.isVisible) {
const listModel = newAction.popupModel.contentComponentData.model;
options.updateListModel(listModel);
}
Expand Down
Loading
Loading