fix(onboarding): source step 3 typography from imported site#460
Merged
selul merged 1 commit intodevelopmentfrom Apr 23, 2026
Merged
fix(onboarding): source step 3 typography from imported site#460selul merged 1 commit intodevelopmentfrom
selul merged 1 commit intodevelopmentfrom
Conversation
Mirrors the Palette control on step 3 by driving the Typography list from `importData.font_pairs` (returned by the demo site's `/wp-json/ti-demo-data/data` endpoint) instead of `tiobDash.fontParings`, which reflected the admin site's local Neve settings. This keeps the admin-side slugs in sync with the preview iframe's resolver, so clicked font pairs actually apply in the preview. Also fixes the broken "Default"/reset button: default fonts are now derived from `importDataDefault.theme_mods` inside `withDispatch` (removing the `useState` + `ownProps` pattern that resolved to `undefined` at click time). Falls back to `tiobDash.fontParings` when the demo site does not yet return `font_pairs`. Made-with: Cursor
Collaborator
Collaborator
|
🎉 This PR is included in version 1.2.28 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Makes the step 3 Typography control behave like the Palette control: the list of font pairs is driven by
importData.font_pairs(returned by the demo site's/wp-json/ti-demo-data/dataendpoint) instead oftiobDash.fontParings, which was populated from the admin site's local Neve settings.This is the consumer half of a two-PR change. The exporter PR that adds
font_pairsto the REST response is https://github.com/Codeinwp/demo-data-exporter/pull/new/fix/export-font-pairs.Why
Before this change, step 3 showed the admin site's Neve font pairs while the preview iframe resolved clicked slugs against the demo site's font pairs (via Demo Data Exporter's
eventHandlerData.fonts). The two lists drift in content and in the-<index>suffix generated byget_slug_from_font_pair(...) . '-' . $index, so clicks often posted a slug the iframe could not find.getFontStyle()then returned''anddocument.documentElement.style.cssText = paletteStyle + fontStylewiped the typography CSS vars — the preview fell back to browser defaults instead of the imported site's fonts.The Default/reset button was also broken: the component stored
defaultBodyFont/defaultHeadingsFontviauseStatein the component body, butwithDispatchdestructured them fromownPropswhere they were alwaysundefined. Clicking "Default" wroteneve_body_font_family: undefined, neve_headings_font_family: undefinedtoimportData, so the iframe lookup forfonts.defaultreturned nothing and the preview fonts disappeared entirely.Changes
onboarding/src/Components/CustomizeControls/TypographyControl.jsgetFontPairs(importData)helper that prefersimportData.font_pairs(the demo site's list) and falls back totiobDash.fontParingsso older demos still render.getDefaultFonts(importDataDefault)helper. Both the component body (for the button tooltip) and thewithDispatchclick handler use the same resolver, pulling fromimportDataDefault.theme_mods.neve_body_font_family/neve_headings_font_family. Removes the staleuseState+ownPropspattern.handleFontClicknow reads the selected pair from the resolved map (nottiobDash.fontParings) and only falls back to defaults when the slug genuinely isn't present.onboarding/src/Components/SiteSettings.js: passimportDataDefaultinto<TypographyControl />, mirroring the existing<LogoControl importDataDefault={...} />wiring.No change to the
styleChangeprotocol or the iframe handler — slugs now align because both sides read fromDde_Palette_Switcher.Test plan
npm run build:onboardingcompiles cleanly (verified locally).font_pairsfrom DDE: step 3 font strip matches the demo site's Neve font pairs.importData.theme_mods.neve_body_font_family/neve_headings_font_familyare populated (notundefined).font_pairsin its REST response (older DDE): control gracefully falls back totiobDash.fontParings(pre-PR behavior).Made with Cursor