diff options
Diffstat (limited to 'sources/plugins/panel')
-rw-r--r-- | sources/plugins/panel/plugin.js | 71 |
1 files changed, 63 insertions, 8 deletions
diff --git a/sources/plugins/panel/plugin.js b/sources/plugins/panel/plugin.js index 44129a9..816ccc4 100644 --- a/sources/plugins/panel/plugin.js +++ b/sources/plugins/panel/plugin.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. |
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | 3 | * For licensing, see LICENSE.md or http://ckeditor.com/license |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -99,7 +99,7 @@ | |||
99 | parentDiv = iframe.getParent(), | 99 | parentDiv = iframe.getParent(), |
100 | doc = iframe.getFrameDocument(); | 100 | doc = iframe.getFrameDocument(); |
101 | 101 | ||
102 | // Make it scrollable on iOS. (#8308) | 102 | // Make it scrollable on iOS. (http://dev.ckeditor.com/ticket/8308) |
103 | CKEDITOR.env.iOS && parentDiv.setStyles( { | 103 | CKEDITOR.env.iOS && parentDiv.setStyles( { |
104 | 'overflow': 'scroll', | 104 | 'overflow': 'scroll', |
105 | '-webkit-overflow-scrolling': 'touch' | 105 | '-webkit-overflow-scrolling': 'touch' |
@@ -121,7 +121,7 @@ | |||
121 | // Register the CKEDITOR global. | 121 | // Register the CKEDITOR global. |
122 | win.$.CKEDITOR = CKEDITOR; | 122 | win.$.CKEDITOR = CKEDITOR; |
123 | 123 | ||
124 | // Arrow keys for scrolling is only preventable with 'keypress' event in Opera (#4534). | 124 | // Arrow keys for scrolling is only preventable with 'keypress' event in Opera (http://dev.ckeditor.com/ticket/4534). |
125 | doc.on( 'keydown', function( evt ) { | 125 | doc.on( 'keydown', function( evt ) { |
126 | var keystroke = evt.data.getKeystroke(), | 126 | var keystroke = evt.data.getKeystroke(), |
127 | dir = this.document.getById( this.id ).getAttribute( 'dir' ); | 127 | dir = this.document.getById( this.id ).getAttribute( 'dir' ); |
@@ -219,7 +219,7 @@ | |||
219 | current = this._.currentBlock; | 219 | current = this._.currentBlock; |
220 | 220 | ||
221 | // ARIA role works better in IE on the body element, while on the iframe | 221 | // ARIA role works better in IE on the body element, while on the iframe |
222 | // for FF. (#8864) | 222 | // for FF. (http://dev.ckeditor.com/ticket/8864) |
223 | var holder = !this.forceIFrame || CKEDITOR.env.ie ? this._.holder : this.document.getById( this.id + '_frame' ); | 223 | var holder = !this.forceIFrame || CKEDITOR.env.ie ? this._.holder : this.document.getById( this.id + '_frame' ); |
224 | 224 | ||
225 | if ( current ) | 225 | if ( current ) |
@@ -300,13 +300,68 @@ | |||
300 | var links = this.element.getElementsByTag( 'a' ); | 300 | var links = this.element.getElementsByTag( 'a' ); |
301 | var item = links.getItem( this._.focusIndex = index ); | 301 | var item = links.getItem( this._.focusIndex = index ); |
302 | 302 | ||
303 | // Safari need focus on the iframe window first(#3389), but we need | 303 | // Safari need focus on the iframe window first(http://dev.ckeditor.com/ticket/3389), but we need |
304 | // lock the blur to avoid hiding the panel. | 304 | // lock the blur to avoid hiding the panel. |
305 | if ( CKEDITOR.env.webkit ) | 305 | if ( CKEDITOR.env.webkit ) |
306 | item.getDocument().getWindow().focus(); | 306 | item.getDocument().getWindow().focus(); |
307 | item.focus(); | 307 | item.focus(); |
308 | 308 | ||
309 | this.onMark && this.onMark( item ); | 309 | this.onMark && this.onMark( item ); |
310 | }, | ||
311 | |||
312 | /** | ||
313 | * Marks the first visible item or the one whose `aria-selected` attribute is set to `true`. | ||
314 | * The latter has priority over the former. | ||
315 | * | ||
316 | * @private | ||
317 | * @param beforeMark function to be executed just before marking. | ||
318 | * Used in cases when any preparatory cleanup (like unmarking all items) would simultaneously | ||
319 | * destroy the information that is needed to determine the focused item. | ||
320 | */ | ||
321 | markFirstDisplayed: function( beforeMark ) { | ||
322 | var notDisplayed = function( element ) { | ||
323 | return element.type == CKEDITOR.NODE_ELEMENT && element.getStyle( 'display' ) == 'none'; | ||
324 | }, | ||
325 | links = this._.getItems(), | ||
326 | item, focused; | ||
327 | |||
328 | for ( var i = links.count() - 1; i >= 0; i-- ) { | ||
329 | item = links.getItem( i ); | ||
330 | |||
331 | if ( !item.getAscendant( notDisplayed ) ) { | ||
332 | focused = item; | ||
333 | this._.focusIndex = i; | ||
334 | } | ||
335 | |||
336 | if ( item.getAttribute( 'aria-selected' ) == 'true' ) { | ||
337 | focused = item; | ||
338 | this._.focusIndex = i; | ||
339 | break; | ||
340 | } | ||
341 | } | ||
342 | |||
343 | if ( !focused ) { | ||
344 | return; | ||
345 | } | ||
346 | |||
347 | if ( beforeMark ) { | ||
348 | beforeMark(); | ||
349 | } | ||
350 | |||
351 | if ( CKEDITOR.env.webkit ) | ||
352 | focused.getDocument().getWindow().focus(); | ||
353 | focused.focus(); | ||
354 | |||
355 | this.onMark && this.onMark( focused ); | ||
356 | }, | ||
357 | |||
358 | /** | ||
359 | * Returns a `CKEDITOR.dom.nodeList` of block items. | ||
360 | * | ||
361 | * @returns {*|CKEDITOR.dom.nodeList} | ||
362 | */ | ||
363 | getItems: function() { | ||
364 | return this.element.getElementsByTag( 'a' ); | ||
310 | } | 365 | } |
311 | }, | 366 | }, |
312 | 367 | ||
@@ -340,7 +395,7 @@ | |||
340 | } | 395 | } |
341 | } | 396 | } |
342 | 397 | ||
343 | // If no link was found, cycle and restart from the top. (#11125) | 398 | // If no link was found, cycle and restart from the top. (http://dev.ckeditor.com/ticket/11125) |
344 | if ( !link && !noCycle ) { | 399 | if ( !link && !noCycle ) { |
345 | this._.focusIndex = -1; | 400 | this._.focusIndex = -1; |
346 | return this.onKeyDown( keystroke, 1 ); | 401 | return this.onKeyDown( keystroke, 1 ); |
@@ -364,11 +419,11 @@ | |||
364 | } | 419 | } |
365 | 420 | ||
366 | // Make sure link is null when the loop ends and nothing was | 421 | // Make sure link is null when the loop ends and nothing was |
367 | // found (#11125). | 422 | // found (http://dev.ckeditor.com/ticket/11125). |
368 | link = null; | 423 | link = null; |
369 | } | 424 | } |
370 | 425 | ||
371 | // If no link was found, cycle and restart from the bottom. (#11125) | 426 | // If no link was found, cycle and restart from the bottom. (http://dev.ckeditor.com/ticket/11125) |
372 | if ( !link && !noCycle ) { | 427 | if ( !link && !noCycle ) { |
373 | this._.focusIndex = links.count(); | 428 | this._.focusIndex = links.count(); |
374 | return this.onKeyDown( keystroke, 1 ); | 429 | return this.onKeyDown( keystroke, 1 ); |