1
- import { Base , SurveyModel , Action , ComputedUpdater , CurrentPageChangedEvent , PageVisibleChangedEvent , QuestionDropdownModel } from "survey-core" ;
1
+ import { Base , SurveyModel , Action , ComputedUpdater , CurrentPageChangedEvent , PageVisibleChangedEvent , QuestionDropdownModel , ActionContainer } from "survey-core" ;
2
2
import { notShortCircuitAnd } from "../../utils/utils" ;
3
3
import { SurveyCreatorModel } from "../../creator-base" ;
4
4
import { ICreatorPlugin } from "../../creator-settings" ;
@@ -206,6 +206,9 @@ export class TabDesignerPlugin implements ICreatorPlugin {
206
206
constructor ( private creator : SurveyCreatorModel ) {
207
207
creator . addTab ( { name : "designer" , plugin : this , iconName : "icon-config" } ) ;
208
208
this . tabControlModel = new TabControlModel ( this . creator . sidebar ) ;
209
+ this . tabControlModel . onTopToolbarItemCreated = ( bar ) => {
210
+ this . setupPropertyGridTabActions ( bar ) ;
211
+ } ;
209
212
this . propertyGrid = new PropertyGridModel ( undefined , creator , creator . getPropertyGridDefinition ( ) ) ;
210
213
this . showOneCategoryInPropertyGrid = creator . showOneCategoryInPropertyGrid ;
211
214
this . propertyGrid . showOneCategoryInPropertyGrid = this . showOneCategoryInPropertyGrid ;
@@ -280,7 +283,9 @@ export class TabDesignerPlugin implements ICreatorPlugin {
280
283
281
284
private updateTabControlActions ( ) {
282
285
if ( this . showOneCategoryInPropertyGrid ) {
283
- this . setupPropertyGridTabActions ( ) ;
286
+ if ( this . tabControlModel . isTopToolbarCreated ) {
287
+ this . setupPropertyGridTabActions ( this . tabControlModel . topToolbar ) ;
288
+ }
284
289
this . propertyGrid . survey . onCurrentPageChanged . add ( ( sender : SurveyModel , options : CurrentPageChangedEvent ) => {
285
290
const pgTabs = this . tabControlModel . topToolbar . actions ;
286
291
pgTabs . forEach ( action => {
@@ -298,9 +303,9 @@ export class TabDesignerPlugin implements ICreatorPlugin {
298
303
this . propertyGridViewModel . objectSelectionAction . title = this . propertyGrid . survey . currentPage ?. title ;
299
304
}
300
305
}
301
- private setupPropertyGridTabActions ( ) {
306
+ private setupPropertyGridTabActions ( topToolbar : ActionContainer < MenuButton > ) {
302
307
const pgTabs = this . getPropertyGridTabActions ( ) ;
303
- this . tabControlModel . topToolbar . setItems ( pgTabs ) ;
308
+ topToolbar . setItems ( pgTabs ) ;
304
309
this . propertyGridTab . activateCallback = ( ) => {
305
310
if ( ! this . propertyGrid . survey . currentPage ) return ;
306
311
0 commit comments