@@ -2,12 +2,12 @@ import Module from '../../__module';
2
2
import $ from '../../dom' ;
3
3
import SelectionUtils from '../../selection' ;
4
4
import Block from '../../block' ;
5
- import Popover , { PopoverEvent } from '../../utils/popover' ;
6
5
import I18n from '../../i18n' ;
7
6
import { I18nInternalNS } from '../../i18n/namespace-internal' ;
8
7
import Flipper from '../../flipper' ;
9
8
import { TunesMenuConfigItem } from '../../../../types/tools' ;
10
9
import { resolveAliases } from '../../utils/resolve-aliases' ;
10
+ import Popover , { PopoverEvent } from '../../utils/popover' ;
11
11
12
12
/**
13
13
* HTML Elements that used for BlockSettings
@@ -67,13 +67,14 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
67
67
*/
68
68
private popover : Popover | undefined ;
69
69
70
+
70
71
/**
71
72
* Panel with block settings with 2 sections:
72
73
* - Tool's Settings
73
74
* - Default Settings [Move, Remove, etc]
74
75
*/
75
76
public make ( ) : void {
76
- this . nodes . wrapper = $ . make ( 'div' ) ;
77
+ this . nodes . wrapper = $ . make ( 'div' , [ this . CSS . settings ] ) ;
77
78
}
78
79
79
80
/**
@@ -110,19 +111,19 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
110
111
111
112
/** Tell to subscribers that block settings is opened */
112
113
this . eventsDispatcher . emit ( this . events . opened ) ;
113
-
114
114
this . popover = new Popover ( {
115
- className : this . CSS . settings ,
116
115
searchable : true ,
117
- filterLabel : I18n . ui ( I18nInternalNS . ui . popover , 'Filter' ) ,
118
- nothingFoundLabel : I18n . ui ( I18nInternalNS . ui . popover , 'Nothing found' ) ,
119
116
items : tunesItems . map ( tune => this . resolveTuneAliases ( tune ) ) ,
120
117
customContent : customHtmlTunesContainer ,
121
118
customContentFlippableItems : this . getControls ( customHtmlTunesContainer ) ,
122
119
scopeElement : this . Editor . API . methods . ui . nodes . redactor ,
120
+ messages : {
121
+ nothingFound : I18n . ui ( I18nInternalNS . ui . popover , 'Nothing found' ) ,
122
+ search : I18n . ui ( I18nInternalNS . ui . popover , 'Filter' ) ,
123
+ } ,
123
124
} ) ;
124
- this . popover . on ( PopoverEvent . OverlayClicked , this . onOverlayClicked ) ;
125
- this . popover . on ( PopoverEvent . Close , ( ) => this . close ( ) ) ;
125
+
126
+ this . popover . on ( PopoverEvent . Close , this . onPopoverClose ) ;
126
127
127
128
this . nodes . wrapper . append ( this . popover . getElement ( ) ) ;
128
129
@@ -166,13 +167,20 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
166
167
this . eventsDispatcher . emit ( this . events . closed ) ;
167
168
168
169
if ( this . popover ) {
169
- this . popover . off ( PopoverEvent . OverlayClicked , this . onOverlayClicked ) ;
170
+ this . popover . off ( PopoverEvent . Close , this . onPopoverClose ) ;
170
171
this . popover . destroy ( ) ;
171
172
this . popover . getElement ( ) . remove ( ) ;
172
173
this . popover = null ;
173
174
}
174
175
}
175
176
177
+ /**
178
+ * Handles popover close event
179
+ */
180
+ private onPopoverClose = ( ) : void => {
181
+ this . close ( ) ;
182
+ } ;
183
+
176
184
/**
177
185
* Returns list of buttons and inputs inside specified container
178
186
*
@@ -188,13 +196,6 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
188
196
return Array . from ( controls ) ;
189
197
}
190
198
191
- /**
192
- * Handles overlay click
193
- */
194
- private onOverlayClicked = ( ) : void => {
195
- this . close ( ) ;
196
- } ;
197
-
198
199
/**
199
200
* Resolves aliases in tunes menu items
200
201
*
0 commit comments