-
Notifications
You must be signed in to change notification settings - Fork 526
Add wave:editablediv component for inline text editing #2549
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: sawka <[email protected]>
|
|
Co-authored-by: sawka <[email protected]>
Co-authored-by: sawka <[email protected]>
|
@copilot for the keydown handler. Enter should "submit" it -- stop the content editing and fire the onChange event. And hitting "Escape" should revert it back to the original contents and stop editing. |
Co-authored-by: sawka <[email protected]>
Updated the keydown handler in commit d799b29:
Both keys prevent their default behavior and stop editing by blurring the contenteditable div. |
Implements a lightweight inline text editor using
contenteditablefor labels and short text fields.Changes
tsunami/frontend/src/element/editablediv.tsx- New componentonChange(newText)only on blur (no per-character callbacks)text,onChange,className,placeholder, plus passthrough for standard HTML attributestsunami/frontend/src/vdom.tsx- Registerwave:editabledivin WaveTagMaptsunami/frontend/src/tailwind.css- Placeholder styling via:empty:beforepseudo-elementUsage
Keyboard Behavior
The component uses
Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>to avoid type conflicts between the customonChange(string)signature and the standard HTMLonChange(FormEvent).Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.