Skip to content

Implement the text alignment feature #2113

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

Closed
oleq opened this issue Oct 30, 2017 · 1 comment · Fixed by ckeditor/ckeditor5-alignment#6
Closed

Implement the text alignment feature #2113

oleq opened this issue Oct 30, 2017 · 1 comment · Fixed by ckeditor/ckeditor5-alignment#6
Assignees
Labels
package:alignment type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@oleq
Copy link
Member

oleq commented Oct 30, 2017

The feature should be developed in the dependency injection–friendly way:

export default class AlignmentEditing extends Plugin {
    // defines model, converters and commands
}
export default class AlignmentUI extends Plugin {
    // for each command created by AlignmentEditing
    // it creates the corresponding UI
}
export default class Alignment extends Plugin {
	// Glues the editing and the UI
	static get requires() {
		return [ AlignmentEditing, AlignmentUI ];
	}
}

Model and data

  1. The name stays. It sounds generic but there's hardly any other feature that could be named the same. In the context of a WYSIWYG editor, alignment almost always applies to the text.
  2. There are 4 alignments: left, center, right and justify.
  3. The feature should output the inline styles (text-align: right). Unlike classes, this option is simpler and requires no additional configuration for composing emails and similar. In the future, we may decide to make the output configurable like in v4.
  4. The feature should work for paragraphs, headers, and lists
    <h2 style="text-align: right">bar</h2>
    <p style="text-align: right">foo</p>
    <li style="text-align: right">foo</li>
    <blockquote><p style="text-align: right">foo</p></blockquote>
  5. The default option (command) which is enabled when there is no alignment in the selection is "left".
  6. The commands of the feature are disabled when the image is selected or when the selection is in the <figcaption>.
  7. Each alignment should have its own command (see: HeadingCommand).
  8. No support for RTL in the MVP.
  9. There should be a very basic configuration for the users to enable/disable the commands.
    ClassicEditor
    	.create( {
    		alignment: {
    			styles: [ 'left', 'right', ... ]
                        }
    	} )
    	.then( ... )
    	.catch( ... );

UI

  1. Each alignment style will have own UI toolbar button.
  2. By default, the buttons will be aggregated in the group.
    image
    It's a TODO because ATM there's no such possibility. Things to consider:
    0. A new UI component (dropdown) that groups other components is needed.
    1. How would toolbar config look like?
    2. Should it be configurable at all? Or maybe the AlignmentUI will provide the grouped buttons as w whole and to use them separately (4 buttons in the toolbar, next to each other) another UI will be required? This is a very generic problem for all our features.

A follow–up of #634.

@jodator jodator self-assigned this Oct 30, 2017
@jodator
Copy link
Contributor

jodator commented Nov 2, 2017

There should be a very basic configuration for the users to enable/disable the commands.

I'm thinking about this one. How this should behave if only one style is defined?
Like center only?

Then I assume that:

  • only allowed alignment is center or default
  • executing alignCenter command on already aligned text should remove alignment attribute from model (thus removing style text-align)
  • any existing alignment should be removed from content (on first load) as converters will be not defined

szymonkups referenced this issue in ckeditor/ckeditor5-alignment Nov 7, 2017
Feature: Initial implementation. Closes #2.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-alignment Oct 8, 2019
@mlewand mlewand added status:confirmed type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:alignment labels Oct 8, 2019
@mlewand mlewand added this to the iteration 14 milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:alignment type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants