Skip to content
This repository has been archived by the owner on Nov 16, 2017. It is now read-only.

t/131: Contextual toolbar sample #135

Merged
merged 17 commits into from
Dec 16, 2016
Merged

t/131: Contextual toolbar sample #135

merged 17 commits into from
Dec 16, 2016

Conversation

oleq
Copy link
Member

@oleq oleq commented Dec 7, 2016

It's a demo of #131.

Depends on #98 and ckeditor/ckeditor5-theme-lark#55.

// | Balloon |
// +-----------------+
forwardSelection: ( targetRect, balloonRect ) => ( {
top: targetRect.bottom + 15,
Copy link
Member

Choose a reason for hiding this comment

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

What's 15?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@Reinmar Reinmar left a comment

Choose a reason for hiding this comment

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

It doesn't work on Firefox at all. Apparently there's either no click event when selection is made or click is fired before the selection is made.

* @default 30
* @member {Number} module:ui/balloonpanel/balloonpanelview~BalloonPanelView.arrowHorizontalOffset
*/
BalloonPanelView.arrowHorizontalOffset = arrowHorizontalOffset;
Copy link
Member

Choose a reason for hiding this comment

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

Why are you exposing these values if you're not reading it later on but use the consts? This means that if someone changes the theme and try to change these values it's not going to work.

forwardSelection: ( targetRect, balloonRect ) => ( {
top: targetRect.bottom + arrowVOffset,
left: targetRect.right - balloonRect.width / 2,
name: 's'
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking now... how does this value affect anything? It certainly isn't used anywhere in this code. So perhaps it doesn't need to be defined at all? Am I right that only a feature which wants to understand which position the getOptimalPosition function had returned needs to define it?

Copy link
Member

Choose a reason for hiding this comment

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

OK, I see that these values are also used in themes. So you should also update BallonPanelView#position values. Or even better – extract it to some typedef and document that it's related to the theme's classes.

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'm not quite sure what you expect me to change. Positions are documented https://github.com/ckeditor/ckeditor5-utils/blob/master/src/dom/position.js#L263-L272. A position must have a name for any code using the getOptimalPosition utility to know, which of the positions have been chosen, not only what coordinates represent it. We've discussed it already.

Copy link
Member

Choose a reason for hiding this comment

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

What I'm expecting is that the set of supported names is defined somewhere. Initially I thought that this set is totally open, but it's not – the names must much the positions supported by the theme. So we should indicate (to help the developer understanding what it all is) that this is a set of 6 values and that you can add more if you style them.

@Reinmar
Copy link
Member

Reinmar commented Dec 13, 2016

The same problem can be reproduced in Safari.

@oleq
Copy link
Member Author

oleq commented Dec 16, 2016

As for the Safari, the editor won't start in this browser and it has nothing to do with the scope of the PR. The question is: where's an issue for that?

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

As for the Safari, the editor won't start in this browser and it has nothing to do with the scope of the PR. The question is: where's an issue for that?

Update ckeditor5-dev-tests. It has been fixed.

@oleq
Copy link
Member Author

oleq commented Dec 16, 2016

Update ckeditor5-dev-tests. It has been fixed.

No improvement.

image

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

That's exactly the issue I fixed recently and it WFM:

image

Make sure to update ckeditor5 before and then reinstall ckeditor5-dev-tests.

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

That was the issue: https://github.com/ckeditor/ckeditor5-dev-tests/issues/40. And the code landed in 3.1.1.

@oleq
Copy link
Member Author

oleq commented Dec 16, 2016

...and hasn't been updated on master

(master 1ea8f69) oleq@Aleksanders-MBP.local ~/CK/5/ckeditor5> grep ckeditor5-dev-tests package.json
    "@ckeditor/ckeditor5-dev-tests": "^3.1.0",

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

...and hasn't been updated on master

^3.1.0 satisfies 3.1.1. So everything was up to date.

@oleq
Copy link
Member Author

oleq commented Dec 16, 2016

So no idea then. Updated all packages, npm i and there's still that error.

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

So no idea then. Updated all packages, npm i and there's still that error.

I know – that's why npm i is useless. And npm update is unreliable, so I prefer to remove the packages which I want to update and just install them again.

@oleq
Copy link
Member Author

oleq commented Dec 16, 2016

OK. Now I got it. It works in Safari.

But the whole npm thing is weird, really. The problem will return sooner or later.

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

But the whole npm thing is weird, really. The problem will return sooner or later.

It returns every day. It's how npm works and either we learn how to live with it or quit or jobs ;P We can also consider Yarn, but it didn't work in our case previously.

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

Toolbar should disappear when selection changes:

dec-16-2016 14-43-31

@oleq
Copy link
Member Author

oleq commented Dec 16, 2016

Toolbar should disappear when selection changes:

This is but a sample, an entry point to actual implementation. There are still many behaviors that will need to be implemented, and this is just one of them. The sample should show the idea as simple as possible; it's up to actual integration to make it perfect. So I don't think this belongs to the scope of this PR.

@Reinmar
Copy link
Member

Reinmar commented Dec 16, 2016

Hm... OK. Let's polish the behaviour in actual usage places.

@Reinmar Reinmar merged commit 4bff5e0 into master Dec 16, 2016
@Reinmar Reinmar deleted the t/131 branch December 16, 2016 13:54
@Reinmar Reinmar added this to the iteration 6 milestone Dec 16, 2016
@Reinmar Reinmar removed this from the iteration 6 milestone Dec 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants