diff options
Diffstat (limited to 'sources/plugins/floatpanel')
-rw-r--r-- | sources/plugins/floatpanel/plugin.js | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/sources/plugins/floatpanel/plugin.js b/sources/plugins/floatpanel/plugin.js index 1a851f9..c480696 100644 --- a/sources/plugins/floatpanel/plugin.js +++ b/sources/plugins/floatpanel/plugin.js | |||
@@ -61,7 +61,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
61 | iframe = element.getFirst(), | 61 | iframe = element.getFirst(), |
62 | that = this; | 62 | that = this; |
63 | 63 | ||
64 | // Disable native browser menu. (#4825) | 64 | // Disable native browser menu. (http://dev.ckeditor.com/ticket/4825) |
65 | element.disableContextMenu(); | 65 | element.disableContextMenu(); |
66 | 66 | ||
67 | this.element = element; | 67 | this.element = element; |
@@ -83,7 +83,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
83 | editor.on( 'resize', hide ); | 83 | editor.on( 'resize', hide ); |
84 | 84 | ||
85 | // When resize of the window is triggered floatpanel should be repositioned according to new dimensions. | 85 | // When resize of the window is triggered floatpanel should be repositioned according to new dimensions. |
86 | // #11724. Fixes issue with undesired panel hiding on Android and iOS. | 86 | // http://dev.ckeditor.com/ticket/11724. Fixes issue with undesired panel hiding on Android and iOS. |
87 | doc.getWindow().on( 'resize', function() { | 87 | doc.getWindow().on( 'resize', function() { |
88 | this.reposition(); | 88 | this.reposition(); |
89 | }, this ); | 89 | }, this ); |
@@ -155,7 +155,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
155 | 155 | ||
156 | var element = this.element, | 156 | var element = this.element, |
157 | iframe = this._.iframe, | 157 | iframe = this._.iframe, |
158 | // Edge prefers iframe's window to the iframe, just like the rest of the browsers (#13143). | 158 | // Edge prefers iframe's window to the iframe, just like the rest of the browsers (http://dev.ckeditor.com/ticket/13143). |
159 | focused = CKEDITOR.env.ie && !CKEDITOR.env.edge ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow ), | 159 | focused = CKEDITOR.env.ie && !CKEDITOR.env.edge ? iframe : new CKEDITOR.dom.window( iframe.$.contentWindow ), |
160 | doc = element.getDocument(), | 160 | doc = element.getDocument(), |
161 | positionedAncestor = this._.parentElement.getPositionedAncestor(), | 161 | positionedAncestor = this._.parentElement.getPositionedAncestor(), |
@@ -165,7 +165,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
165 | left = position.x + ( offsetX || 0 ) - positionedAncestorPosition.x, | 165 | left = position.x + ( offsetX || 0 ) - positionedAncestorPosition.x, |
166 | top = position.y + ( offsetY || 0 ) - positionedAncestorPosition.y; | 166 | top = position.y + ( offsetY || 0 ) - positionedAncestorPosition.y; |
167 | 167 | ||
168 | // Floating panels are off by (-1px, 0px) in RTL mode. (#3438) | 168 | // Floating panels are off by (-1px, 0px) in RTL mode. (http://dev.ckeditor.com/ticket/3438) |
169 | if ( rtl && ( corner == 1 || corner == 4 ) ) | 169 | if ( rtl && ( corner == 1 || corner == 4 ) ) |
170 | left += offsetParent.$.offsetWidth; | 170 | left += offsetParent.$.offsetWidth; |
171 | else if ( !rtl && ( corner == 2 || corner == 3 ) ) | 171 | else if ( !rtl && ( corner == 2 || corner == 3 ) ) |
@@ -198,7 +198,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
198 | 198 | ||
199 | // With addEventListener compatible browsers, we must | 199 | // With addEventListener compatible browsers, we must |
200 | // useCapture when registering the focus/blur events to | 200 | // useCapture when registering the focus/blur events to |
201 | // guarantee they will be firing in all situations. (#3068, #3222 ) | 201 | // guarantee they will be firing in all situations. (http://dev.ckeditor.com/ticket/3068, http://dev.ckeditor.com/ticket/3222 ) |
202 | CKEDITOR.event.useCapture = true; | 202 | CKEDITOR.event.useCapture = true; |
203 | 203 | ||
204 | focused.on( 'blur', function( ev ) { | 204 | focused.on( 'blur', function( ev ) { |
@@ -211,7 +211,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
211 | 211 | ||
212 | if ( this.visible && !this._.activeChild ) { | 212 | if ( this.visible && !this._.activeChild ) { |
213 | // [iOS] Allow hide to be prevented if touch is bound | 213 | // [iOS] Allow hide to be prevented if touch is bound |
214 | // to any parent of the iframe blur happens before touch (#10714). | 214 | // to any parent of the iframe blur happens before touch (http://dev.ckeditor.com/ticket/10714). |
215 | if ( CKEDITOR.env.iOS ) { | 215 | if ( CKEDITOR.env.iOS ) { |
216 | if ( !this._.hideTimeout ) | 216 | if ( !this._.hideTimeout ) |
217 | this._.hideTimeout = CKEDITOR.tools.setTimeout( doHide, 0, this ); | 217 | this._.hideTimeout = CKEDITOR.tools.setTimeout( doHide, 0, this ); |
@@ -235,7 +235,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
235 | }, this ); | 235 | }, this ); |
236 | 236 | ||
237 | // [iOS] if touch is bound to any parent of the iframe blur | 237 | // [iOS] if touch is bound to any parent of the iframe blur |
238 | // happens twice before touchstart and before touchend (#10714). | 238 | // happens twice before touchstart and before touchend (http://dev.ckeditor.com/ticket/10714). |
239 | if ( CKEDITOR.env.iOS ) { | 239 | if ( CKEDITOR.env.iOS ) { |
240 | // Prevent false hiding on blur. | 240 | // Prevent false hiding on blur. |
241 | // We don't need to return focus here because touchend will fire anyway. | 241 | // We don't need to return focus here because touchend will fire anyway. |
@@ -266,7 +266,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
266 | var target = element; | 266 | var target = element; |
267 | 267 | ||
268 | // Reset panel width as the new content can be narrower | 268 | // Reset panel width as the new content can be narrower |
269 | // than the old one. (#9355) | 269 | // than the old one. (http://dev.ckeditor.com/ticket/9355) |
270 | target.removeStyle( 'width' ); | 270 | target.removeStyle( 'width' ); |
271 | 271 | ||
272 | if ( block.autoSize ) { | 272 | if ( block.autoSize ) { |
@@ -275,7 +275,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
275 | 275 | ||
276 | // Account for extra height needed due to IE quirks box model bug: | 276 | // Account for extra height needed due to IE quirks box model bug: |
277 | // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug | 277 | // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug |
278 | // (#3426) | 278 | // (http://dev.ckeditor.com/ticket/3426) |
279 | if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && width > 0 ) | 279 | if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && width > 0 ) |
280 | width += ( target.$.offsetWidth || 0 ) - ( target.$.clientWidth || 0 ) + 3; | 280 | width += ( target.$.offsetWidth || 0 ) - ( target.$.clientWidth || 0 ) + 3; |
281 | 281 | ||
@@ -288,7 +288,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
288 | 288 | ||
289 | // Account for extra height needed due to IE quirks box model bug: | 289 | // Account for extra height needed due to IE quirks box model bug: |
290 | // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug | 290 | // http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug |
291 | // (#3426) | 291 | // (http://dev.ckeditor.com/ticket/3426) |
292 | if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && height > 0 ) | 292 | if ( CKEDITOR.env.ie && CKEDITOR.env.quirks && height > 0 ) |
293 | height += ( target.$.offsetHeight || 0 ) - ( target.$.clientHeight || 0 ) + 3; | 293 | height += ( target.$.offsetHeight || 0 ) - ( target.$.clientHeight || 0 ) + 3; |
294 | 294 | ||
@@ -364,7 +364,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
364 | 364 | ||
365 | // If IE is in RTL, we have troubles with absolute | 365 | // If IE is in RTL, we have troubles with absolute |
366 | // position and horizontal scrolls. Here we have a | 366 | // position and horizontal scrolls. Here we have a |
367 | // series of hacks to workaround it. (#6146) | 367 | // series of hacks to workaround it. (http://dev.ckeditor.com/ticket/6146) |
368 | if ( CKEDITOR.env.ie ) { | 368 | if ( CKEDITOR.env.ie ) { |
369 | var offsetParent = new CKEDITOR.dom.element( element.$.offsetParent ), | 369 | var offsetParent = new CKEDITOR.dom.element( element.$.offsetParent ), |
370 | scrollParent = offsetParent; | 370 | scrollParent = offsetParent; |
@@ -383,7 +383,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
383 | } | 383 | } |
384 | 384 | ||
385 | // Trigger the onHide event of the previously active panel to prevent | 385 | // Trigger the onHide event of the previously active panel to prevent |
386 | // incorrect styles from being applied (#6170) | 386 | // incorrect styles from being applied (http://dev.ckeditor.com/ticket/6170) |
387 | var innerElement = element.getFirst(), | 387 | var innerElement = element.getFirst(), |
388 | activePanel; | 388 | activePanel; |
389 | if ( ( activePanel = innerElement.getCustomData( 'activePanel' ) ) ) | 389 | if ( ( activePanel = innerElement.getCustomData( 'activePanel' ) ) ) |
@@ -410,12 +410,22 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
410 | // Focus the block now. | 410 | // Focus the block now. |
411 | block.element.focus(); | 411 | block.element.focus(); |
412 | 412 | ||
413 | // #10623, #10951 - restore the viewport's scroll position after focusing list element. | 413 | // http://dev.ckeditor.com/ticket/10623, http://dev.ckeditor.com/ticket/10951 - restore the viewport's scroll position after focusing list element. |
414 | if ( CKEDITOR.env.webkit ) | 414 | if ( CKEDITOR.env.webkit ) |
415 | CKEDITOR.document.getBody().$.scrollTop = scrollTop; | 415 | CKEDITOR.document.getBody().$.scrollTop = scrollTop; |
416 | 416 | ||
417 | // We need this get fired manually because of unfired focus() function. | 417 | // We need this get fired manually because of unfired focus() function. |
418 | this.allowBlur( true ); | 418 | this.allowBlur( true ); |
419 | |||
420 | // Ensure that the first item is focused (http://dev.ckeditor.com/ticket/16804). | ||
421 | if ( CKEDITOR.env.ie ) { | ||
422 | CKEDITOR.tools.setTimeout( function() { | ||
423 | block.markFirstDisplayed ? block.markFirstDisplayed() : block._.markFirstDisplayed(); | ||
424 | }, 0 ); | ||
425 | } else { | ||
426 | block.markFirstDisplayed ? block.markFirstDisplayed() : block._.markFirstDisplayed(); | ||
427 | } | ||
428 | |||
419 | this._.editor.fire( 'panelShow', this ); | 429 | this._.editor.fire( 'panelShow', this ); |
420 | }, 0, this ); | 430 | }, 0, this ); |
421 | }, CKEDITOR.env.air ? 200 : 0, this ); | 431 | }, CKEDITOR.env.air ? 200 : 0, this ); |
@@ -473,13 +483,13 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
473 | hide: function( returnFocus ) { | 483 | hide: function( returnFocus ) { |
474 | if ( this.visible && ( !this.onHide || this.onHide.call( this ) !== true ) ) { | 484 | if ( this.visible && ( !this.onHide || this.onHide.call( this ) !== true ) ) { |
475 | this.hideChild(); | 485 | this.hideChild(); |
476 | // Blur previously focused element. (#6671) | 486 | // Blur previously focused element. (http://dev.ckeditor.com/ticket/6671) |
477 | CKEDITOR.env.gecko && this._.iframe.getFrameDocument().$.activeElement.blur(); | 487 | CKEDITOR.env.gecko && this._.iframe.getFrameDocument().$.activeElement.blur(); |
478 | this.element.setStyle( 'display', 'none' ); | 488 | this.element.setStyle( 'display', 'none' ); |
479 | this.visible = 0; | 489 | this.visible = 0; |
480 | this.element.getFirst().removeCustomData( 'activePanel' ); | 490 | this.element.getFirst().removeCustomData( 'activePanel' ); |
481 | 491 | ||
482 | // Return focus properly. (#6247) | 492 | // Return focus properly. (http://dev.ckeditor.com/ticket/6247) |
483 | var focusReturn = returnFocus && this._.returnFocus; | 493 | var focusReturn = returnFocus && this._.returnFocus; |
484 | if ( focusReturn ) { | 494 | if ( focusReturn ) { |
485 | // Webkit requires focus moved out panel iframe first. | 495 | // Webkit requires focus moved out panel iframe first. |
@@ -500,7 +510,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
500 | * @todo | 510 | * @todo |
501 | */ | 511 | */ |
502 | allowBlur: function( allow ) { | 512 | allowBlur: function( allow ) { |
503 | // Prevent editor from hiding the panel. (#3222) | 513 | // Prevent editor from hiding the panel. (http://dev.ckeditor.com/ticket/3222) |
504 | var panel = this._.panel; | 514 | var panel = this._.panel; |
505 | if ( allow !== undefined ) | 515 | if ( allow !== undefined ) |
506 | panel.allowBlur = allow; | 516 | panel.allowBlur = allow; |
@@ -553,7 +563,7 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
553 | panel.showBlock( blockName, offsetParent, corner, offsetX, offsetY ); | 563 | panel.showBlock( blockName, offsetParent, corner, offsetX, offsetY ); |
554 | this.blur(); | 564 | this.blur(); |
555 | 565 | ||
556 | /* #3767 IE: Second level menu may not have borders */ | 566 | /* http://dev.ckeditor.com/ticket/3767 IE: Second level menu may not have borders */ |
557 | if ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) { | 567 | if ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) { |
558 | setTimeout( function() { | 568 | setTimeout( function() { |
559 | panel.element.getChild( 0 ).$.style.cssText += ''; | 569 | panel.element.getChild( 0 ).$.style.cssText += ''; |
@@ -584,10 +594,10 @@ CKEDITOR.plugins.add( 'floatpanel', { | |||
584 | 594 | ||
585 | for ( var i in panels ) { | 595 | for ( var i in panels ) { |
586 | var panel = panels[ i ]; | 596 | var panel = panels[ i ]; |
587 | // Safe to destroy it since there're no more instances.(#4241) | 597 | // Safe to destroy it since there're no more instances.(http://dev.ckeditor.com/ticket/4241) |
588 | if ( isLastInstance ) | 598 | if ( isLastInstance ) |
589 | panel.destroy(); | 599 | panel.destroy(); |
590 | // Panel might be used by other instances, just hide them.(#4552) | 600 | // Panel might be used by other instances, just hide them.(http://dev.ckeditor.com/ticket/4552) |
591 | else | 601 | else |
592 | panel.element.hide(); | 602 | panel.element.hide(); |
593 | } | 603 | } |