feat(visual-builder): normalize multiline value on SYNC_FIELD for on-type canvas save#626
Merged
Merged
Conversation
…type canvas save On the on-type SYNC_FIELD event, normalize a multiline field's value with getMultilinePlaintext so the value sent to the editor matches what a commit would send, without rewriting the editable DOM (which would move the caret). The editable DOM is rewritten only on the commit UPDATE_FIELD, so inline typing stays caret-safe while still persisting the correct plaintext on type. Co-Authored-By: Claude <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
Normalize multiline value on SYNC_FIELD for on-type canvas save
Description
When Visual Builder saves canvas edits on type, a multiline field now sends a normalized plaintext value on the
SYNC_FIELDevent, matching what the commitUPDATE_FIELDsends. Previously only the commit path normalized the value, so an on-type save could persist raw editable markup for multiline fields.The editable DOM is rewritten with the normalized value only on
UPDATE_FIELD(the commit), not onSYNC_FIELD. Rewriting on every keystroke would move the caret, so on-type editing stays caret-safe while still sending the correct plaintext.Base is
feat/canvas-field-lock(stacked). Pairs with the Visual Builder change that persists canvas edits on type.Type of Change
Testing
Unit tests in
generateOverlay.test.tscover both paths: the multiline value is normalized on the on-typeSYNC_FIELDwithout rewriting the editable DOM, and the editable DOM is rewritten with the normalized value on the commitUPDATE_FIELD. Run:npx vitest run src/visualBuilder/generators/__test__/generateOverlay.test.ts. All pass.🤖 Generated with Claude Code