-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The dropdown's name doesn't match the standards #2123
Comments
But the real question is different: do we want to have 2 different UI components for the same feature in a single editor instance? If yes, then there's no other way than to differentiate e.g. If no, then it's obvious that there's only one UI representation of the feature in the editor and that's it. It's just |
To shed some light on this. The
Similar approach I've showcased to @Reinmar with highlight so you can have:
Right now both buttons and dropdowns are defined by |
We certainly should consider cases that a single feature has more than one UI component for it. Otherwise, in rare situations when someone created a mighty build of CKEditor 5 (e.g. with various alternatives of the heading feature), some of the components won't work. I could agree that:
In the latter case, the "Dropdown" suffix will work kinda like a plural form (so, instead of
However, what about other type of feature components? Highlight uses a split button – can be it called a "dropdown"? Won't this be confusing?
I don't like the fact that there's And I'm closer to upper-first. Why? Because there are cases like |
I'm still leaning towards: Solution 1: event separator notation
The default UI component have its name after a feature. So For me, the main pro for this is that the dev will not have to think whether Solution 2: camel case
Requires reading docs to build toolbar. (I know, I know - one would see on examples that heading is a dropdown then the configuration is |
ps: I'm for option 1 still. |
That's a good point actually. Still, what should we do about https://github.com/ckeditor/ckeditor5-heading/issues/74?
|
I'm quite ok with the editor.config.define( 'heading', {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
]
} ); The model element names are defined here and cannot contain a |
BTW, there's even bigger problem with command names. They should somehow match component names or there needs to be a simple rule for naming a component which uses a certain command with a certain value. One idea that we should investigate is whether it's good that we've split the heading command into separate commands. Right now, it's inconsistent with the other comnmands (e.g. alignment). |
As @oleq suggested below is a some pseudo code after proposing changes in heading feature. Adding a button for heading: editor.ui.componentFactory.add( 'heading:heading1', locale => {
const button = new ButtonView( locale );
button.set( { icon, label } );
const command = editor.commands.get( 'heading' );
button.bind( 'isOn' ).to( command, 'value', value => value === 'heading1' );
button.bind( 'isEnabled' ).to( command );
return button;
} ); Required changes in heading:
/cc @Reinmar, @oleq Also would like to see input from guys that created other UIs with heading command (@oskarwrobel, @pjasiun ?)
|
OK so to sum up F2F talks, we agreed that component naming should be unified as proposed above. A general rule is to name default/primary component after a feature:
If a feature provides secondary component it should be namespaced by a feature name and
Such way of defining component will be easier to construct in code (no As this is a general rule it should be followed up to the point that other naming for a component makes more sense. But of course this should be avoided and only provide when necessary.
Also we found that:
ps.: Side questions:
|
Doh... it's called after the BTW, another such example is PS. |
Totally agree.
Again... Doh. I guess we won't avoid exceptions. Here we could have one command with a param, but I'm completely against that. It's a huge and significant command, not something to be controlled by editor configuration. So, maybe the rules should depend on whether a thing is controlled through the editor configuration. If it is, then one command + values. If isn't, then up to the developer. |
@Reinmar & @oleq to be 100% sure as I get confused by comments:
Do we want commands to be renamed also? I'm guessing not - but I'd rather ask then undo something. I'm asking about UI component names here: should it be Also I didn't create
Also I'm going to implement this as a next step (headings -> heading UI component is alredy renamed):
|
Internal: Update UI components & commands naming standard. Closes #16.
It's called
alignmentDropdown
while the heading feature exposes aheadings
component (which is a dropdown).We need to decide on one naming scheme.
cc @jodator, @oleq
The text was updated successfully, but these errors were encountered: