-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Added button text editing to CTA Card #1416
Conversation
ref https://linear.app/ghost/issue/PLG-312/implement-button-text-update - Added ability to update the text of a button - added test
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
packages/koenig-lexical/src/nodes/CallToActionNodeComponent.jsxOops! Something went wrong! :( ESLint: 8.57.0 ESLint couldn't find the config "react-app" to extend from. Please check that the name of the config is correct. The config "react-app" was referenced from the config file in "/packages/koenig-lexical/.eslintrc.cjs". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. WalkthroughThe pull request introduces a new function Changes
Sequence DiagramsequenceDiagram
participant User
participant CtaCard
participant Editor
participant Node
User->>CtaCard: Input button text
CtaCard->>Editor: Call handleButtonTextChange
Editor->>Node: Update buttonText property
Node-->>CtaCard: Text updated
CtaCard-->>User: Display updated button text
Possibly related PRs
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/koenig-lexical/src/nodes/CallToActionNodeComponent.jsx (1)
43-48
: Consider adding input validation and error handling.While the implementation is functionally correct, consider these improvements:
- Add input validation for the button text
- Handle potential errors when retrieving the node
const handleButtonTextChange = (event) => { + const newText = event.target.value; + // Optional: Add validation + if (newText.length > 100) { + return; + } editor.update(() => { const node = $getNodeByKey(nodeKey); + if (!node) { + console.warn(`Node with key ${nodeKey} not found`); + return; + } node.buttonText = event.target.value; }); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/koenig-lexical/src/nodes/CallToActionNodeComponent.jsx
(2 hunks)packages/koenig-lexical/test/e2e/cards/cta-card.test.js
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Node 20.11.1
🔇 Additional comments (2)
packages/koenig-lexical/test/e2e/cards/cta-card.test.js (1)
59-65
: Well-structured test case!The test effectively verifies the button text editing functionality with clear setup, action, and assertion steps. It follows the established testing patterns in the file.
packages/koenig-lexical/src/nodes/CallToActionNodeComponent.jsx (1)
70-70
: LGTM!The prop update correctly connects the new handler to the CtaCard component.
ref https://linear.app/ghost/issue/PLG-312/implement-button-text-update
Summary by CodeRabbit
New Features
Tests