-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Add configurable block and inline styles for Tiptap #51
Conversation
Reviewer's Guide by SourceryThis pull request introduces a flexible styling system for inline and block elements, replacing the fixed styles (Small, Var, Kbd, Samp) with configurable styles. The toolbar has been updated to support these changes. Sequence diagram for style applicationsequenceDiagram
participant User
participant Editor
participant StyleSystem
participant DOM
User->>Editor: Clicks style button
Editor->>StyleSystem: toggleStyle(id)
StyleSystem->>StyleSystem: Check style exists
alt Style exists
StyleSystem->>StyleSystem: Check if style active
alt Style is active
StyleSystem->>DOM: Remove style
else Style not active
StyleSystem->>DOM: Apply style attributes
end
end
DOM-->>User: Updated content display
Class diagram for the new style systemclassDiagram
class Style {
+addOptions()
+addAttributes()
+parseHTML()
+renderHTML()
}
class InlineStyle {
+name: string
+defaultTag: string
+addOptions()
+addCommands()
-toggleInlineStyle(id)
-activeInlineStyle(id)
}
class BlockStyle {
+name: string
+group: string
+content: string
+defaultTag: string
+addCommands()
-toggleBlockStyle(id)
-activeBlockStyle(id)
}
Style <|-- InlineStyle
Style <|-- BlockStyle
note for Style "Base functionality for styling"
note for InlineStyle "Handles inline text styling"
note for BlockStyle "Handles block-level styling"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please remove the console.log statements before merging (in cms.styles.js)
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
=======================================
Coverage 81.22% 81.22%
=======================================
Files 17 17
Lines 932 932
Branches 104 104
=======================================
Hits 757 757
Misses 132 132
Partials 43 43 ☔ View full report in Codecov by Sentry. |
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a more efficient comparison method than JSON.stringify() for style matching. For deeply nested styles, this could impact performance.
- The HTML string concatenation in generateColorMenu and renderStyleMenu functions could be vulnerable to XSS. Consider using DOM manipulation methods or a templating library instead.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Add support for configurable inline and block styles, replacing the hardcoded small, kbd, var, and samp styles.
New Features:
Tests: