fix(ui): support defaultValue in showFontPicker app environment#3118
Open
SusTechStitch wants to merge 1 commit into
Open
fix(ui): support defaultValue in showFontPicker app environment#3118SusTechStitch wants to merge 1 commit into
SusTechStitch wants to merge 1 commit into
Conversation
|
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the puter.ui.showFontPicker SDK API and the app-environment font picker window to consistently honor a “default font” provided via string shorthand, defaultFont, defaultValue, or legacy default (Fixes #2896).
Changes:
- Normalize
showFontPickerinputs in the SDK (string shorthand + multiple default-* option keys) before posting to the app environment. - Update
UIWindowFontPickerto readdefaultValue/defaultFont/defaultand to scroll to the active default font without shadowing the globalwindow. - Extend TypeScript types with
FontPickerOptions.defaultValue.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/puter-js/types/modules/ui.d.ts |
Adds defaultValue to FontPickerOptions for typed support. |
src/puter-js/src/modules/UI.js |
Normalizes font picker options (including string shorthand) before app messaging and keeps web-component fallback consistent. |
src/gui/src/UI/UIWindowFontPicker.js |
Supports defaultValue/defaultFont/legacy default and fixes default-item scroll behavior in the app UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+96
to
+98
| const font_list = $(elWindow).find('.font-list').get(0); | ||
| if ( window.scrollParentToChild ) { | ||
| window.scrollParentToChild(font_list, active_font.get(0)); |
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.
Fixes #2896.
Summary
This PR makes
puter.ui.showFontPickerhandle default font options consistently in the Puter app environment.Changes:
defaultFont,defaultValue, and legacydefaultbefore sending options to the app environmentdefaultValue,defaultFont, anddefaultinUIWindowFontPickerwindowdefaultValuetoFontPickerOptionsTesting
git diff --checknode --check src/puter-js/src/modules/UI.jsnode --check src/gui/src/UI/UIWindowFontPicker.jsnpm startManually tested in the Puter app environment:
All three calls open the font picker with Georgia preselected.