-
Notifications
You must be signed in to change notification settings - Fork 28
Lazy loading for the font color/bg dropdowns #60
Conversation
Tests will need to be adjusted.
src/ui/colortableview.js
Outdated
* @readonly | ||
* @member {module:ui/colorgrid/colorgrid~ColorGridView} | ||
* @member {module:ui/colorgrid/colorgrid~ColorGridView/undefined} |
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.
|undefined
src/ui/colortableview.js
Outdated
@@ -252,6 +240,38 @@ export default class ColorTableView extends View { | |||
this.keystrokes.listenTo( this.element ); | |||
} | |||
|
|||
/** | |||
* Renders and appends {@link #staticColorsGrid} and {@link #documentColorsGrid} views. |
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.
SRP – render or append. Or change the name at least.
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.
The thing here is that in order to append it it also has to render it first (and this is the most intense operation, which we want to avoid). I'll turn it into append then.
For me, the solution looks completely fine. I'm not saying that the surrounding code is good and I didn't even look at it. But this change itself is very similar to what we did in other plugins, so that sounds fine. |
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.
As commented.
Suggested merge commit message (convention)
Other: Implemented lazy loading for the font color and background dropdown. This will reduce editor initialization time. Closes ckeditor/ckeditor5#6192.
Additional information
It's difficult to easily pull this optimization for the font color / bg plugin.
First of all this plugin stores its model in the view - so you need the view to have things running.
There's no clear UI and business logic separation for this plugin. For example,
ColorGridView
class (so type that we'd like to defer) holds a selected color.It works, and the tests are passing - but the solution is not super pretty.