fix(color-select-panel): 修复直接输入颜色值时滑块和显示器不同步的问题(#4280) - #4267
Open
Georgyhongbo wants to merge 1 commit into
Open
fix(color-select-panel): 修复直接输入颜色值时滑块和显示器不同步的问题(#4280)#4267Georgyhongbo wants to merge 1 commit into
Georgyhongbo wants to merge 1 commit into
Conversation
…n blur/enter When users type a hex color value directly in the text input, the slider and color display should update accordingly. Previously only slider->text direction worked, not text->slider. - Add onInputBlur to sync state.input to color object on blur - Add @keyup.enter to blur the input, triggering the sync - Guard against empty input and linear-gradient mode
WalkthroughThe color select panel now parses text input into its internal color state on blur, exposes ChangesColor input blur synchronization
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
PR Checklist
PR Type
What is the current behavior?
在颜色选择面板中,拖动滑块可以同步更新文本框的颜色值(slider → text),但直接在文本框输入 hex 颜色值时,滑块和颜色显示器不会同步更新(text → slider)。用户必须通过外部传入 modelValue 才能触发更新。
Issue Number: N/A
What is the new behavior?
在 hex 输入框上添加
@blur事件处理,当用户输入完颜色值后点击别处或按 Enter 键,自动将输入同步到颜色对象,反向驱动滑块和颜色显示器更新。同时添加@keyup.enter让用户按 Enter 即可触发同步,无需多按一次鼠标。技术细节:
onInputBlur函数位于initApi中,仅在输入非空且非渐变色模式下执行color.fromString(input)Does this PR introduce a breaking change?
Other information
改动仅 3 个文件,均为 color-select-panel 模块内部改动,不影响其他组件。
Summary by CodeRabbit