ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Style feature

Open fredck opened this issue 9 years ago • 11 comments

I would like to propose the Styles feature as a replacement for the “Font Face”, "Font Size”, “Color” and any other inline styling features that target formatting only.

The reason for that is not a rage to “ban formatting features”. It is a matter of UX and to give a tool that better satisfied the user intention. If I’m not wrong, ofc.

I believe that users are not really intended to use such formatting features just for fun. Like making every part of a document with different font size. If they use the font size, they do this on purpose, for a specific scope, and they much probably reuse that same size in other places for that same scope.

Some use cases that came to my mind:

  • Change font face of all titles to a font that I like more.
  • Change the font face of the whole content to a font that I like more.
  • Change the size of the text in a paragraph to a smaller/bigger size because they have a specific secondary purpose in my document. Reuse the size in other places.
  • Change the color with the same intention as the above point. Reuse that color in other places
  • Change the style of the whole paragraph so it displays as an alert, information, tip, etc.

In other words, the user is either controlling the styles of the document and elements in it, or using a set of block/inline styles for a specific purpose. They don’t need the whole range of styles, just the ones that they like. Actually, having so many options makes it easy to make mistakes, like using different font sizes in different places, just because one doesn’t remember precisely which size was used before, etc.

That’s why I propose the introduction of the “Styles” feature, very similar to what we have in CKEditor 4 but limited to CSS classes only.

When used in a “controlled content” case

In many situations, developers want to have control on which styles users can apply to content, based on CSS designed by graphic designers. This is the best case for the use of the Styles feature, ofc. So not much to add here.

When used in a “non-controlled content” case

In document editing applications, similar to Google Docs, developers have no reason to limit users to a list of styles. Users should have the possibility of controlling how their documents look like with more freedom.

I want to still propose the Style feature for this case, pushing the application developers to be more creative and to create UI/UX solutions that will be more efficient for the end user. In fact, we ourselves could propose a solution specific to document editing.

One of the ideas is that the application gives to the user the possibility of configuring and defining styles. Here is a mockup of an example of how this could be handled:

image

The idea is that specific plugins could be created to allow users to customize existing styles or even to add new ones. This could give enough freedom on the customization of the document styles and create specific custom styles, with the additional benefit of making them easy to reuse in the same editing session and in the future.

This is targetting document editor solutions, so the application should be able to store the user customizations, which could be outputted by the editor as JSON or whatever proper format.

I strongly believe that this would cover the great majority of use cases for these formatting features, in a more elegant way and with better results for the end user.


If you'd like this feature implemented, react with :+1: to this post.

fredck avatar Nov 03 '17 14:11 fredck

As much as I understand the idea, I have the feeling that it is too many clicks to get to the point. 1st click in a drop-down, then click "add new style", then choose what I wanted to change and then accept it. It is 4 clicks, instead of 2 (i.e. click the color dropdown and choose a color).

Also, I think that "Customize text style" should include bold and italic too. And maybe text input for a label (name).

My second question would be how to differentiate between inline styles and box styles (for example some fancy styling for particular keywords vs alert boxes). Would it be two dropdowns or one mixed? Would it be possible to add box styles too?

I have mixed feelings. I wholeheartedly agree that users want to reuse given style and I also agree that having some set styles to reuse will limit mistakes ("which yellow did I just use?"). I also can't really think of an easier execution of this feature if we want to give the possibility to add styles during content editing.

scofalik avatar Nov 03 '17 14:11 scofalik

As much as I understand the idea, I have the feeling that it is too many clicks to get to the point. 1st click in a drop-down, then click "add new style", then choose what I wanted to change and then accept it. It is 4 clicks, instead of 2 (i.e. click the color dropdown and choose a color).

I'm not totally happy about that as well. It's the "something for something" approach... more pain at first to benefit from it later.

Maybe we can come with other ideas. For example, showing the formatting features straight inside the select box, instead of the "Add style" option. If you name the style, you "save" it. Otherwise, it is applied to the text immediately.

In other words, brainstorming is needed here.

Also, I think that "Customize text style" should include bold and italic too. And maybe text input for a label (name).

Yes, I didn't want to make things more complicated in the mockup, but in fact, we can have anything that CSS can give us.

My second question would be how to differentiate between inline styles and box styles (for example some fancy styling for particular keywords vs alert boxes). Would it be two dropdowns or one mixed? Would it be possible to add box styles too?

We'll see.... probably all in one, but it's not important to define right now.

fredck avatar Nov 03 '17 15:11 fredck

Talking with @wwalc, he proposed something like the "Copy Format" feature for the purpose of adding a custom style to the list. This would require to still have the Font Face, Font Size and Color features on the toolbar, while avoiding them was exactly one of my goals with this feature, but it is a possible way for it as well.

