Skip to content

feat(composer): align images in the editor and in sent messages - #13509

Open
kesselb wants to merge 1 commit into
mainfrom
ckeditor-image-alignment
Open

feat(composer): align images in the editor and in sent messages#13509
kesselb wants to merge 1 commit into
mainfrom
ckeditor-image-alignment

Conversation

@kesselb

@kesselb kesselb commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix #11131
Fix #9350

STR:

  • Draft new message
  • Upload image
  • Align inline image
  • View email

Main: Image not aligned

Here: Image aligned

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@kesselb kesselb self-assigned this Aug 18, 2026
@kesselb
kesselb requested a review from GretaD as a code owner August 18, 2026 15:52
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Aug 18, 2026
@kesselb
kesselb requested review from GVodyanov and odzhychko and a lite review from Copilot August 18, 2026 15:53
Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
kesselb force-pushed the ckeditor-image-alignment branch from de4b4ef to f237fb7 Compare August 18, 2026 15:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR updates the CKEditor composer configuration and downcast behavior so image alignment (left/center/right) is consistent between the editor view and the HTML that gets sent (and later reopened).

Changes:

  • Enable image style + image toolbar in the editor and expose alignment actions.
  • Inline alignment styles during downcast so email clients render alignment consistently.
  • Add/update unit tests to cover alignment toolbar config and downcasted alignment styles.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/components/TextEditor.vue Enables CKEditor image style/toolbar and aligns editor CSS with downcast defaults.
src/ckeditor/image/ImageDowncastPlugin.ts Adds alignment inlining logic based on image style classes during downcast.
src/tests/unit/components/TextEditor.spec.js Updates test to assert alignment toolbar configuration is present.
src/tests/unit/ckeditor/image/ImageDowncastPlugin.spec.js Extends downcast tests to cover center/right/default-left alignment behavior.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 67 to 69
if ((item.is('element', 'figure') && item.hasClass('image')) || item.is('element', 'img')) {
this._inlineAlignment(writer, item)
this._mirrorResizedWidth(writer, item)
Comment on lines +83 to +89
_inlineAlignment(writer: UpcastWriter, figure: ViewElement): void {
// Without an alignment class the figure keeps the client's own margins.
const className = Object.keys(ALIGNMENTS).find((candidate) => figure.hasClass(candidate))
?? 'image-style-block-align-left'

writer.setStyle(ALIGNMENTS[className], figure)
}
* @param writer view writer of the data view
* @param figure the figure to align
*/
_inlineAlignment(writer: UpcastWriter, figure: ViewElement): void {

@GVodyanov GVodyanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Is it expected that the arrows in the blue border not change when changing the alignment buttons underneath? Maybe I'm not understanding this correctly.

Also when clicking alignment to the right it's still aligned to the left

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted This PR contains AI-assisted commits enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to change allignment of images when composing an email or setting a signature Left-aligned mail signature images not possible

4 participants