Skip to content

Commit

Permalink
Add descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanTsukanov committed Nov 13, 2024
1 parent 0182791 commit ab3cb88
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ export class SurveyCreatorModel extends Base
*/
public onHtmlToMarkdown: EventBase<SurveyCreatorModel, HtmlToMarkdownEvent> = this.addCreatorEvent<SurveyCreatorModel, HtmlToMarkdownEvent>();

/**
/*
* An event that is raised when Survey Creator obtains the expand/collapse state of a survey element on the design surface. Handle this event to set a required state.
*/
public onElementGetExpandCollapseState: EventBase<SurveyCreatorModel, ElementGetExpandCollapseStateEvent> = this.addCreatorEvent<SurveyCreatorModel, ElementGetExpandCollapseStateEvent>();
/**
Expand Down Expand Up @@ -1205,7 +1205,7 @@ export class SurveyCreatorModel extends Base
const chaningOptions = { tabName: viewName, allow: allow, model: this.currentPlugin?.model };
this.onActiveTabChanging.fire(this, chaningOptions);
if (!chaningOptions.allow) return;
if(!!this.currentPlugin?.deactivate && !this.currentPlugin.deactivate()) return;
if (!!this.currentPlugin?.deactivate && !this.currentPlugin.deactivate()) return;
const plugin = this.activatePlugin(viewName);
this.viewType = viewName;
this.onActiveTabChanged.fire(this, { tabName: viewName, plugin: plugin, model: !!plugin ? plugin.model : undefined });
Expand Down Expand Up @@ -2191,12 +2191,12 @@ export class SurveyCreatorModel extends Base
this.initSurveyWithJSON(undefined, clearState);
} else {
let jsonValue = trustJSON ? this.parseJSON(value) : undefined;
if(!trustJSON) {
if (!trustJSON) {
const textWorker = new SurveyTextWorker(value);
if(textWorker.isJsonCorrect) {
if (textWorker.isJsonCorrect) {
jsonValue = this.parseJSON(value);
}
else if(!!textWorker.survey) {
else if (!!textWorker.survey) {
jsonValue = textWorker.survey.toJSON();
}
}
Expand Down
9 changes: 9 additions & 0 deletions packages/survey-creator-core/src/creator-events-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,17 @@ export interface HtmlToMarkdownEvent {

export type ElementGetExpandCollapseStateEventReason = "loading" | "collapse-all" | "expand-all" | "drag-start" | "drag-end";
export interface ElementGetExpandCollapseStateEvent {
/**
* A survey element (question, panel, or page) whose expand/collapse state you can switch.
*/
element: Question | PanelModel | PageModel;
/**
* Indicates whether the element is currently collapsed or expanded. Set this parameter to `true` if you want to collapse the element or `false` to expand it.
*/
collapsed: boolean;
/**
* A value that indicates what caused the event to raise: the loading of a survey JSON schema, a click on the Expand All or Collapse All button, or the beginning or end of a drag and drop operation.
*/
reason: ElementGetExpandCollapseStateEventReason;
}

Expand Down
10 changes: 9 additions & 1 deletion packages/survey-creator-core/src/creator-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ export interface ICreatorOptions {
*/
pageEditMode?: "standard" | "single" | "bypage";
enableLinkFileEditor?: boolean;

/*
* Specifies the visibility of the buttons that expand and collapse survey elements on the design surface.
*
* Possible values:
*
* - `"onhover"` (default) - Displays an expand/collapse button when a survey element is hovered over or selected.
* - `"always"` - Displays the expand/collapse buttons permanently.
* - `"never"` - Hides the expand/collapse buttons.
*/
expandCollapseButtonVisibility?: "never" | "onhover" | "always";
}

0 comments on commit ab3cb88

Please sign in to comment.