fix(ui): support defaultValue in showFontPicker app environment#3118
fix(ui): support defaultValue in showFontPicker app environment#3118SusTechStitch wants to merge 1 commit into
Conversation
|
|
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.
| const font_list = $(elWindow).find('.font-list').get(0); | ||
| if ( window.scrollParentToChild ) { | ||
| window.scrollParentToChild(font_list, active_font.get(0)); |
|
@SusTechStitch could you sign the CLA will test this shortly after |
| } | ||
| } | ||
| options = options || {}; | ||
| const defaultFont = options.defaultValue || options.defaultFont || options.default; |
There was a problem hiding this comment.
small thing in UI.js theres a fallback to 'System UI' when nothing is passed, but here defaultFont just ends up undefined since #2896 is about matching app env to web env, shouldnt this default too?
|
hey @Salazareo, the contributor hasnt responded in a while and CLA is still unsigned would it be ok if i take this over and submit a fresh PR with the same fix? dont want it to go stale |
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.