Skip to content

Conversation

joshua-salsadigital
Copy link
Collaborator

@joshua-salsadigital joshua-salsadigital commented Jul 9, 2025

https://www.drupal.org/project/civictheme/issues/3526953

Checklist before requesting a review

  • I have formatted the subject to include ticket number as Issue #123456 by drupal_org_username: Issue title
  • I have added a link to the issue tracker
  • I have provided information in Changed section about WHY something was done if this was not a normal implementation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have run new and existing relevant tests locally with my changes, and they passed
  • I have provided screenshots, where applicable

Changed

  1. Fixed ct-figure class overwriting align-center, align-left, align-right class.

Screenshots

Summary by CodeRabbit

  • New Features

    • Added new styles for CKEditor content, ensuring consistent spacing and alignment for figures within the editor.
  • Style

    • Updated the main theme stylesheet to include CKEditor-specific styles, improving visual consistency across edited content.

@joshua-salsadigital joshua-salsadigital self-assigned this Jul 9, 2025
Copy link

coderabbitai bot commented Jul 9, 2025

Walkthrough

A new SCSS partial for CKEditor-specific styles was introduced and imported into the main CivicTheme stylesheet. This update ensures that .ct-figure elements with alignment classes are styled consistently within CKEditor content, standardizing their display and spacing.

Changes

File(s) Change Summary
web/themes/contrib/civictheme/assets/sass/theme.scss Added import statement for the new CKEditor SCSS partial.
web/themes/contrib/civictheme/assets/sass/ckeditor/_ckeditor.scss Created new SCSS partial defining .ct-figure alignment and spacing styles for CKEditor content.

Suggested reviewers

  • richardgaunt

Poem

In the garden of styles where Sass bunnies play,
A new CKEditor patch hops in today.
Figures align left, center, or right,
Spaced just so, looking tidy and bright.
With every hop, our theme grows neat—
CSS carrots for all, a Civic treat! 🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5636482 and 69fc06f.

📒 Files selected for processing (1)
  • web/themes/contrib/civictheme/assets/sass/ckeditor/_ckeditor.scss (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • web/themes/contrib/civictheme/assets/sass/ckeditor/_ckeditor.scss
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: commit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

// These overrides will not be visible in the Storybook.
@import 'page/page';
@import 'header/header';
@import 'ckeditor/ckeditor';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue is specific to Drupal’s creditor classes, and therefore, it was more appropriate to handle it as a Drupal-specific override. Hence not added via UIKit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@alan-cole This is best answered - will this cause issues if we have this included in the base Drupal CSS? From my mind no.

@joshua-salsadigital joshua-salsadigital added the State: Needs review Pull requests needs a review from assigned developers label Jul 9, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
web/themes/contrib/civictheme/assets/sass/ckeditor/ckeditor.scss (2)

2-3: Correct the component name casing in header comment

Use the canonical “CKEditor” spelling to stay consistent with upstream naming and the rest of the code base.

-// This file contains styles for the Ck Editor component in the CivicTheme.
+// This file contains styles for the CKEditor component in CivicTheme.

6-6: Remove the unused $root variable

$root is declared but never referenced. Leaving unused variables triggers Stylelint scss/no-unused-variable and adds noise.

-  $root: &;
+  // $root placeholder removed – no references found
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 283cc60 and 5636482.

📒 Files selected for processing (2)
  • web/themes/contrib/civictheme/assets/sass/ckeditor/ckeditor.scss (1 hunks)
  • web/themes/contrib/civictheme/assets/sass/theme.scss (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: commit
🔇 Additional comments (2)
web/themes/contrib/civictheme/assets/sass/ckeditor/ckeditor.scss (1)

8-16: Adjust margin rules for centered images in CKEditor

To prevent fixed side margins from overriding Drupal’s default centering, split the combined rule so that only left/right use pixel offsets and center uses auto:

 // Keep spacing for left/right aligned figures.
-&.align-left,
-&.align-center,
-&.align-right {
+&.align-left,
+&.align-right {
   display: block;
   margin-block-start: ct-particle(2);
   margin-block-end: ct-particle(2);
   margin-inline-start: ct-particle-px(5);
   margin-inline-end: ct-particle-px(5);
 }

+// Preserve true horizontal centering for center-aligned figures.
+&.align-center {
+  display: block;
+  margin-block-start: ct-particle(2);
+  margin-block-end: ct-particle(2);
+  margin-inline-start: auto;
+  margin-inline-end: auto;
+}

• Please test in CKEditor by inserting an image and using the Align center toolbar button—confirm it remains horizontally centered.

web/themes/contrib/civictheme/assets/sass/theme.scss (1)

10-10: Import looks good – ensure partial exists in build path

@import 'ckeditor/ckeditor'; follows existing import style and will compile as long as assets/sass/ckeditor/_ckeditor.scss (leading underscore) is present. No further action required.

Copy link
Collaborator

@richardgaunt richardgaunt left a comment

Choose a reason for hiding this comment

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

LGTM but Alan will have final review.

@richardgaunt richardgaunt requested a review from alan-cole July 23, 2025 06:03
margin-block-start: ct-particle(2);
margin-block-end: ct-particle(2);
margin-inline-start: ct-particle-px(5);
margin-inline-end: ct-particle-px(5);
Copy link
Collaborator

@alan-cole alan-cole Jul 25, 2025

Choose a reason for hiding this comment

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

I don't understand how these changes could fix the issue.

Can you provide screenshots showing how these changes fix the alignment issues mentioned in the ticket?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2025-07-25 at 12 42 18 PM Screenshot 2025-07-25 at 12 43 52 PM

The ct-figure removes the styles which are needed for align-center align-right
Screenshot 2025-07-25 at 12 44 30 PM

Copy link
Collaborator

@alan-cole alan-cole Jul 29, 2025

Choose a reason for hiding this comment

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

I don't think this is quite working properly.

Looking at the screenshot, it looks like the "center" aligned image is really just left aligned, but sitting indented, and flush against the left aligned image.

If you look at the screenshot below, the center would be slightly different if it was sitting properly in the center:

Screenshot 2025-07-29 at 1 51 18 pm

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

Labels

State: Needs review Pull requests needs a review from assigned developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants