-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added possibility to attach balloon panel to selection instead of el… #1526
Conversation
4fa6edd
to
306b2e0
Compare
3f15c75
to
4fae2a6
Compare
0a0592c
to
dfa498b
Compare
Please rebase to latest |
Rebased onto latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHANGES.md
Outdated
@@ -8,6 +8,7 @@ New Features: | |||
* [#2072](https://github.com/ckeditor/ckeditor-dev/issues/2072): [UI Button](https://ckeditor.com/cke4/addon/button) plugin supports custom `aria-haspopup` property values. [Menu Button](https://ckeditor.com/cke4/addon/menubutton) `aria-haspopup` value is now `menu`, [Panel Button](https://ckeditor.com/cke4/addon/panelbutton) and [Rich Combo](https://ckeditor.com/cke4/addon/richcombo) `aria-haspopup` value is now `listbox`. | |||
* [#2154](https://github.com/ckeditor/ckeditor-dev/issues/2154): [Link](https://ckeditor.com/cke4/addon/link) plugin now supports telephone number links. | |||
* [#1815](https://github.com/ckeditor/ckeditor-dev/issues/1815): [Autolink](https://ckeditor.com/cke4/addon/autolink) plugin supports typing link completion. | |||
* [#1526](https://github.com/ckeditor/ckeditor-dev/pull/1526): Added possibility to attach balloon panel to selection instead of element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog entry should link to the issue, not to the PR. Additionally it'd be nice to link the plugin.
plugins/balloonpanel/plugin.js
Outdated
@@ -319,7 +319,8 @@ | |||
* touches that element. Once the panel is attached it gains focus. | |||
* | |||
* @method attach | |||
* @param {CKEDITOR.dom.element} element The element to which the panel is attached. | |||
* @param {CKEDITOR.dom.element/CKEDITOR.dom.selection} element The element to which the panel is attached. | |||
* **Since 4.10.0** instead of an element it is possible to pass a selection {@link CKEDITOR.dom.selection}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update version tag.
plugins/balloonpanel/plugin.js
Outdated
if ( element instanceof CKEDITOR.dom.selection ) { | ||
var ranges = element.getRanges(), | ||
rectList = ranges[ 0 ].getClientRects( true ), | ||
rect = rectList[ rectList.length - 1 ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use .pop
here?
@@ -0,0 +1,70 @@ | |||
<textarea id="editor_classic" cols="10" rows="10"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this test is called textpanel
. IMO the name should contain word "selection" (e.g. selectionpositioning
).
@@ -0,0 +1,9 @@ | |||
@bender-ui: collapsed | |||
@bender-tags: 4.10.0, feature, balloonpanel, 1176 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update version tag.
return selection; | ||
}, | ||
|
||
assertBalloonPanelPosition: function( rect, expectedX, expectedY ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not only asserting, but creating the whole test case for balloon panel.
Additionally I don't see clearly which tests are for elements and which are for selection.
cec38a7
to
0165273
Compare
…o horizontal center
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Note:
This branch is based on branch from PR #1499 ( t/1498 ).What is the purpose of this pull request?
New feature
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
What changes did you make?
I've added option to pass a selection as first argument of
CKEDITOR.ui.balloonPanel.attach()
. In that case balloonPanel will attach itself to selection instead of element.Closes #1176