-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
I/6267 #8536
Conversation
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.
While I'm totally digging the look and feel of the balloon 💕, I also have certain concerns regarding the implementation.
I'm not sure why you went with the implementation that relies on ckeditor5-ui. Browsing the discussion under the issue I got the impression that we dumped this tempting concept of using the BalloonPanelView
because it:
- requires importing
import { pinTourBalloon } from '@ckeditor/../../docs/assets/button-indicator.js';
in every snippet file (which is a PITA) - effectively makes
ckeditor5
a dev dependency of (almost) everyckeditor5-*
package for the sole purpose of importing a single helper, which is just wrong.
Have I missed something? I thought we're going with an external library to spare ourselves the hassle. @Reinmar, did you have an impact on this decision?
Anyway, also I spotted some issue with an error being thrown when the button that should get the tour balloon gets immediately wrapped in the "kebab dropdown" due to the narrow geometry of the viewport when the editor loads. But before we move on to this, maybe let's sort out this implementation toolkit decision as it may affect this and similar issues.
docs/assets/snippet.js
Outdated
@@ -122,3 +122,7 @@ window.getViewportTopOffsetConfig = function() { | |||
|
|||
return parseInt( window.getComputedStyle( documentElement ).getPropertyValue( '--ck-snippet-viewport-top-offset' ) ); | |||
}; | |||
|
|||
window.selectToolbarButton = function( buttonPosition ) { |
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.
- Only the classic editor has
.ck-editor__top
. Other editors such as inline or balloon don't have this structure and this will fail in their cases. - I think this will fail with multiple editor on the same page (how to reach the 3rd one?)
- The selector you used will fail in case of nested toolbars (see the highlight feature). Check out the 4th button
vs the 5th one
Also:
- To stay on the safe side I'd go with something like
getToolbarButtonByIndex( toolbarView, index )
used like thisgetToolbarButtonByIndex( editor.ui.view.toolbar, 4 )
orgetToolbarButtonByIndex( editor.plugins.get( 'BlockToolbar' ).toolbarView, 4 )
. - We can deliver another method
findToolbarButton( toolbarView, callback )
, that will utilizeViewCollection#find
, e.g.findToolbarButton( toolbarView, item => item.label === 'Bold' )
to make configurations bulletproof so when somebody reorders the toolbar or the default build config changes, the balloon will find its target. You could also use it to find dropdowns and other UI controls, e.g.item => item.buttonView && item.buttonView.label.startsWith( 'Heading' )
by duck typing. Not super-safe but should work. - You need to figure out which method is better by browsing our guides and checking out which UI views may need the balloon. We may only need the first helper. Or the latter. We may need them both. This requires research.
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.
My mistake, I misunderstood that. But switching now to an external library will not be a big deal as I already have it prepared in one of the previous PoC. Anyway, it will also require to be imported in every snippet, or there is another solution?
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 we import it once in snippet.js
and store the reference somewhere in window
or another namespace?
Suggested merge commit message (convention)
Feature (docs): Mark UI buttons in the guides. Closes #6267.
Additional information