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

Refresh balloon toolbar after change in the editor #1351

Merged
merged 11 commits into from
Dec 19, 2017
Merged

Refresh balloon toolbar after change in the editor #1351

merged 11 commits into from
Dec 19, 2017

Conversation

Comandeer
Copy link
Member

What is the purpose of this pull request?

Bug fix

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?

Added listener for change to balloon toolbar position refresher. The drawback of the current solution is the fact that balloon toolbar without undo plugin won't refresh its position dynamically.

Closes #1342.

@mlewand mlewand self-requested a review December 15, 2017 16:22
Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

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

Just a couple things in tests.

On top of that I'd like this test to be merged into other test suite, for instance tests/plugins/balloontoolbar/view.js. We don't want to have a separate test suite just for this one test case.

var tests = {
setUp: function() {
// In IE8 tests are run in very small window which breaks positioning assertions and tests fails (#1076).
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This part is done by ignoreUnsupportedEnvironment function that you call at the end of a file.

assert.ignore();
}
if ( parentFrame ) {
parentFrame.style.height = '900px';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need these tricks? I see it's a copy'n'paste from positioning.js, to get around #1076, however I cannot reproduce issue described in this ticket.

'test panel refresh position': function( editor, bot ) {

bot.setData( '<figure class="image"><img src="' + bender.basePath + '/_assets/lena.jpg"></figure>', function() {
var balloonToolbar = new CKEDITOR.ui.balloonToolbarView( editor, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong indentation after this var.

editor.widgets.instances[ 0 ].on( 'focus', function( evt ) {
setTimeout( function() {
editor.execCommand( 'sideImage', { widget: evt.sender } );
}, 5000 );
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make it 3 secs? 5 seems like forever :D

Copy link
Member Author

Choose a reason for hiding this comment

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

I've made it even 2 seconds ;)

@Comandeer
Copy link
Member Author

I've moved unit test to positioning.js as it's connected with toolbar position.

@mlewand
Copy link
Contributor

mlewand commented Dec 19, 2017

Rebased onto latest master branch.

Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

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

This change shows me that now repositioning method could use some throttling. 🙂

@mlewand mlewand merged commit 53c77e7 into master Dec 19, 2017
@mlewand mlewand deleted the t/1342 branch December 19, 2017 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants