Skip to content

Commit

Permalink
Merge branch 't/12143' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Aug 1, 2014
2 parents a067471 + 120ed01 commit 17e7031
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -11,6 +11,7 @@ New Features:
* [#12168](http://dev.ckeditor.com/ticket/12168): `dataTransfer` facade.
* [#12169](http://dev.ckeditor.com/ticket/12169): Introduce [`editor.drop`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-drop), [`editor.dragstart`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-dragstart) and [`editor.dragend`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-dragend) events.
* [#11583](http://dev.ckeditor.com/ticket/11583): Added support for HTML5 `required` attribute in various form elements. Thanks to [Steven Busse](https://github.com/sbusse)!
* [#12143](http://dev.ckeditor.com/ticket/12143): Added [`config.floatSpacePreferRight`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-floatSpacePreferRight) configuration option that switches the alignment of the floating toolbar. Thanks to [InvisibleBacon](http://github.com/InvisibleBacon)!

Fixed Issues:

Expand Down
25 changes: 19 additions & 6 deletions plugins/floatingspace/plugin.js
Expand Up @@ -161,12 +161,15 @@
changeMode( 'bottom' );

var mid = viewRect.width / 2,
alignSide =
( editorRect.left > 0 && editorRect.right < viewRect.width && editorRect.width > spaceRect.width ) ?
( editor.config.contentsLangDirection == 'rtl' ? 'right' : 'left' )
:
( mid - editorRect.left > editorRect.right - mid ? 'left' : 'right' ),
offset;
alignSide, offset;

if ( config.floatSpacePreferRight ) {
alignSide = 'right';
} else if ( editorRect.left > 0 && editorRect.right < viewRect.width && editorRect.width > spaceRect.width ) {
alignSide = config.contentsLangDirection == 'rtl' ? 'right' : 'left';
} else {
alignSide = mid - editorRect.left > editorRect.right - mid ? 'left' : 'right';
}

// (#9769) If viewport width is less than space width,
// make sure space never cross the left boundary of the viewport.
Expand Down Expand Up @@ -377,3 +380,13 @@
* @cfg {Number} [floatSpacePinnedOffsetY=0]
* @member CKEDITOR.config
*/

/**
* Indicates that the float space should be aligned to the right side
* of editable area rather than to the left (if possible).
*
* config.floatSpacePreferRight = true;
*
* @cfg {Boolean} [floatSpacePreferRight=false]
* @member CKEDITOR.config
*/

0 comments on commit 17e7031

Please sign in to comment.