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

I/6049: Introduced the table cell properties UI #227

Merged
merged 38 commits into from
Jan 28, 2020
Merged

I/6049: Introduced the table cell properties UI #227

merged 38 commits into from
Jan 28, 2020

Conversation

oleq
Copy link
Member

@oleq oleq commented Jan 21, 2020

Suggested merge commit message (convention)

Feature: Introduced the table cell properties UI. Closes ckeditor/ckeditor5#6049.


Additional information

Requirements

Dependencies:

Round up

New things in the PR:

  • TableCellPropertiesUI (controller plugin)
  • TableCellPropertiesView (form view)
  • (private) FormRowView a class shared between the TableCellPropertiesView and the (future) TablePropertiesView. Initially, I wanted to make it part of ckeditor5-ui then I figured we may need something better like a form builder so making it a public API does not make sense ATM (until we do more than 2 table forms).
  • 2 new icons for the cell properties view and (future) table properties view.

Followups:

Also:

@oleq oleq marked this pull request as ready for review January 22, 2020 10:07
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

I've made a birds-eye review. Most of them don't require action in this PR as the code as general is really nice :)

Edit: aaaaand I've just read the follow-ups and I can see the declarative from builder which probably address the coment about form view class :)

const editor = this.editor;
const data = {};

for ( const propertyName of CELL_PROPERTIES ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it wouldn't be better to separate logic related to each value of CELL_PROPERTIES as here and in other places there are loops and checks.

This will have some code duplication for sure. But maybe it will be more clear or will require fewer changes if the logic for one of the values would change. Another consideration is enabling/disabling (by configuration - not in runtime) some properties from editing.

then some code would be

handleProperty() {
    this.listenTo( view, 'change:property', ... );
    // some other listener for the form view setting
}

import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';

import checkIcon from '@ckeditor/ckeditor5-core/theme/icons/check.svg';
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ 📜 I just love those wall of text in this whole feature :D

bottom: t( 'Align cell text to the bottom' )
};
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought - awfully long and mixes logic for different properties. I think that it might be a good candidate for a follow up / decision to make for the future. It's OK for the MVP :)

Copy link
Contributor

Choose a reason for hiding this comment

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

ps.: Also the above comment can have little sense if we can't have a need for enabling or disabling some properties.

src/ui/utils.js Outdated
* @returns {module:utils/dom/position~Options}
*/
export function getBalloonCellPositionData( editor ) {
const model = editor.model;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that some of the intermediate values could be dropped in favor of a shorter method.

import TableCellPropertiesUI from '../../src/tablecellproperties/tablecellpropertiesui';
import TableCellPropertiesUIView from '../../src/tablecellproperties/ui/tablecellpropertiesview';

describe( 'TableCellPropertiesUI', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've wrapped the test in either describe( 'table cell properties', () => {} ) or describe( 'table properties', () => {} ) to group those tests. This is just cosmetic but it helped me to group those tests in a report:

Selection_132

vs current:
Selection_133

and the same in CLI:
Selection_134

ps.: I'll hijack this comment for standup tension as current table tests are a mes :D

@oleq
Copy link
Member Author

oleq commented Jan 22, 2020

Self.R-: Use setTableCellWithObjectAttributes in tests.

@oleq oleq changed the base branch from i/3287 to master January 24, 2020 13:13
@oleq
Copy link
Member Author

oleq commented Jan 24, 2020

Self.R-: Use setTableCellWithObjectAttributes in tests.

Nah, checked it and it's not necessary after all.

jodator added a commit to ckeditor/ckeditor5-ui that referenced this pull request Jan 24, 2020
Feature: Created the `LabeledView` class (see ckeditor/ckeditor5-table#227).

Also added `id` properties to the `DropdownView` and `LabelView` for compatibility with the `LabeledView`.
jodator added a commit to ckeditor/ckeditor5-theme-lark that referenced this pull request Jan 24, 2020
Feature: Added styles for the LabeledView (see ckeditor/ckeditor5-table#227).
jodator added a commit to ckeditor/ckeditor5-core that referenced this pull request Jan 27, 2020
Feature: Added vertical alignment icons. Also moved alignment icons form ckeditor5-alignment (see ckeditor/ckeditor5-table#227).
jodator added a commit to ckeditor/ckeditor5-alignment that referenced this pull request Jan 27, 2020
Other: Moved alignment icons to ckeditor5-core (see ckeditor/ckeditor5-table#227).

BREAKING CHANGE: The `align-left`, `align-right`, `align-center`, and `align-justify` icons have been moved to `ckeditor5-core`.
@coveralls
Copy link

coveralls commented Jan 27, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling 10ab4ae on i/6049 into d905bef on master.

Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

Everything looks and works very good :) I have only one concern about the main UI class an how the bindings are constructed there. However, we can move that part to a follow up to unblock other work but we should decide what to do with this for the table properties UI.

src/tablecellproperties/tablecellpropertiesui.js Outdated Show resolved Hide resolved
src/tablecellproperties/tablecellpropertiesui.js Outdated Show resolved Hide resolved
src/tablecellproperties/ui/tablecellpropertiesview.js Outdated Show resolved Hide resolved
src/tablecellproperties/ui/tablecellpropertiesview.js Outdated Show resolved Hide resolved
src/tablecellproperties/ui/tablecellpropertiesview.js Outdated Show resolved Hide resolved
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jodator jodator merged commit 1eb4b4c into master Jan 28, 2020
@jodator jodator deleted the i/6049 branch January 28, 2020 14:37
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.

Table styles UI
3 participants