Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Lazy loading for the font color/bg dropdowns #60

Merged
merged 8 commits into from
Feb 12, 2020
Merged

Lazy loading for the font color/bg dropdowns #60

merged 8 commits into from
Feb 12, 2020

Conversation

mlewand
Copy link
Contributor

@mlewand mlewand commented Feb 12, 2020

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.

@mlewand mlewand changed the title Lazy loading for font dropdown Lazy loading for the font color/bg dropdowns Feb 12, 2020
@mlewand mlewand marked this pull request as ready for review February 12, 2020 16:15
@coveralls
Copy link

coveralls commented Feb 12, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling c73c882 on i/6192 into c3e7673 on master.

* @readonly
* @member {module:ui/colorgrid/colorgrid~ColorGridView}
* @member {module:ui/colorgrid/colorgrid~ColorGridView/undefined}
Copy link
Member

Choose a reason for hiding this comment

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

|undefined

@@ -252,6 +240,38 @@ export default class ColorTableView extends View {
this.keystrokes.listenTo( this.element );
}

/**
* Renders and appends {@link #staticColorsGrid} and {@link #documentColorsGrid} views.
Copy link
Member

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.

Copy link
Contributor Author

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.

@Reinmar
Copy link
Member

Reinmar commented Feb 12, 2020

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.

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.

As commented.

@mlewand mlewand requested a review from Reinmar February 12, 2020 16:27
@Reinmar
Copy link
Member

Reinmar commented Feb 12, 2020

Next goal – getting rid of this layout and style recalculations :) Fonts work fine now.

image

@Reinmar Reinmar merged commit 165417c into master Feb 12, 2020
@Reinmar Reinmar deleted the i/6192 branch February 12, 2020 18:43
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.

Font color/background UI rendering should be improved
3 participants