Skip to content

Commit

Permalink
fix toolbox dots items click (#5556)
Browse files Browse the repository at this point in the history
* fix toolbox dots items click

* fix unit tests
  • Loading branch information
novikov82 committed Jun 4, 2024
1 parent df2acdb commit 693cd26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Base, SurveyModel, DragOrClickHelper } from "survey-core";
import { Base, SurveyModel, DragOrClickHelper, Action } from "survey-core";
import { IQuestionToolboxItem } from "../../toolbox";
import { SurveyCreatorModel } from "../../creator-base";
import { DragDropSurveyElements } from "../../survey-elements";
Expand Down
8 changes: 4 additions & 4 deletions packages/survey-creator-core/src/toolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class QuestionToolbox
return JSON.stringify(this.actions);
}
public set jsonText(value: string) {
this.actions = value ? JSON.parse(value) : [];
this.actions = (value ? JSON.parse(value) : []).map(action => new QuestionToolboxItem(action));
this.onItemsChanged();
}
/**
Expand Down Expand Up @@ -685,9 +685,6 @@ export class QuestionToolbox
public collapseAllCategories() {
this.expandCollapseAllCategories(true);
}
public hiddenItemSelected(model: Action): void {
this.creator.clickToolboxItem((<any>model).json);
}
private expandCollapseAllCategories(isCollapsed: boolean) {
const categories = this.categories;
for (var i = 0; i < categories.length; i++) {
Expand All @@ -708,6 +705,9 @@ export class QuestionToolbox
var prevActiveCategory = this.activeCategory;
for (let i = 0; i < this.actions.length; i++) {
const item = this.actions[i];
item.innerItem.action = () => {
this.creator.clickToolboxItem((<any>item).json);
};
if(item.visible === false) continue;
const categoryName = item.category ? item.category : "general";
if (!categoriesHash[categoryName]) {
Expand Down

0 comments on commit 693cd26

Please sign in to comment.