@@ -28,7 +28,7 @@ class UI extends React.Component {
2828 * @method componentDidMount
2929 */
3030 componentDidMount ( ) {
31- var editor = this . props . editor . get ( 'nativeEditor' ) ;
31+ const editor = this . props . editor . get ( 'nativeEditor' ) ;
3232
3333 editor . on ( 'editorInteraction' , this . _onEditorInteraction , this ) ;
3434 editor . on ( 'actionPerformed' , this . _onActionPerformed , this ) ;
@@ -42,11 +42,11 @@ class UI extends React.Component {
4242 // It is not easy to debounce _setUIHidden on mousedown, because if we
4343 // debounce it, when the handler is being invoked, the target might be no more part
4444 // of the editor's UI - onActionPerformed causes re-render.
45- this . _mousedownListener = function ( event ) {
45+ this . _mousedownListener = event => {
4646 this . _setUIHidden ( event . target ) ;
47- } . bind ( this ) ;
47+ } ;
4848
49- this . _keyDownListener = CKEDITOR . tools . debounce ( function ( event ) {
49+ this . _keyDownListener = CKEDITOR . tools . debounce ( event => {
5050 this . _setUIHidden ( document . activeElement ) ;
5151 } , this . props . eventsDelay , this ) ;
5252
@@ -64,9 +64,9 @@ class UI extends React.Component {
6464 * @method componentDidUpdate
6565 */
6666 componentDidUpdate ( prevProps , prevState ) {
67- var domNode = ReactDOM . findDOMNode ( this ) ;
67+ const domNode = ReactDOM . findDOMNode ( this ) ;
6868
69- var editor = this . props . editor . get ( 'nativeEditor' ) ;
69+ const editor = this . props . editor . get ( 'nativeEditor' ) ;
7070
7171 if ( domNode ) {
7272 editor . fire ( 'ariaUpdate' , {
@@ -127,16 +127,16 @@ class UI extends React.Component {
127127 * @return {String } The ARIA message for the number of available toolbars
128128 */
129129 _getAvailableToolbarsMessage ( domNode ) {
130- var toolbarsNodeList = domNode . querySelectorAll ( '[role="toolbar"]' ) ;
130+ const toolbarsNodeList = domNode . querySelectorAll ( '[role="toolbar"]' ) ;
131131
132132 if ( ! toolbarsNodeList . length ) {
133133 return this . _getAriaUpdates ( ) . noToolbar ;
134134 } else {
135- var toolbarNames = Array . prototype . slice . call ( toolbarsNodeList ) . map ( function ( toolbar ) {
135+ const toolbarNames = Array . prototype . slice . call ( toolbarsNodeList ) . map ( toolbar => {
136136 return toolbar . getAttribute ( 'aria-label' ) ;
137137 } ) ;
138138
139- var ariaUpdate = toolbarNames . length === 1 ? 'oneToolbar' : 'manyToolbars' ;
139+ const ariaUpdate = toolbarNames . length === 1 ? 'oneToolbar' : 'manyToolbars' ;
140140
141141 return this . _getAriaUpdateTemplate ( ariaUpdate ) . output ( {
142142 toolbars : toolbarNames . join ( ',' ) . replace ( / , ( [ ^ , ] * ) $ / , ' and ' + '$1' )
@@ -176,27 +176,25 @@ class UI extends React.Component {
176176 return null ;
177177 }
178178
179- var toolbars = Object . keys ( this . props . toolbars ) . map ( function ( toolbar ) {
179+ let toolbars = Object . keys ( this . props . toolbars ) . map ( toolbar => {
180180 return AlloyEditor . Toolbars [ toolbar ] || window [ toolbar ] ;
181181 } ) ;
182182
183- var instance = this ;
184-
185- toolbars = this . filterExclusive ( toolbars ) . map ( function ( toolbar ) {
186- var props = this . mergeExclusiveProps ( {
183+ toolbars = this . filterExclusive ( toolbars ) . map ( toolbar => {
184+ const props = this . mergeExclusiveProps ( {
187185 config : this . props . toolbars [ toolbar . key ] ,
188186 editor : this . props . editor ,
189187 editorEvent : this . state . editorEvent ,
190188 key : toolbar . key ,
191- onDismiss : this . _onDismissToolbarFocus . bind ( instance ) ,
189+ onDismiss : this . _onDismissToolbarFocus ,
192190 selectionData : this . state . selectionData
193191 } , toolbar . key ) ;
194192
195193 return React . createElement ( toolbar , props ) ;
196- } . bind ( this ) ) ;
194+ } ) ;
197195
198196 return (
199- < div className = "ae-toolbars" onKeyDown = { this . handleKey . bind ( this ) } >
197+ < div className = "ae-toolbars" onKeyDown = { this . handleKey } >
200198 { toolbars }
201199 </ div >
202200 ) ;
@@ -212,7 +210,7 @@ class UI extends React.Component {
212210 * @param {SynteticEvent } event The provided event
213211 */
214212 _onActionPerformed ( event ) {
215- var editor = this . props . editor . get ( 'nativeEditor' ) ;
213+ const editor = this . props . editor . get ( 'nativeEditor' ) ;
216214
217215 editor . focus ( ) ;
218216
@@ -230,8 +228,8 @@ class UI extends React.Component {
230228 * @protected
231229 * @method _onDismissToolbarFocus
232230 */
233- _onDismissToolbarFocus ( ) {
234- var editor = this . props . editor . get ( 'nativeEditor' ) ;
231+ _onDismissToolbarFocus = ( ) => {
232+ const editor = this . props . editor . get ( 'nativeEditor' ) ;
235233
236234 editor . focus ( ) ;
237235 }
@@ -264,7 +262,7 @@ class UI extends React.Component {
264262 * @method _onEditorKey
265263 */
266264 _onEditorKey ( event ) {
267- var nativeEvent = event . data . domEvent . $ ;
265+ const nativeEvent = event . data . domEvent . $ ;
268266
269267 if ( nativeEvent . altKey && nativeEvent . keyCode === 121 ) {
270268 this . focus ( ) ;
@@ -282,19 +280,19 @@ class UI extends React.Component {
282280 * @param {DOMElement } target The DOM element with which user interacted lastly.
283281 */
284282 _setUIHidden ( target ) {
285- var domNode = ReactDOM . findDOMNode ( this ) ;
283+ const domNode = ReactDOM . findDOMNode ( this ) ;
286284
287285 if ( domNode ) {
288- var editable = this . props . editor . get ( 'nativeEditor' ) . editable ( ) ;
289- var parentNode = target . parentNode ;
290- var targetNode = new CKEDITOR . dom . node ( target ) ;
286+ const editable = this . props . editor . get ( 'nativeEditor' ) . editable ( ) ;
287+ const parentNode = target . parentNode ;
288+ const targetNode = new CKEDITOR . dom . node ( target ) ;
291289
292290 if ( ! editable ) {
293291 this . setState ( {
294292 hidden : true
295293 } ) ;
296294 } else {
297- var res = ( editable . $ === target ) || editable . contains ( targetNode ) ||
295+ let res = ( editable . $ === target ) || editable . contains ( targetNode ) ||
298296 ( new CKEDITOR . dom . element ( domNode ) ) . contains ( targetNode ) ;
299297
300298 if ( parentNode ) {
0 commit comments