Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Border styles produced in inline styles could be more optimal #9490

Closed
pomek opened this issue Apr 16, 2021 · 0 comments 路 Fixed by #9500
Closed

Border styles produced in inline styles could be more optimal #9490

pomek opened this issue Apr 16, 2021 · 0 comments 路 Fixed by #9500
Assignees
Labels
package:table type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@pomek
Copy link
Member

pomek commented Apr 16, 2021

馃摑 Provide a description of the improvement

Consider the following examples.

Model Invalid (current) view Expected view The "Why?"
<table borderStyle="solid"> <table style="border-bottom:solid;border-left:solid;border-right:solid;border-top:solid;"> <table style="border-style:solid;"> border-* requires all values (width, style, color) to proper display the element. If any is missing, the "initial" data will be applied which is wrong because it overrides the default styles (from the website).
<table borderStyle="solid" borderWidth="2px"> <table style="border-bottom:2px solid;border-left:2px solid;border-right:2px solid;border-top:2px solid;"> <table style="border-style:solid;border-width:2px;"> Same as above.
<table borderColor="#f00" borderStyle="solid" borderWidth="2px"> <table style="border-bottom:2px solid #f00;border-left:2px solid #f00;border-right:2px solid #f00;border-top:2px solid #f00;"> <table style="border:2px solid #f00;"> If all border definitions are the same, why couldn't we merge them into single property?

It is also possible to load different values than the editor accepts. E.g. when loading the table will the following styles:

/* Assuming that border-color defines the website. */
border-top-style: solid;
border-top-width: 2px;
border-right-style: solid;
border-right-width: 4px;
border-bottom-style: solid;
border-right-width: 6px;
border-left-style: solid;
border-left-width: 8px;

The editor should return:

/* border-style is merged into the single property. */
border-style: solid;
border-top-width: 2px;
border-right-width: 4px;
border-right-width: 6px;
border-left-width: 8px;
@pomek pomek added type:improvement This issue reports a possible enhancement of an existing feature. squad:compat labels Apr 16, 2021
@pomek pomek added this to the iteration 43 milestone Apr 16, 2021
@pomek pomek self-assigned this Apr 16, 2021
niegowski added a commit that referenced this issue Apr 21, 2021
Other (table): Border definitions produced by the `TableProperties` and `TableCellProperties` features will be merged into a group if possible. Instead of producing `border-(top|right|bottom|left):*` property, the `border:*` definition will be returned. The same applies to the table cell padding. See #9490.

Feature (engine): The `StylesProcessor` reducer for `border:*` CSS property was extended to be able to merge to `border:*` property if all its properties (width, style, and color) are specified. Otherwise, `border-(width|style|color)` definition should be returned. Closes #9490.

MINOR BREAKING CHANGE (table): Values for the `borderColor`, `borderStyle`, `borderWidth`, and `padding` model attributes are unified (to values produced by the editor itself) while upcasting the table or table cells if all sides (top, right, bottom, and left) have the same values. Previously, the `<table style="border: 1px solid #ff0">` element was upcasted to `<table borderStyle="{"top":"solid","right":"solid","bottom":"solid","left":"solid"}" borderColor="{...}" borderWidth="{...}">`. Now the object will be replaced with the string value: `<table borderStyle="solid" borderColor="#ff0" borderWidth="1px">`. The same structure is created when using the editor's toolbar. If border values are not identical, the object notation will be inserted into the model (as it is now).

MINOR BREAKING CHANGE (table): Conversion helpers: `upcastStyleToAttribute()`, `downcastAttributeToStyle()`, `downcastTableAttribute()` accept two arguments now (the conversion instance and the options object). The previous usage: `conversionHelper( conversion, /* ... */ )` should be replaced with `conversionHelper( conversion, { /* ... */ } )`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:table type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant