@@ -15,6 +15,7 @@ const DEFAULT_FONT_FAMILY = "helvetica";
15
15
export default class MendixTheme extends SnowTheme {
16
16
fontPicker ?: Picker = undefined ;
17
17
fontSizePicker ?: Picker = undefined ;
18
+ headerPicker ?: Picker = undefined ;
18
19
buildPickers ( selects : NodeListOf < HTMLSelectElement > , icons : Record < string , string | Record < string , string > > ) : void {
19
20
super . buildPickers ( selects , icons ) ;
20
21
@@ -34,6 +35,14 @@ export default class MendixTheme extends SnowTheme {
34
35
) ;
35
36
this . fontPicker = picker ;
36
37
}
38
+
39
+ if ( picker . container . classList . contains ( "ql-header" ) ) {
40
+ picker . selectItem (
41
+ picker . container . querySelector ( `.ql-picker-item:not([data-value])` ) as HTMLElement ,
42
+ false
43
+ ) ;
44
+ this . headerPicker = picker ;
45
+ }
37
46
if ( pickerLabel ) {
38
47
pickerLabel . setAttribute ( "tabindex" , "-1" ) ;
39
48
}
@@ -70,6 +79,8 @@ export default class MendixTheme extends SnowTheme {
70
79
this . updateFontPicker ( font || DEFAULT_FONT_FAMILY ) ;
71
80
const fontSize = format ? ( format . size as string ) : undefined ;
72
81
this . updateFontSizePicker ( fontSize || DEFAULT_FONT_SIZE ) ;
82
+ const header = format ? ( format . header as string ) : undefined ;
83
+ this . updateHeaderPicker ( header ) ;
73
84
}
74
85
}
75
86
@@ -98,4 +109,16 @@ export default class MendixTheme extends SnowTheme {
98
109
}
99
110
}
100
111
}
112
+
113
+ updateHeaderPicker ( header ?: string ) : void {
114
+ if ( this . pickers ) {
115
+ if ( ! this . headerPicker ) {
116
+ this . headerPicker = this . pickers . find ( picker => picker . container . classList . contains ( "ql-header" ) ) ;
117
+ }
118
+ if ( ! header ) {
119
+ const currentOption = this . headerPicker ?. container . querySelector ( `.ql-picker-item:not([data-value])` ) ;
120
+ this . headerPicker ?. selectItem ( currentOption as HTMLElement , false ) ;
121
+ }
122
+ }
123
+ }
101
124
}
0 commit comments