-
Notifications
You must be signed in to change notification settings - Fork 28
T/4: Initial Font plugin implementation. #5
Conversation
…ipeline conversion.
…efinition interface to ckeditor5-engine.
…buteElement as an array.
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 code looks great. What we need is a better, more verbose documentation to help developers use the (sub–)features we developed.
docs/features/font-size.md
Outdated
|
||
{@snippet features/build-font-size-source} | ||
|
||
The {@link module:font/fontsize~FontSize} feature enables support for setting font size. |
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'm afraid this is not a very rich introduction. We should clearly state here that the feature is about inline elements, classes and the style
attribute.
docs/features/font-family.md
Outdated
|
||
{@snippet features/build-font-family-source} | ||
|
||
The {@link module:font/fontfamily~FontFamily} feature enables support for setting font family. |
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.
See my first comment in the font-size.md.
docs/features/font-size.md
Outdated
## Configuring font size options | ||
|
||
It is possible to configure which font size options are supported by the editor. Use the {@link module:font/fontsize~FontSizeConfig#options `fontSize.options`} configuration option to do so. | ||
Use the special keyword `'normal'` to use the default font size defined in the web page styles. |
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.
Why normal
but not default
? Font size defined default
for the same purpose. Is this by design?
* | ||
* @extends module:core/plugin~Plugin | ||
*/ | ||
export default class Font extends Plugin { |
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.
This plugin has no manual test and is not even mentioned in docs. What's the purpose of it then?
src/font.js
Outdated
import FontSize from './fontsize'; | ||
|
||
/** | ||
* The Font plugin. |
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.
What does it do? Because it requires some classes it does not mean it enables them.
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.
s/Font/font/
src/fontfamily/fontfamilyui.js
Outdated
import fontFamilyIcon from '../../theme/icons/font-family.svg'; | ||
|
||
/** | ||
* @extends module:core/plugin~Plugin |
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.
What does it do? What sort of UI does it create? How to use it in the configuration?
src/fontsize/fontsizeediting.js
Outdated
const FONT_SIZE = 'fontSize'; | ||
|
||
/** | ||
* The Font Size Editing feature. |
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.
What does it do? Since we break features into pieces we must explain what each piece is responsible for if developers are expected to use them.
src/fontfamily/fontfamilyediting.js
Outdated
const FONT_FAMILY = 'fontFamily'; | ||
|
||
/** | ||
* The Font Family Editing feature. |
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.
What does it do? Since we break features into pieces we must explain what each piece is responsible for if developers are expected to use them.
src/fontsize/fontsizeui.js
Outdated
import '../../theme/fontsize.css'; | ||
|
||
/** | ||
* @extends module:core/plugin~Plugin |
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.
Same as font family UI.
docs/features/font-size.md
Outdated
- `'big'` | ||
- `'huge'` | ||
|
||
Each size is represented in the view as a `<span>` element with the `text-*` class. For example, the `'tiny'` preset looks as follows in the editor data: |
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.
We must clearly state that we don't provide the styles. It's up to developers to style .ck-content span.tiny {}
and we must show a short snippet how to do that.
No it's huge ;P |
Men... always talking about the size. |
cc @m-turek |
That's my bad, Array.prototype.sort() doesn't preserve order of elements with same value of sorting criteria. I'll fix it soon (today) Edit: Should work fine now if you reinstall Umberto |
Should we change left(right) padding of every element in cc @oleq |
You're right @dkonopka. We should see this fixed. |
I've fixed another issue in Umberto (the list view in dropdown had margin and padding set): ckeditor/ckeditor5#494 (comment). Besides that dropdown looks OK. |
…ntion as the font family feature.
Suggested merge commit message (convention)
Feature: Initial Font feature implementation. Closes ckeditor/ckeditor5#2275. Closes ckeditor/ckeditor5#2276. Closes ckeditor/ckeditor5#2277.
Additional information
The changes in UI/Theme changes which element gets borders and white background by default. Now it's only to dropdown button with label only - other types of buttons are rendered as buttons.
I have only one major issue with this PR which requires talks/decisions. I've used Regex to create
view
converter definition for Font Family asfont-family
inline styles might be defined in various ways in HTML - by using quotes (single/double) or by not using them. So there's a regex that checks any variation of:ckeditor5-font/src/fontfamily/utils.js
Lines 58 to 98 in c77be7e
What I can create instead is a use of a callback that would basically to what this regex but programatically. Only thing would be updating documentation in
definition-based-coverters
(andViewElementDefinition
, etc) to reflect this behavior.