Skip to content
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

fix: fix font name display wrong when config custom font toolbar close #92 #93

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

kagol
Copy link
Member

@kagol kagol commented Oct 19, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #92

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Expanded font options in the custom toolbar of the editor, now including a variety of styles such as 'arial', 'comic', and 'times'.
  • Style

    • Restructured CSS rules for font styles to improve organization without changing existing styles.

@kagol kagol added the bug Something isn't working label Oct 19, 2024
Copy link

coderabbitai bot commented Oct 19, 2024

Walkthrough

The changes in this pull request involve updates to the font options in the custom-toolbar.vue file and a restructuring of CSS rules in the font.scss file. The TOOLBAR_CONFIG array now includes a comprehensive list of font options, enhancing user choice for text formatting. Additionally, the CSS class definitions related to font styles have been reorganized under a new parent class without altering the existing styles.

Changes

File Path Change Summary
packages/docs/fluent-editor/demos/custom-toolbar.vue Updated TOOLBAR_CONFIG to include a comprehensive list of font options for the toolbar.
packages/fluent-editor/src/assets/font.scss Restructured CSS rules by moving .ql-font.ql-picker inside .ql-formats while retaining styles.

Possibly related PRs

  • fix: toolbar style update and ts error #51: This PR modifies the font.scss file, which is directly related to the font options updated in the custom-toolbar.vue file of the main PR, as both involve changes to font styles and configurations.
  • fix: toolbar icon center #86: This PR updates the toolbar.scss file, which is relevant because it enhances the styling of toolbar components, aligning with the changes made to the toolbar configuration in the main PR.

Suggested labels

enhancement

Poem

🐰 In the meadow where fonts play,
A toolbar blooms, bright as day.
With styles galore, a joyful sight,
Choose your font, make text take flight!
Hopping through options, oh what fun,
In our editor, the work's just begun! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

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

🧹 Outside diff range and nitpick comments (3)
packages/docs/fluent-editor/demos/custom-toolbar.vue (1)

23-23: Approve changes with suggestions for improvement

The addition of font options is a good improvement and aligns with the PR objective. However, consider the following suggestions:

  1. Group the fonts by type (e.g., Chinese fonts, serif, sans-serif, decorative) or order them alphabetically for better organization.
  2. Add a comment explaining the rationale behind these specific font choices and whether they are guaranteed to be available across different systems.

Here's a suggested refactor with grouping and a comment:

- [{ font: ['songti', 'yahei', 'kaiti', 'heiti', 'lishu', 'mono', 'arial', 'arialblack', 'comic', 'impact', 'times'] }, { size: ['12px', '14px', '16px', '18px', '20px', '24px', '32px', '36px', '48px', '72px'] }],
+ // Font options: grouped by Chinese fonts, common Western fonts, and decorative fonts
+ // Ensure these fonts are available or have appropriate fallbacks in your CSS
+ [{ font: [
+   // Chinese fonts
+   'songti', 'yahei', 'kaiti', 'heiti', 'lishu',
+   // Common Western fonts
+   'arial', 'times', 'mono',
+   // Decorative fonts
+   'comic', 'impact', 'arialblack'
+ ] }, { size: ['12px', '14px', '16px', '18px', '20px', '24px', '32px', '36px', '48px', '72px'] }],

This grouping makes the font list more organized and the comment provides context for future maintainers.

packages/fluent-editor/src/assets/font.scss (2)

4-4: LGTM: New parent class improves CSS structure.

The introduction of the .ql-formats class is a good step towards better organization of the CSS. This change improves the structure without altering the existing styles.

Consider adding a comment explaining the purpose of this new class for better maintainability.


7-59: LGTM: Styles preserved with good language support.

The nested styles maintain the existing functionality while supporting a wide range of fonts, which is excellent for internationalization and user preference.

Consider the following improvements:

  1. Use CSS variables for repeated values like widths and font families to improve maintainability.
  2. Explore using a loop or mixin in SCSS to reduce repetition in font definitions.

Example refactor for point 1:

.ql-formats {
  --ql-font-picker-width: 108px;
  --ql-font-label-width: 60px;

  .ql-font.ql-picker {
    width: var(--ql-font-picker-width);
    // ... rest of the styles
  }

  // ... other styles

  span[data-value='mono'].ql-picker-label::before,
  span[data-value='comic'].ql-picker-label::before,
  span[data-value='times'].ql-picker-label::before,
  span[data-value='arialblack'].ql-picker-label::before {
    width: var(--ql-font-label-width);
    // ... rest of the styles
  }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 96837f0 and 052f596.

📒 Files selected for processing (2)
  • packages/docs/fluent-editor/demos/custom-toolbar.vue (1 hunks)
  • packages/fluent-editor/src/assets/font.scss (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
packages/docs/fluent-editor/demos/custom-toolbar.vue (1)

23-23: Request clarification on toolbar closing behavior

The changes improve the font options, which is great. However, the PR title mentions fixing an issue when the "custom font toolbar is closed". Could you please clarify how these changes address that specific scenario? It might be helpful to add a comment or implement additional logic if needed to handle the toolbar closing event.

To help verify this, could you provide more context on how the toolbar closing is handled? You might want to search for relevant event handlers or state management related to the toolbar's open/closed state. Here's a script to search for potential related code:

This will help us understand if there's any existing logic for handling toolbar state that might need to be updated along with these changes.

packages/fluent-editor/src/assets/font.scss (1)

5-6: Verify the impact of increased selector specificity.

The nesting of .ql-font.ql-picker under .ql-formats is good for organization. However, this increases the specificity of the selectors.

Please run the following script to check for any conflicting styles that might be affected by this change:

✅ Verification successful

Increased Selector Specificity Verified

No conflicting styles found for .ql-formats .ql-font.ql-picker outside of font.scss.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential conflicts with the new .ql-formats .ql-font.ql-picker selector

# Search for other styles targeting .ql-font.ql-picker
echo "Searching for other .ql-font.ql-picker styles:"
rg --type css ".ql-font.ql-picker" --glob "!packages/fluent-editor/src/assets/font.scss"

# Search for other styles within .ql-formats
echo "Searching for other .ql-formats styles:"
rg --type css ".ql-formats" --glob "!packages/fluent-editor/src/assets/font.scss"

Length of output: 490


Script:

#!/bin/bash
# Description: Extract the .ql-formats class definition from toolbar.scss

rg "\.ql-formats\s*\{" packages/fluent-editor/src/assets/toolbar.scss -A 10

Length of output: 578

@kagol kagol merged commit 8188ef7 into main Oct 21, 2024
6 checks passed
@kagol kagol deleted the kagol/fix-font-toolbar branch October 22, 2024 10:34
@coderabbitai coderabbitai bot mentioned this pull request Dec 6, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants