Skip to content
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

Merged
merged 32 commits into from
Aug 22, 2018

Conversation

engineering-this
Copy link
Contributor

@engineering-this engineering-this commented Jan 30, 2018

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

  • Unit tests
  • Manual tests

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

@engineering-this engineering-this changed the title Added possibility to attach ballooon panel to selection instead of el… Added possibility to attach balloon panel to selection instead of el… Mar 22, 2018
@engineering-this engineering-this force-pushed the t/1498 branch 6 times, most recently from 3f15c75 to 4fae2a6 Compare April 12, 2018 11:17
@engineering-this engineering-this force-pushed the t/1498 branch 7 times, most recently from 0a0592c to dfa498b Compare April 17, 2018 10:28
@Comandeer
Copy link
Member

Please rebase to latest major as CKEDITOR.dom.range.getClientRects is already merged.

@engineering-this engineering-this changed the base branch from t/1498 to major May 7, 2018 13:47
@engineering-this engineering-this requested a review from Comandeer May 7, 2018 13:55
@mlewand mlewand added the review:easy Pull requests that can be reviewed by a Junior Developer before being reviewed by the Reviewer. label Jul 10, 2018
@Comandeer
Copy link
Member

Rebased onto latest major.

Copy link
Member

@Comandeer Comandeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's stated in issue:

Instead we'd like to attach it to the center of a selection.

However, as manual test shows, the panel is attached to the end of the selection.

There is also issue with selections with multiple ranges, e.g. made by tableselection plugin:

Table selection with panel attached to its beginning

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.
Copy link
Member

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.

@@ -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}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update version tag.

if ( element instanceof CKEDITOR.dom.selection ) {
var ranges = element.getRanges(),
rectList = ranges[ 0 ].getClientRects( true ),
rect = rectList[ rectList.length - 1 ];
Copy link
Member

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">
Copy link
Member

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
Copy link
Member

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 ) {
Copy link
Member

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.

@engineering-this engineering-this force-pushed the t/1176 branch 5 times, most recently from cec38a7 to 0165273 Compare July 26, 2018 11:32
Copy link
Member

@Comandeer Comandeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Comandeer Comandeer merged commit d644bf3 into major Aug 22, 2018
@CKEditorBot CKEditorBot deleted the t/1176 branch August 22, 2018 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:easy Pull requests that can be reviewed by a Junior Developer before being reviewed by the Reviewer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants