[Preview NG] Replace deprecated ChangeHandler with typed onChange signatures#3588
Open
jeremywiebe wants to merge 3 commits intojer/preview-ng-7-add-preview-with-iframefrom
Open
[Preview NG] Replace deprecated ChangeHandler with typed onChange signatures#3588jeremywiebe wants to merge 3 commits intojer/preview-ng-7-add-preview-with-iframefrom
jeremywiebe wants to merge 3 commits intojer/preview-ng-7-add-preview-with-iframefrom
Conversation
…with typed onChange signatures on Editor and ArticleEditor
Contributor
🗄️ Schema Change: No Changes ✅ |
Contributor
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (69a91a1) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3588If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3588If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3588 |
Contributor
|
Size Change: -76 B (-0.02%) Total Size: 503 kB 📦 View Changed
ℹ️ View Unchanged
|
Contributor
🛠️ Item Splitting: No Changes ✅ |
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
The new signatures are `onChange: (changes: Partial<PerseusRenderer>) => void` for `Editor` and `onChange: (changes: {json: PerseusArticle}) => void` for `ArticleEditor`.
This was referenced May 6, 2026
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:
This PR is part of a series building a typed, hook-based preview system for the Perseus editor. The new system replaces the untyped
window.iframeDataStore+ rawpostMessage(string)communication with structured, validated message passing viausePreviewControllerandusePreviewPresenterhooks. The new system is being built alongside the old one — no existing behavior changes until the final PR in the series flips the switch.Previous PRs in this series:
--
EditorandArticleEditorwere usingChangeHandler(andChangeable.ChangeableProps), a deprecated signature whosecallbackandsilentparameters were dead code throughout the codebase. This replaces both with concrete typed signatures so they are accurate and don't include data that the editor doesn't actually dispatch.Note: This change ripples in a few places worth flagging in review. Inside
ArticleEditor, removingChangeable.ChangeablePropslets us drop the localRendererPropsshim type that existed only to widen the parameter; the affected helpers (_updateIssues,_sections,_handleEditorChange,_apiOptionsForSection,getSaveWarnings) now usePerseusRenderer/PerseusArticledirectly. Ineditor.tsx, twoprops.onChangecall sites previously used the trailingcallbackparameter to position the cursor after a synchronous text replacement; that side-effect is dropped here because no caller actually wired it through, and the cursor positioning code wasn't reachable in practice.Issue: LEMS-3741
Test plan:
pnpm tscpnpm testpnpm lint