-
Notifications
You must be signed in to change notification settings - Fork 40
Introduce BoxEdges typedef. #1816
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.
A good idea but the word choice is wrong IMO.
src/view/stylesmap.js
Outdated
* left: '7px' | ||
* } | ||
* | ||
* @typedef {Object} module:engine/view/stylesmap~BoxEdges |
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.
I think it should rather be box sides instead. Check out how w3 uses both terms https://www.w3.org/TR/CSS2/box.html (search for both):
These are for edges:
The perimeter of each of the four areas (content, padding, border, and margin) is called an "edge", so each box has four edges:
- content edge or inner edge
- padding edge
- border edge
...
These are for sides (and IMO this is what we want to say):
The 'padding' shorthand property sets the padding for all four sides while the other padding properties only set their respective side.
If there is only one component value, it applies to all sides. If there are two values, the top and bottom paddings are set to the first value and the right and left paddings are set to the second.
The 'border-color' property can have from one to four component values, and the values are set on the different sides as for 'border-width'.
Summary
So edges are more like contours around the box (containing or not containing the padding, border, etc.) and the box has always 4 sides (top, left, bottom, right).
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.
Thanks! I've looked at MDN docs and saw the edges used mostly. But your explanaition & wording is better. I'll fix that :)
Edges are more like contours around the box (containing or not containing the padding, border, etc.) and the box has always 4 sides (top, left, bottom, right).
What do we do about https://ckeditor.com/docs/ckeditor5/latest/api/module_utils_dom_getborderwidths.html#static-function-getBorderWidths? It should use the same typedef. Is it OK if it used the typedef from the engine? Or maybe the typedef should be defined somewhere else? |
IDK to be fair... I'll just write what comes to my mind:
... I'd go with a follow up to iron this out (as the keystroke handler looks like in wrong place) |
Suggested merge commit message (convention)
Docs: Introduce
BoxEdges
type definition. Closes ckeditor/ckeditor5#6132.ps.: I've also removed the
TopRifghtBottomLeft
nomenclature from methods and usedBoxEdges
instead. I think that this is way better then previous.Additional information