fredck avatar Nov 03 '17 15:11 fredck

I was thinking about this too but ultimately decided that this might not be the best idea. But maybe it is?

scofalik avatar Nov 03 '17 15:11 scofalik

I would like to propose the Styles feature as a replacement for the “Font Face”, "Font Size”, “Color” and any other inline styling features that target formatting only.

Before I get into details: should the development of markers etc. be stopped because of that?

That’s why I propose the introduction of the “Styles” feature, very similar to what we have in CKEditor 4 but limited to CSS classes only.

Because if it's limited to CSS classes only, it's not an actual replacement of "inline styling features that target formatting only". I'm a little bit confused here.

oleq avatar Nov 03 '17 15:11 oleq

Before I get into details: should the development of markers etc. be stopped because of that?

No. This issue doesn't have any priority defined.

Because if it's limited to CSS classes only, it's not an actual replacement of "inline styling features that target formatting only". I'm a little bit confused here.

I meant to say that this features should be a solution to replace "unwanted" formatting only features. It is not limited to that, ofc, as the whole power of CSS can be used when defining styles.

fredck avatar Nov 03 '17 16:11 fredck

"Dropdown in dropdown" is not the best idea for the user (but like you said is something for something). Anyway, it's worth to take the risk and in the future, the "Customized text style" can be very intuitive for everyone.

I really like this possibility of storing custom styles in JSON (for example I'm working with CK5 on my blog and I need to copy styles to another website).

dkonopka avatar Nov 06 '17 08:11 dkonopka

As much as I like this idea, I also agree that people will not get it. People are able to define styles in MS Word for more than 10 years and they are still not familiar with the concept. Even editing huge documents where it would save them hours of work.

The concept of styles, even if is very nice, useful, and correct, for us, developers, is just too complex for people who don't think in an abstract way. Styles are an abstraction and, even if we find them natural, you need to have abstract thinking to get why they are useful.

pjasiun avatar Nov 06 '17 10:11 pjasiun

While I agree that styles are the way to go for technical users, I believe that non-technical users would have a hard time with the added layer of abstraction. As such, I share @pjasiun's concerns.

davidpolberger avatar Nov 11 '17 00:11 davidpolberger

I thought about the style feature when replying in #8117. I thought that perhaps the style feature could have two modes – semantical (class-based) and visual. In the latter form, perhaps it could work very closely to how it's happening in Word – where a "Heading 1" style is actually a combination of many non-semantical features (font color, font size, font family, alignment, margins, etc.)

Reinmar avatar Sep 21 '20 12:09 Reinmar

The concept of styles, even if is very nice, useful, and correct, for us, developers, is just too complex for people who don't think in an abstract way. Styles are an abstraction and, even if we find them natural, you need to have abstract thinking to get why they are useful.

Yes, it is kinda abstract for users, but from my perspective, the styles-select worked very well for our customers in the past. We've simply removed the font-size, color, etc. inline-style nightmare things, so the user is forced to use the selects. Sure, this is our specific use case in Drupal, there cases where this is not enough, but we don't talk about replacing the inline-style settings for color, font-family, ... ? So this shouldn't be a problem.

The disgusting thing with the styles-select is, that classes aren't combinable, so if you need something like .large-text combined with .primary-color you need to define an extra entry .large-text.primary-color. If you have multiple sizes and multiple colors, this will end up in a very, very large, confusing list. But indeed, this is a complicated task to solve, at least if some kind of 'rules' needed to check if .class-x is allows to be combined with .class-y.

But maybe this could be solved by just using separated selects for font-family, font-size and font-color (+ something like the styles-select for predefined styles, for something like pill-/tag style AND maybe the user defined styles, who are just built from these three options, so it is still class based and only predefine some combinations).

One last word to the user defined custom styles: If I understand the wireframes right, the user would be able to define a new style by set font-size, -color and -family for a new style, what is stored in JSON and the Editor will serve CSS styles for this? Especially for the font-size, keep in mind, that the user may need to define different font-sizes for different device sizes => Media Queries. So.. another point why the predefined classes-only-apporach is probably the better way. As i wrote above, maybe the user should just be able to combine existing classes (font-size, -family & color).

Furthermore, it's probably worth to have a look at the Wordpress Gutenberg editor. I really like the way they solved the color and font-size settings. Modules/Themes are able to override the list of available colors and everything is a class, never an inline-style. The users got a preview of the styles in the settings sidebar.. if we had something like this in the CKE dropdowns.. this would be sooo nice:

gutenberg_headings_options_panel

thomasfrobieter avatar Sep 06 '21 11:09 thomasfrobieter